xfs
[Top] [All Lists]

[XFS updates] XFS development tree branch, for-next, updated. v3.2-rc1-1

To: xfs@xxxxxxxxxxx
Subject: [XFS updates] XFS development tree branch, for-next, updated. v3.2-rc1-11461-gcd21cea
From: xfs@xxxxxxxxxxx
Date: Wed, 29 Feb 2012 21:29:52 -0600
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "XFS development tree".

The branch, for-next has been updated
  cd21cea xfs: fix inode lookup race
      from  4b217ed9e30f94b6e8e5e262020ef0ceab6113af (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit cd21cea3aa527024797ba2089b3c37e94c385606
Author: Dave Chinner <dchinner@xxxxxxxxxx>
Date:   Wed Feb 29 21:22:40 2012 -0600

    xfs: fix inode lookup race
    
    When we get concurrent lookups of the same inode that is not in the
    per-AG inode cache, there is a race condition that triggers warnings
    in unlock_new_inode() indicating that we are initialising an inode
    that isn't in a the correct state for a new inode.
    
    When we do an inode lookup via a file handle or a bulkstat, we don't
    serialise lookups at a higher level through the dentry cache (i.e.
    pathless lookup), and so we can get concurrent lookups of the same
    inode.
    
    The race condition is between the insertion of the inode into the
    cache in the case of a cache miss and a concurrently lookup:
    
    Thread 1                    Thread 2
    xfs_iget()
      xfs_iget_cache_miss()
        xfs_iread()
        lock radix tree
        radix_tree_insert()
                                        rcu_read_lock
                                radix_tree_lookup
                                lock inode flags
                                XFS_INEW not set
                                igrab()
                                unlock inode flags
                                rcu_read_unlock
                                use uninitialised inode
                                .....
        lock inode flags
        set XFS_INEW
        unlock inode flags
        unlock radix tree
      xfs_setup_inode()
        inode flags = I_NEW
        unlock_new_inode()
          WARNING as inode flags != I_NEW
    
    This can lead to inode corruption, inode list corruption, etc, and
    is generally a bad thing to occur.
    
    Fix this by setting XFS_INEW before inserting the inode into the
    radix tree. This will ensure any concurrent lookup will find the new
    inode with XFS_INEW set and that forces the lookup to wait until the
    XFS_INEW flag is removed before allowing the lookup to succeed.
    
    Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
    Reviewed-by: Christoph Hellwig <hch@xxxxxx>
    Signed-off-by: Ben Myers <bpm@xxxxxxx>
    (cherry picked from commit 5cfc459ec18d1f0bbf6971966d35cdb8e66cfbbc)

-----------------------------------------------------------------------

Summary of changes:
 fs/xfs/xfs_iget.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
XFS development tree

<Prev in Thread] Current Thread [Next in Thread>
  • [XFS updates] XFS development tree branch, for-next, updated. v3.2-rc1-11461-gcd21cea, xfs <=