There's no need to BUG_ON(), we can just abort the transaction and return
an error.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
return -ENOENT;
}
- BUG_ON(!block_group->ro && !(block_group->flags & BTRFS_BLOCK_GROUP_REMAPPED));
+ if (unlikely(!block_group->ro &&
+ !(block_group->flags & BTRFS_BLOCK_GROUP_REMAPPED))) {
+ ret = -EUCLEAN;
+ btrfs_abort_transaction(trans, ret);
+ goto out;
+ }
trace_btrfs_remove_block_group(block_group);
/*