]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
btrfs: Don't BUG_ON errors in __finish_chunk_alloc()
authorMark Fasheh <mfasheh@suse.com>
Wed, 10 Aug 2011 19:32:10 +0000 (12:32 -0700)
committerDavid Sterba <dsterba@suse.cz>
Thu, 22 Mar 2012 00:45:37 +0000 (01:45 +0100)
All callers of __finish_chunk_alloc() BUG_ON() return value, so it's trivial
for us to always bubble up any errors caught in __finish_chunk_alloc() to be
caught there.

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

index 1c5f8a4a2bbd3a204e7d27960cc49e06cf7c3beb..c4ea7d8bea0fa447f513e557ec43598d44856e2f 100644 (file)
@@ -3417,16 +3417,18 @@ static int __finish_chunk_alloc(struct btrfs_trans_handle *trans,
        key.offset = chunk_offset;
 
        ret = btrfs_insert_item(trans, chunk_root, &key, chunk, item_size);
-       BUG_ON(ret);
 
-       if (map->type & BTRFS_BLOCK_GROUP_SYSTEM) {
+       if (ret == 0 && map->type & BTRFS_BLOCK_GROUP_SYSTEM) {
+               /*
+                * TODO: Cleanup of inserted chunk root in case of
+                * failure.
+                */
                ret = btrfs_add_system_chunk(chunk_root, &key, chunk,
                                             item_size);
-               BUG_ON(ret);
        }
 
        kfree(chunk);
-       return 0;
+       return ret;
 }
 
 /*