]> Pileus Git - ~andy/linux/commitdiff
btrfs: Don't BUG_ON alloc_path errors in btrfs_balance()
authorMark Fasheh <mfasheh@suse.com>
Tue, 12 Jul 2011 18:10:23 +0000 (11:10 -0700)
committerMark Fasheh <mfasheh@suse.com>
Thu, 14 Jul 2011 21:14:45 +0000 (14:14 -0700)
Dealing with this seems trivial - the only caller of btrfs_balance() is
btrfs_ioctl() which passes the error code directly back to userspace. There
also isn't much state to unwind (if I'm wrong about this point, we can
always safely move the allocation to the top of btrfs_balance() anyway).

Signed-off-by: Mark Fasheh <mfasheh@suse.com>
fs/btrfs/volumes.c

index 19450bc536327c77f7add37e723b668da410eedd..530a2fcea1eff677514c2e7964f322825c516205 100644 (file)
@@ -2061,8 +2061,10 @@ int btrfs_balance(struct btrfs_root *dev_root)
 
        /* step two, relocate all the chunks */
        path = btrfs_alloc_path();
-       BUG_ON(!path);
-
+       if (!path) {
+               ret = -ENOMEM;
+               goto error;
+       }
        key.objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
        key.offset = (u64)-1;
        key.type = BTRFS_CHUNK_ITEM_KEY;