btrfs: handle block group lookup error when it's being removed
The unlikely case of lookup error in btrfs_remove_block_group() can be handled properly, in its caller this would lead to a transaction abort. We can't do anything else, a block group must have been loaded first. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c093bf3065
commit
97ec332068
@ -1063,7 +1063,9 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
|
||||
bool remove_rsv = false;
|
||||
|
||||
block_group = btrfs_lookup_block_group(fs_info, map->start);
|
||||
BUG_ON(!block_group);
|
||||
if (!block_group)
|
||||
return -ENOENT;
|
||||
|
||||
BUG_ON(!block_group->ro);
|
||||
|
||||
trace_btrfs_remove_block_group(block_group);
|
||||
|
Loading…
x
Reference in New Issue
Block a user