]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: setup inode location during btrfs_init_inode_locked
authorChris Mason <clm@fb.com>
Fri, 10 Jan 2014 01:28:00 +0000 (17:28 -0800)
committerChris Mason <clm@fb.com>
Wed, 29 Jan 2014 15:06:30 +0000 (07:06 -0800)
commit009a039deb109710fb47ccfe44f3b7b3b05c669e
tree9e2b61f449524e988dacb04a770b87a2e3fddc23
parent9e3e3f7200a96064db94b5d5a84ac3e6254b6438
Btrfs: setup inode location during btrfs_init_inode_locked

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: Chris Mason <clm@fb.com>
CC: stable@vger.kernel.org
fs/btrfs/inode.c