Skip to contentSkip to conversation

btrfs: balance_level checks !child after access

PATCH New Jeff Mahoney 1 participant 1 message Feb 4, 2009 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: balance_level checks !child after access

The BUG_ON(!child) should be before it's used.

---

 fs/btrfs/ctree.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/ctree.c +1 -1
@@ -917,9 +917,9 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
 
 		/* promote the child to a root */
 		child = read_node_slot(root, mid, 0);
+		BUG_ON(!child);
 		btrfs_tree_lock(child);
 		btrfs_set_lock_blocking(child);
-		BUG_ON(!child);
 		ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0);
 		BUG_ON(ret);
 
Signature · 2 lines
Jeff Mahoney
SUSE Labs