• Chris Mason's avatar
    Btrfs: setup inode location during btrfs_init_inode_locked · 5da1d479
    Chris Mason authored
    commit 90d3e592 upstream.
    
    We have a race during inode init because the BTRFS_I(inode)->location is setup
    after the inode hash table lock is dropped.  btrfs_find_actor uses the location
    field, so our search might not find an existing inode in the hash table if we
    race with the inode init code.
    
    This commit changes things to setup the location field sooner.  Also the find actor now
    uses only the location objectid to match inodes.  For inode hashing, we just
    need a unique and stable test, it doesn't have to reflect the inode numbers we
    show to userland.
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    [bwh: Backported to 3.2:
     - No hashval in btrfs_iget_locked()]
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    5da1d479
inode.c 198 KB