From: David Chinner <dgc@sgi.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Satyam Sharma <satyam.sharma@gmail.com>,
Johannes Weiner <hannes-kernel@saeurebad.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
xfs-masters@oss.sgi.com, David Chinner <dgc@sgi.com>
Subject: Re: [BUG] Lockdep warning with XFS on 2.6.22-rc6
Date: Tue, 26 Jun 2007 12:16:17 +1000 [thread overview]
Message-ID: <20070626021617.GK989688@sgi.com> (raw)
In-Reply-To: <20070625210111.GB26725@elte.hu>
On Mon, Jun 25, 2007 at 11:01:11PM +0200, Ingo Molnar wrote:
>
> * Satyam Sharma <satyam.sharma@gmail.com> wrote:
>
> > [ Ok, so we know that XFS wants to lock inodes in ascending inode
> > number order and not strictly the parent-first-child-second order that
> > rest of the fs/ code does, so that makes it difficult to teach lockdep
> > about this kind of lock ordering ... ]
It does both - parent-first/child-second and ascending inode # order,
which is where the problem is. standing alone, these seem fine, but
they don't appear to work when the child has a lower inode number
than the parent.
> hm, there's a recent API addition to lockdep that should help with this:
> have you looked into the patch below, could it be used to solve the XFS
> problem? Basically when you are one step deeper into a recursive locking
> scenario you can use lock_set_subclass() on the held lock to reset it
> one level higher.
Peter Zijlstra already pointed me at that patch, Ingo ;). I'm looking
into it at the moment. Not being a lockdep expert, it's taking me a
little time to understand exactly what is needed here.
At first I wasn't sure that this would work, but now I've seen the
patch that used it, I suspect that it can be used. That patch
(http://lkml.org/lkml/2007/1/28/88) has three cases enumerated
(prev,cur,next) to match the three node types in the list and that
the "next" got set back to "cur" via lock_set_subclass() when
walking the list so that lockdep always sees cur -> next
transistions when walking the list. Have I read this correctly?
Reading this, it seems to me that the xfs_lock_inodes() code needs
to set the lock subclass of the first inode to "parent" (and lock it
as a parent) and then as it walks across the remining inodes it sets
the previous inode to a parent and locks the current inode as a
child.
It seems that I'd also need to make sure that this is done on the
normal parent/child lock ordering as well.
Does this make any sense? lockdep is not something I've paid much
attention to up to this point (someone else did the current notation
and now on leave for a couple more months), so I'm trying to pick up
the pieces as quickly as possible...
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
next prev parent reply other threads:[~2007-06-26 2:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-25 10:49 [BUG] Lockdep warning with XFS on 2.6.22-rc6 Johannes Weiner
2007-06-25 15:54 ` Satyam Sharma
2007-06-25 21:01 ` Ingo Molnar
2007-06-26 2:16 ` David Chinner [this message]
2007-06-26 9:35 ` Jarek Poplawski
2007-06-26 12:50 ` David Chinner
2007-06-27 6:42 ` [xfs-masters] " Tim Shimmin
2007-06-27 14:01 ` Thomas Sattler
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=20070626021617.GK989688@sgi.com \
--to=dgc@sgi.com \
--cc=hannes-kernel@saeurebad.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=satyam.sharma@gmail.com \
--cc=xfs-masters@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox