Commit b63c8c1e authored by David Sterba's avatar David Sterba
Browse files

btrfs: move transaction aborts to the error site in add_block_group_free_space()



Transaction aborts should be done next to the place the error happens,
which was not done in add_block_group_free_space().

Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 0b10f3dd
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1456,16 +1456,17 @@ int add_block_group_free_space(struct btrfs_trans_handle *trans,
	path = btrfs_alloc_path();
	if (!path) {
		ret = -ENOMEM;
		btrfs_abort_transaction(trans, ret);
		goto out;
	}

	ret = __add_block_group_free_space(trans, block_group, path);
	if (ret)
		btrfs_abort_transaction(trans, ret);

out:
	btrfs_free_path(path);
	mutex_unlock(&block_group->free_space_lock);
	if (ret)
		btrfs_abort_transaction(trans, ret);
	return ret;
}