Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: stop checking for -EEXIST return value from btrfs_uuid_tree_add()

We never return -EEXIST from btrfs_uuid_tree_add(), if the item already
exists we extend it, so it's pointless to check for such return value.

Furthermore, in create_pending_snapshot(), the logic is completely broken.
The goal was to not error out and abort the transaction in case of -EEXIST
but we left 'ret' with the -EEXIST value, so we end up setting
pending->error to -EEXIST and return that error up the call chain up to
btrfs_commit_transaction(), which will abort the transaction.

Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Filipe Manana and committed by
David Sterba
7aa1788f f11c3d85

+2 -2
+1 -1
fs/btrfs/ioctl.c
··· 3928 3928 ret = btrfs_uuid_tree_add(trans, sa->uuid, 3929 3929 BTRFS_UUID_KEY_RECEIVED_SUBVOL, 3930 3930 btrfs_root_id(root)); 3931 - if (unlikely(ret < 0 && ret != -EEXIST)) { 3931 + if (unlikely(ret < 0)) { 3932 3932 btrfs_abort_transaction(trans, ret); 3933 3933 btrfs_end_transaction(trans); 3934 3934 goto out;
+1 -1
fs/btrfs/transaction.c
··· 1918 1918 */ 1919 1919 if (ret == -EOVERFLOW) 1920 1920 ret = 0; 1921 - if (unlikely(ret && ret != -EEXIST)) { 1921 + if (unlikely(ret)) { 1922 1922 btrfs_abort_transaction(trans, ret); 1923 1923 goto fail; 1924 1924 }