浏览代码

Btrfs: balance_level checks !child after access

The BUG_ON() is in the wrong spot.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Jeff Mahoney 16 年之前
父节点
当前提交
7951f3cefb
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      fs/btrfs/ctree.c

+ 1 - 1
fs/btrfs/ctree.c

@@ -917,9 +917,9 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
 
 
 		/* promote the child to a root */
 		/* promote the child to a root */
 		child = read_node_slot(root, mid, 0);
 		child = read_node_slot(root, mid, 0);
+		BUG_ON(!child);
 		btrfs_tree_lock(child);
 		btrfs_tree_lock(child);
 		btrfs_set_lock_blocking(child);
 		btrfs_set_lock_blocking(child);
-		BUG_ON(!child);
 		ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0);
 		ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0);
 		BUG_ON(ret);
 		BUG_ON(ret);