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

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/relocation.c

index 1abe756..7966950 100644 (file)
@@ -2548,7 +2548,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);