From 8925d8ec7162a0178b669296b8db717fcaf090f0 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Thu, 1 Sep 2011 11:27:57 -0700 Subject: [PATCH] --- yaml --- r: 297881 b: refs/heads/master c: 305a26af5b2561a66859ef05ed7eb73d3c9f0913 h: refs/heads/master i: 297879: 39ce7d6e0c263a8b690d03571c8e553055947eac v: v3 --- [refs] | 2 +- trunk/fs/btrfs/ctree.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 023dccff6a23..fbda98d981b0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b68dc2a93e794c8507338c91577a277efa4555d5 +refs/heads/master: 305a26af5b2561a66859ef05ed7eb73d3c9f0913 diff --git a/trunk/fs/btrfs/ctree.c b/trunk/fs/btrfs/ctree.c index 36e16bd50798..651a26a6c651 100644 --- a/trunk/fs/btrfs/ctree.c +++ b/trunk/fs/btrfs/ctree.c @@ -944,7 +944,12 @@ 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); + if (!child) { + ret = -EROFS; + btrfs_std_error(root->fs_info, ret); + goto enospc; + } + btrfs_tree_lock(child); btrfs_set_lock_blocking(child); ret = btrfs_cow_block(trans, root, child, mid, 0, &child); @@ -1042,7 +1047,11 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, * otherwise we would have pulled some pointers from the * right */ - BUG_ON(!left); + if (!left) { + ret = -EROFS; + btrfs_std_error(root->fs_info, ret); + goto enospc; + } wret = balance_node_right(trans, root, mid, left); if (wret < 0) { ret = wret;