]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
Btrfs: fix unprotected root node of the subvolume's inode rb-tree
authorMiao Xie <miaox@cn.fujitsu.com>
Wed, 15 May 2013 07:48:16 +0000 (07:48 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Sat, 18 May 2013 01:40:30 +0000 (21:40 -0400)
The root node of the rb-tree may be changed, so we should get it under
the lock. Fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/inode.c

index 790eceb48fb07ee193985727bf4fcc6daf11757a..19eef3e852b09774a6c64feae5d0e0e6cd37c019 100644 (file)
@@ -4843,14 +4843,13 @@ static void inode_tree_add(struct inode *inode)
        struct rb_node **p;
        struct rb_node *parent;
        u64 ino = btrfs_ino(inode);
-again:
-       p = &root->inode_tree.rb_node;
-       parent = NULL;
 
        if (inode_unhashed(inode))
                return;
-
+again:
+       parent = NULL;
        spin_lock(&root->inode_lock);
+       p = &root->inode_tree.rb_node;
        while (*p) {
                parent = *p;
                entry = rb_entry(parent, struct btrfs_inode, rb_node);