diff mbox series

[v2,10/42] btrfs: handle btrfs_record_root_in_trans failure in btrfs_rename_exchange

Message ID 1930ec8f0af551d8bc12ef3701b035ec74df771d.1605284383.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series [v2,01/42] btrfs: allow error injection for btrfs_search_slot and btrfs_cow_block | expand

Commit Message

Josef Bacik Nov. 13, 2020, 4:23 p.m. UTC
btrfs_record_root_in_trans will return errors in the future, so handle
the error properly in btrfs_rename_exchange.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/inode.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c790cff41be5..e64c6a98ad54 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8883,8 +8883,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