btrfs: handle btrfs_record_root_in_trans failure in btrfs_rename_exchange

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>
This commit is contained in:
Josef Bacik 2021-03-12 15:25:02 -05:00 committed by David Sterba
parent 404bccbcaa
commit 00aa8e87c9
1 changed files with 5 additions and 2 deletions

View File

@ -9108,8 +9108,11 @@ static int btrfs_rename_exchange(struct inode *old_dir,
goto out_notrans; goto out_notrans;
} }
if (dest != root) if (dest != root) {
btrfs_record_root_in_trans(trans, dest); 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 * We need to find a free sequence number both in the source and