Btrfs: check if leaf's parent exists before pushing items around
authorLiu Bo <[email protected]>
Wed, 22 May 2013 12:07:06 +0000 (12:07 +0000)
committerJosef Bacik <[email protected]>
Fri, 14 Jun 2013 15:29:58 +0000 (11:29 -0400)
During splitting a leaf, pushing items around to hopefully get some space only
works when we have a parent, ie. we have at least one sibling leaf.

Signed-off-by: Liu Bo <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
fs/btrfs/ctree.c

index 0a430f7c5afd13ed837e1c75a692bd1177081f44..1c9dc71089ce5244be2554476f203f0ae09728ed 100644 (file)
@@ -3986,7 +3986,7 @@ static noinline int split_leaf(struct btrfs_trans_handle *trans,
                return -EOVERFLOW;
 
        /* first try to make some room by pushing left and right */
-       if (data_size) {
+       if (data_size && path->nodes[1]) {
                wret = push_leaf_right(trans, root, path, data_size,
                                       data_size, 0, 0);
                if (wret < 0)