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>
master
David Sterba 2017-08-29 17:53:39 +02:00
parent eae83c46f7
commit 1fc20730db
2 changed files with 9 additions and 4 deletions

View File

@ -9467,7 +9467,9 @@ repair_abort:
goto repair_abort;
}
btrfs_fix_block_accounting(trans, root);
ret = btrfs_fix_block_accounting(trans, root);
if (ret)
goto repair_abort;
ret = btrfs_commit_transaction(trans, root);
if (ret)
goto repair_abort;

View File

@ -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,