btrfs: handle btrfs_record_root_in_trans failure in btrfs_rename_exchange
authorJosef Bacik <josef@toxicpanda.com>
Fri, 12 Mar 2021 20:25:02 +0000 (15:25 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Apr 2021 15:25:19 +0000 (17:25 +0200)
btrfs_record_root_in_trans will return errors in the future, so handle
the error properly in btrfs_rename_exchange.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c

index 41517d1..179ffb9 100644 (file)
@@ -9108,8 +9108,11 @@ static int btrfs_rename_exchange(struct inode *old_dir,
                goto out_notrans;
        }
 
-       if (dest != root)
-               btrfs_record_root_in_trans(trans, dest);
+       if (dest != root) {
+               ret = btrfs_record_root_in_trans(trans, dest);
+               if (ret)
+                       goto out_fail;
+       }
 
        /*
         * We need to find a free sequence number both in the source and