Skip to content

Commit 7aa1788

Browse files
fdmananakdave
authored andcommitted
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 <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent f11c3d8 commit 7aa1788

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

fs/btrfs/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3928,7 +3928,7 @@ static long _btrfs_ioctl_set_received_subvol(struct file *file,
39283928
ret = btrfs_uuid_tree_add(trans, sa->uuid,
39293929
BTRFS_UUID_KEY_RECEIVED_SUBVOL,
39303930
btrfs_root_id(root));
3931-
if (unlikely(ret < 0 && ret != -EEXIST)) {
3931+
if (unlikely(ret < 0)) {
39323932
btrfs_abort_transaction(trans, ret);
39333933
btrfs_end_transaction(trans);
39343934
goto out;

fs/btrfs/transaction.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
19181918
*/
19191919
if (ret == -EOVERFLOW)
19201920
ret = 0;
1921-
if (unlikely(ret && ret != -EEXIST)) {
1921+
if (unlikely(ret)) {
19221922
btrfs_abort_transaction(trans, ret);
19231923
goto fail;
19241924
}

0 commit comments

Comments
 (0)