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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:38:29 +0000 (11:38 +0100)
commit52f93e5ee700c24cf82db18bf8a78bf9666191c3
tree4a2893dacd109bb52bfdb32375f8854e36fd5b3b
parent02785bae77ca9903dd2534a532b041d9730cbc56
btrfs: do not warn if we can't find the reloc root when looking up backref

commit f78743fbdae1bb31bc9c9233c3590a5048782381 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/backref.c