Commit e1409cef authored by Miao Xie's avatar Miao Xie Committed by Josef Bacik

Btrfs: fix unprotected root node of the subvolume's inode rb-tree

The root node of the rb-tree may be changed, so we should get it under
the lock. Fix it.
Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent 89042e5a
...@@ -4843,14 +4843,13 @@ static void inode_tree_add(struct inode *inode) ...@@ -4843,14 +4843,13 @@ static void inode_tree_add(struct inode *inode)
struct rb_node **p; struct rb_node **p;
struct rb_node *parent; struct rb_node *parent;
u64 ino = btrfs_ino(inode); u64 ino = btrfs_ino(inode);
again:
p = &root->inode_tree.rb_node;
parent = NULL;
if (inode_unhashed(inode)) if (inode_unhashed(inode))
return; return;
again:
parent = NULL;
spin_lock(&root->inode_lock); spin_lock(&root->inode_lock);
p = &root->inode_tree.rb_node;
while (*p) { while (*p) {
parent = *p; parent = *p;
entry = rb_entry(parent, struct btrfs_inode, rb_node); entry = rb_entry(parent, struct btrfs_inode, rb_node);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment