summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorArne Jansen <sensille@gmx.net>2012-02-25 09:09:30 +0100
committerDavid Sterba <dsterba@suse.cz>2012-04-18 19:12:44 +0200
commit8c9c2bf7a3c4f7e9d158c0be9c49f372fb943ad2 (patch)
tree6c17b4db9b39cb8eb950c21377f453df18f467c3 /fs/btrfs/inode.c
parent848cce0d4102b5b4b26b0987b43e1919d462afe2 (diff)
downloadtalos-op-linux-8c9c2bf7a3c4f7e9d158c0be9c49f372fb943ad2.tar.gz
talos-op-linux-8c9c2bf7a3c4f7e9d158c0be9c49f372fb943ad2.zip
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,
}
no_dentry:
/* is this a reference to our own snapshot? If so
- * skip it
+ * skip it.
+ *
+ * In contrast to old kernels, we insert the snapshot's
+ * dir item and dir index after it has been created, so
+ * we won't find a reference to our own snapshot. We
+ * still keep the following code for backward
+ * compatibility.
*/
if (location.type == BTRFS_ROOT_ITEM_KEY &&
location.objectid == root->root_key.objectid) {
OpenPOWER on IntegriCloud