btrfs: handle extent corruption with select_one_root properly
authorJosef Bacik <josef@toxicpanda.com>
Fri, 12 Mar 2021 20:25:32 +0000 (15:25 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Apr 2021 15:25:22 +0000 (17:25 +0200)
commit8717cf440db670ba87596d8f5f6660d2a94f4401
treee64a920d111adc17af8f9311e99af1cb2022aced
parente0b085b0b03fa5c435b7240668f144199ed989c4
btrfs: handle extent corruption with select_one_root properly

In corruption cases we could have paths from a block up to no root at
all, and thus we'll BUG_ON(!root) in select_one_root.  Handle this by
adding an ASSERT() for developers, and returning an error for normal
users.

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