On Thu, 2010-11-25 at 06:25 -0500, Christoph Hellwig wrote:
> On Thu, Nov 25, 2010 at 09:29:40PM +1100, Dave Chinner wrote:
> > Yes, actually it is - see the XFS_IRECLAIMABLE case in
> > xfs_iget_cache_hit(). I guess we haven't seen the original lock
> > inversion false positives that this was supposed to fix because the
> > reclaim warnings trip first...
> > I think that means we also need to reinitialise the lock when we recycle
> > the inode out of the XFS_IRECLAIMABLE state.
> I came up with the patch below when we had a previous report of the
> warning, but I couldn't convince myself that it really helps:
> Index: linux-2.6/fs/xfs/xfs_iget.c
> --- linux-2.6.orig/fs/xfs/xfs_iget.c 2010-09-20 12:10:28.227444173 -0300
> +++ linux-2.6/fs/xfs/xfs_iget.c 2010-09-20 12:11:25.631444190 -0300
> @@ -207,6 +207,10 @@ xfs_iget_cache_hit(
> ip->i_flags &= ~XFS_INEW;
> ip->i_flags |= XFS_IRECLAIMABLE;
> + ASSERT(!rwsem_is_locked(&ip->i_iolock.mr_lock));
> + mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio",
> __xfs_inode_set_reclaim_tag(pag, ip);
> goto out_error;
That adds a 3rd class which should work, but doesn't validate that the
first -- xfs_inode_alloc() and this one are in fact similar.