Commit efd38150 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Refactor transaction handling in received subvolume ioctl

If btrfs_transaction_commit fails it will proceed to call
cleanup_transaction, which in turn already does btrfs_abort_transaction.
So let's remove the unnecessary code duplication. Also let's be explicit
about handling failure of btrfs_uuid_tree_add by calling
btrfs_end_transaction.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 9417ebc8
...@@ -5152,15 +5152,11 @@ static long _btrfs_ioctl_set_received_subvol(struct file *file, ...@@ -5152,15 +5152,11 @@ static long _btrfs_ioctl_set_received_subvol(struct file *file,
root->root_key.objectid); root->root_key.objectid);
if (ret < 0 && ret != -EEXIST) { if (ret < 0 && ret != -EEXIST) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
btrfs_end_transaction(trans);
goto out; goto out;
} }
} }
ret = btrfs_commit_transaction(trans); ret = btrfs_commit_transaction(trans);
if (ret < 0) {
btrfs_abort_transaction(trans, ret);
goto out;
}
out: out:
up_write(&fs_info->subvol_sem); up_write(&fs_info->subvol_sem);
mnt_drop_write_file(file); mnt_drop_write_file(file);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment