diff mbox series

[v2,15/42] btrfs: btrfs: handle btrfs_record_root_in_trans failure in relocate_tree_block

Message ID 227a3569a6ac063cc84ac13f54723a920b4543f0.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 relocate_tree_block.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/relocation.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 4397a8a448f4..6f7bbbd76102 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2578,7 +2578,9 @@  static int relocate_tree_block(struct btrfs_trans_handle *trans,
 				ret = -EUCLEAN;
 				goto out;
 			}
-			btrfs_record_root_in_trans(trans, root);
+			ret = btrfs_record_root_in_trans(trans, root);
+			if (ret)
+				goto out;
 			root = root->reloc_root;
 			node->new_bytenr = root->node->start;
 			btrfs_put_root(node->root);