btrfs: do not warn if we can't find the reloc root when looking up backref
authorJosef Bacik <josef@toxicpanda.com>
Thu, 14 Jan 2021 19:02:44 +0000 (14:02 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 8 Feb 2021 21:58:56 +0000 (22:58 +0100)
commitf78743fbdae1bb31bc9c9233c3590a5048782381
treed02aba6786f1a6ad98cfabf47f9b3aa6929ea05f
parent938fcbfb0cbcf532a1869efab58e6009446b1ced
btrfs: do not warn if we can't find the reloc root when looking up backref

The backref code is looking for a reloc_root that corresponds to the
given fs root.  However any number of things could have gone wrong while
initializing that reloc_root, like ENOMEM while trying to allocate the
root itself, or EIO while trying to write the root item.  This would
result in no corresponding reloc_root being in the reloc root cache, and
thus would return NULL when we do the find_reloc_root() call.

Because of this we do not want to WARN_ON().  This presumably was meant
to catch developer errors, cases where we messed up adding the reloc
root.  However we can easily hit this case with error injection, and
thus should not do a WARN_ON().

CC: stable@vger.kernel.org # 5.10+
Reported-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
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/backref.c