]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: handle errors from select_reloc_root()
authorJosef Bacik <josef@toxicpanda.com>
Fri, 12 Mar 2021 20:24:58 +0000 (15:24 -0500)
committerDavid Sterba <dsterba@suse.com>
Tue, 6 Apr 2021 17:11:10 +0000 (19:11 +0200)
commit1a329a884c9ef68cfb3eba97d69eae6cbb7cd3bf
tree82fe1731b5c1afe6b8f73e033240e0182b15c411
parentc87ace4ef76398b72d7b8324423b427303264d52
btrfs: handle errors from select_reloc_root()

Currently select_reloc_root() doesn't return an error, but followup
patches will make it possible for it to return an error.  We do have
proper error recovery in do_relocation however, so handle the
possibility of select_reloc_root() having an error properly instead of
BUG_ON(!root).

I've also adjusted select_reloc_root() to return ERR_PTR(-ENOENT) if we
don't find a root, instead of NULL, to make the error case easier to
deal with.  I've replaced the BUG_ON(!root) with an ASSERT(0) for this
case as it indicates we messed up the backref walking code, but it could
also indicate corruption.

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