On Tue, May 31, 2011 at 04:09:50PM -0400, Christoph Hellwig wrote:
> Looks good.
>
>
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>
>
> > + * XXX(dgc): should the XFS_ISTALE flag only be cleared here?
>
> I think so. Right now any iget on a stale inode will clear it, which
> is very wrong. Care to send a separate patch for that?
However, the di_mode has already been set to zero before it is
marked stale, so any lookup on it without the XFS_IGET_CREATE flag
set will fail. And only inode allocation sets that flag, in which
case we want the XFS_ISTALE flag cleared. We can't have a race with
the XFS_ISTALE flag being set (both inode freeing and allocation
requires the AGI lock), so once it is stale it is protected by the
mode/flag check.
So it seems safe where it is, but it's not exactly obvious why.
Hmmmm. The inode_init_always() failure case does not clear the
XFS_IRECLAIM flag - that seems like a bug as it will prevent the
inode from ever being reclaimed. Indeed, the error handling looks
completely broken - it's like it is assuming the inode has already
been removed from the reclaim list and marked XFS_INEW. Oh, it used
to do exactly that before this commmit:
commit f1f724e4b523d444c5a598d74505aefa3d6844d2
Author: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Mon Mar 1 11:30:31 2010 +0000
xfs: fix locking for inode cache radix tree tag updates
The radix-tree code requires it's users to serialize tag updates
against other updates to the tree. While XFS protects tag updates
against each other it does not serialize them against updates of the
tree contents, which can lead to tag corruption. Fix the inode
cache to always take pag_ici_lock in exclusive mode when updating
radix tree tags.
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Reported-by: Patrick Schreurs <patrick@xxxxxxxxxxxxxxxx>
Tested-by: Patrick Schreurs <patrick@xxxxxxxxxxxxxxxx>
Signed-off-by: Alex Elder <aelder@xxxxxxx>
So yes, it needs fixing.
Cheers,
Dave.
--
Dave Chinner
david@xxxxxxxxxxxxx
|