From: Josef Bacik Date: Fri, 12 Mar 2021 20:25:00 +0000 (-0500) Subject: btrfs: check record_root_in_trans related failures in select_reloc_root X-Git-Tag: accepted/tizen/unified/20230118.172025~7052^2~78 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=92de551b837650568486b94b67f4168e4c6cc68a;p=platform%2Fkernel%2Flinux-rpi.git btrfs: check record_root_in_trans related failures in select_reloc_root We will record the fs root or the reloc root in the trans in select_reloc_root. These will actually return errors in the following patches, so check their return value here and return it up the stack. Reviewed-by: Qu Wenruo Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index a916b80..3c82011 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -1988,6 +1988,7 @@ struct btrfs_root *select_reloc_root(struct btrfs_trans_handle *trans, struct btrfs_backref_node *next; struct btrfs_root *root; int index = 0; + int ret; next = node; while (1) { @@ -2023,11 +2024,15 @@ struct btrfs_root *select_reloc_root(struct btrfs_trans_handle *trans, } if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) { - record_reloc_root_in_trans(trans, root); + ret = record_reloc_root_in_trans(trans, root); + if (ret) + return ERR_PTR(ret); break; } - btrfs_record_root_in_trans(trans, root); + ret = btrfs_record_root_in_trans(trans, root); + if (ret) + return ERR_PTR(ret); root = root->reloc_root; if (next->new_bytenr != root->node->start) {