summaryrefslogtreecommitdiff
path: root/extent-tree.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-08-29 17:53:39 +0200
committerDavid Sterba <dsterba@suse.com>2017-09-08 16:15:05 +0200
commit1fc20730db28f522c8c807386a7cace2f23e9da9 (patch)
treec2e456a568b2c85a32454a56626418db740813fb /extent-tree.c
parenteae83c46f79020f93cc85d3497951ea8db1cdd13 (diff)
btrfs-progs: add more error handling to btrfs_free_block_group
As btrfs_update_block_group fails when the block group is not found in cache, we can exit btrfs_free_block_group, not much to rollback. The caller will also exit in turn. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'extent-tree.c')
-rw-r--r--extent-tree.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/extent-tree.c b/extent-tree.c
index f1cc4bfe..9c70908a 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -3840,7 +3840,7 @@ out:
int btrfs_fix_block_accounting(struct btrfs_trans_handle *trans,
struct btrfs_root *root)
{
- int ret;
+ int ret = 0;
int slot;
u64 start = 0;
u64 bytes_used = 0;
@@ -3904,13 +3904,16 @@ int btrfs_fix_block_accounting(struct btrfs_trans_handle *trans,
bytes_used += fs_info->nodesize;
ret = btrfs_update_block_group(trans, root,
key.objectid, fs_info->nodesize, 1, 0);
- BUG_ON(ret);
+ if (ret)
+ goto out;
}
path.slots[0]++;
}
btrfs_set_super_bytes_used(root->fs_info->super_copy, bytes_used);
+ ret = 0;
+out:
btrfs_release_path(&path);
- return 0;
+ return ret;
}
static void __get_extent_size(struct btrfs_root *root, struct btrfs_path *path,