From: Dave Chinner <david@fromorbit.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Nick Piggin <npiggin@kernel.dk>,
xfs@oss.sgi.com
Subject: Re: XFS reclaim lock order bug
Date: Thu, 25 Nov 2010 21:32:00 +1100 [thread overview]
Message-ID: <20101125103200.GF12187@dastard> (raw)
In-Reply-To: <1290670097.2072.554.camel@laptop>
On Thu, Nov 25, 2010 at 08:28:17AM +0100, Peter Zijlstra wrote:
> On Thu, 2010-11-25 at 18:08 +1100, Nick Piggin wrote:
> > > +static struct lock_class_key xfs_dead_inode;
> > > +
> > > STATIC void
> > > xfs_fs_evict_inode(
> > > struct inode *inode)
> > > @@ -1118,6 +1120,8 @@ xfs_fs_evict_inode(
> > > */
> > > ASSERT(!rwsem_is_locked(&ip->i_iolock.mr_lock));
> > > mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino);
> > > + lockdep_set_class_and_name(&ip->i_iolock->mr_lock, &xfs_dead_inode,
> > > + "xfd_dead_inode");
> > >
> > > xfs_inactive(ip);
> > > }
> >
> > With this change, I assume the mrlock_init can go? (it would be nice
> > to have a wrapper to allocate the class by itself)
>
>
> mrlock_init() does allocate a class (well rwsem_init, really), but sets
> the name to a stringified version of the lock argument.
>
> The lockdep_set_class*() interface is only guaranteed to work on a
> freshly initialized lock structure -- which in this case is a bit of a
> waste, but for debugging purposes would allow setting a clearer name.
>
> Alternatively, you can write the code like:
>
> xfs_inode_t dead_ip = XFS_I(inode);
>
> mrlock_init(&dead_ip->i_iolock, ...);
>
> In which case its also obvious, as that would result in:
>
> (&(&dead_ip->i_iolock)->mr_lock)
>
> as opposed to:
>
> (&(&ip->i_iolock)->mr_lock)
Ok, that's a handy trick to know. I'll try and sort this out
tomorrow and make use of this trick to help identify the different
lock classes.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-11-25 10:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-23 12:18 XFS reclaim lock order bug Nick Piggin
2010-11-23 21:12 ` Dave Chinner
2010-11-24 0:58 ` Nick Piggin
2010-11-24 2:26 ` Dave Chinner
2010-11-24 20:03 ` Christoph Hellwig
2010-11-25 3:48 ` Nick Piggin
2010-11-25 6:25 ` Peter Zijlstra
2010-11-25 7:08 ` Nick Piggin
2010-11-25 7:28 ` Peter Zijlstra
2010-11-25 10:32 ` Dave Chinner [this message]
2010-11-25 10:29 ` Dave Chinner
2010-11-25 10:36 ` Peter Zijlstra
2010-11-25 11:25 ` Christoph Hellwig
2010-11-25 11:37 ` Peter Zijlstra
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=20101125103200.GF12187@dastard \
--to=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=mingo@redhat.com \
--cc=npiggin@kernel.dk \
--cc=peterz@infradead.org \
--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.