summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2017-09-28 11:45:26 +0300
committerDavid Sterba <dsterba@suse.com>2017-10-30 12:27:58 +0100
commitefd38150af45375b46576d0110a323d7fab7e142 (patch)
tree0bc1dad0beb91d36fa5d1976c27b5ffaf0bf3108
parent9417ebc8a676487c6ec8825f92fb28f7dbeb5f4b (diff)
downloadop-kernel-dev-efd38150af45375b46576d0110a323d7fab7e142.zip
op-kernel-dev-efd38150af45375b46576d0110a323d7fab7e142.tar.gz
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: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/ioctl.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 86728e0..dfc5b48 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -5152,15 +5152,11 @@ static long _btrfs_ioctl_set_received_subvol(struct file *file,
root->root_key.objectid);
if (ret < 0 && ret != -EEXIST) {
btrfs_abort_transaction(trans, ret);
+ btrfs_end_transaction(trans);
goto out;
}
}
ret = btrfs_commit_transaction(trans);
- if (ret < 0) {
- btrfs_abort_transaction(trans, ret);
- goto out;
- }
-
out:
up_write(&fs_info->subvol_sem);
mnt_drop_write_file(file);
OpenPOWER on IntegriCloud