btrfs_record_root_in_trans will return errors in the future, so handle
the error properly in btrfs_rename_exchange.

Reviewed-by: Qu Wenruo <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
---
 fs/btrfs/inode.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 52dc5f52ea58..a9fde9a22fff 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9102,8 +9102,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
-- 
2.26.2

Reply via email to