From: Miao Xie Date: Wed, 15 May 2013 07:48:16 +0000 (+0000) Subject: Btrfs: fix unprotected root node of the subvolume's inode rb-tree X-Git-Tag: submit/tizen_common/20140905.094502~2561^2~86^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e1409cef85894f96f4bddc6633d64d1c5275e2a3;p=sdk%2Femulator%2Femulator-kernel.git 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 Signed-off-by: Josef Bacik --- 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) 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);