From: Josef Bacik Date: Fri, 12 Mar 2021 20:25:19 +0000 (-0500) Subject: btrfs: handle btrfs_update_reloc_root failure in prepare_to_merge X-Git-Tag: accepted/tizen/unified/20230118.172025~7052^2~59 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bbae13f8ab22fb997403ee8a67f87432f4751a8d;p=platform%2Fkernel%2Flinux-rpi.git btrfs: handle btrfs_update_reloc_root failure in prepare_to_merge btrfs_update_reloc_root will will return errors in the future, so handle an error properly in prepare_to_merge. 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 69f170b..ca97412 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -1870,10 +1870,21 @@ again: */ if (!err) btrfs_set_root_refs(&reloc_root->root_item, 1); - btrfs_update_reloc_root(trans, root); + ret = btrfs_update_reloc_root(trans, root); + /* + * Even if we have an error we need this reloc root back on our + * list so we can clean up properly. + */ list_add(&reloc_root->root_list, &reloc_roots); btrfs_put_root(root); + + if (ret) { + btrfs_abort_transaction(trans, ret); + if (!err) + err = ret; + break; + } } list_splice(&reloc_roots, &rc->reloc_roots);