diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2013-05-15 03:48:16 -0400 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-05-17 21:40:30 -0400 |
commit | e1409cef85894f96f4bddc6633d64d1c5275e2a3 (patch) | |
tree | 712194a90f35e47e18f23b29cc630674befd5fc2 /fs | |
parent | 89042e5ad23d50449691141334f30d53d6271266 (diff) |
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: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 790eceb48fb0..19eef3e852b0 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4843,14 +4843,13 @@ static void inode_tree_add(struct inode *inode) | |||
4843 | struct rb_node **p; | 4843 | struct rb_node **p; |
4844 | struct rb_node *parent; | 4844 | struct rb_node *parent; |
4845 | u64 ino = btrfs_ino(inode); | 4845 | u64 ino = btrfs_ino(inode); |
4846 | again: | ||
4847 | p = &root->inode_tree.rb_node; | ||
4848 | parent = NULL; | ||
4849 | 4846 | ||
4850 | if (inode_unhashed(inode)) | 4847 | if (inode_unhashed(inode)) |
4851 | return; | 4848 | return; |
4852 | 4849 | again: | |
4850 | parent = NULL; | ||
4853 | spin_lock(&root->inode_lock); | 4851 | spin_lock(&root->inode_lock); |
4852 | p = &root->inode_tree.rb_node; | ||
4854 | while (*p) { | 4853 | while (*p) { |
4855 | parent = *p; | 4854 | parent = *p; |
4856 | entry = rb_entry(parent, struct btrfs_inode, rb_node); | 4855 | entry = rb_entry(parent, struct btrfs_inode, rb_node); |