aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorArne Jansen <sensille@gmx.net>2012-02-25 03:09:30 -0500
committerDavid Sterba <dsterba@suse.cz>2012-04-18 13:12:44 -0400
commit8c9c2bf7a3c4f7e9d158c0be9c49f372fb943ad2 (patch)
tree6c17b4db9b39cb8eb950c21377f453df18f467c3 /fs/btrfs/inode.c
parent848cce0d4102b5b4b26b0987b43e1919d462afe2 (diff)
btrfs: fix race in reada
When inserting into the radix tree returns EEXIST, get the existing entry without giving up the spinlock in between. There was a race for both the zones trees and the extent tree. Signed-off-by: Arne Jansen <sensille@gmx.net>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a682c267576d..98ee5a51aa29 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4332,7 +4332,13 @@ static int btrfs_real_readdir(struct file *filp, void *dirent,
4332 } 4332 }
4333no_dentry: 4333no_dentry:
4334 /* is this a reference to our own snapshot? If so 4334 /* is this a reference to our own snapshot? If so
4335 * skip it 4335 * skip it.
4336 *
4337 * In contrast to old kernels, we insert the snapshot's
4338 * dir item and dir index after it has been created, so
4339 * we won't find a reference to our own snapshot. We
4340 * still keep the following code for backward
4341 * compatibility.
4336 */ 4342 */
4337 if (location.type == BTRFS_ROOT_ITEM_KEY && 4343 if (location.type == BTRFS_ROOT_ITEM_KEY &&
4338 location.objectid == root->root_key.objectid) { 4344 location.objectid == root->root_key.objectid) {