From: Timothy Shimmin <tes@sgi.com>
To: David Chinner <dgc@sgi.com>, Eric Sandeen <sandeen@sandeen.net>
Cc: xfs@oss.sgi.com
Subject: Re: xfs vs. lockdep
Date: Tue, 10 Oct 2006 11:45:55 +1000 [thread overview]
Message-ID: <C013892BDA68824F76A0474A@boing.melbourne.sgi.com> (raw)
In-Reply-To: <20061010004726.GO11034@melbourne.sgi.com>
--On 10 October 2006 10:47:26 AM +1000 David Chinner <dgc@sgi.com> wrote:
> On Mon, Oct 09, 2006 at 12:58:58PM -0500, Eric Sandeen wrote:
>> FC6 kernels are oopsing when lockdep & memory debugging are turned on,
>> looks like due to this code:
>>
>> xfs_ireclaim(xfs_inode_t *ip)
>> {
>> ...
>> /*
>> * Here we do a spurious inode lock in order to coordinate with
>> * xfs_sync(). This is because xfs_sync() references the inodes
>> * in the mount list without taking references on the
>> corresponding * vnodes. We make that OK here by ensuring that
>> we wait until * the inode is unlocked in xfs_sync() before we
>> go ahead and * free it. We get both the regular lock and the
>> io lock because * the xfs_sync() code may need to drop the
>> regular one but will * still hold the io lock.
>> */
>> xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
>> ...
>> /*
>> * Free all memory associated with the inode.
>> */
>> xfs_idestroy(ip);
>> }
>>
>> So, lock & free. This frees memory that lockdep is still pointing to,
>> and tries to use later.
>>
>> Calling xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); just before
>> xfs_idestroy seems to solve it, but is this safe...?
>
> It should be - we call xfs_iextract() before the xfs_ilock() call
> shown above. That means the inode has been removed from the mount
> list when we take the locks. Once the inode has been removed
> from the mount list, the only possible current user is xfs_sync_inodes(),
> and it will only be referencing the inode if it is currently working
> on the inode. If it is working on the inode, then it will be holding
> at least one of the inode locks.
>
> Hence by the time we have the lock here in xfs_ireclaim we have guaranteed
> that there are no other outstanding references and no new references
> can occur. Therefore it should be safe to drop the lock before destroying
> it.
>
Yeah, there really seems like something would be wrong if you can't
unlock it before destroying it.
I would have thought you'd need to guarantee that you are the only
one with access to it before destroying it otherwise there'd be problems :)
(Which as you say we do)
This one rings a bell. I seem to recall multiple places where we destroy
without releasing the lock first.
And I vaguely remember Nathan mentioning that this was causing grief
for lockdep:)
--Tim
next prev parent reply other threads:[~2006-10-10 1:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-09 17:58 xfs vs. lockdep Eric Sandeen
2006-10-09 23:36 ` Vlad Apostolov
2006-10-10 3:06 ` Eric Sandeen
2006-10-10 3:23 ` Vlad Apostolov
2006-10-10 0:47 ` David Chinner
2006-10-10 1:45 ` Timothy Shimmin [this message]
2006-10-10 2:21 ` Eric Sandeen
2006-10-10 4:55 ` Timothy Shimmin
2006-10-10 2:25 ` Eric Sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C013892BDA68824F76A0474A@boing.melbourne.sgi.com \
--to=tes@sgi.com \
--cc=dgc@sgi.com \
--cc=sandeen@sandeen.net \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.