]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: do proper error handling in record_reloc_root_in_trans
authorJosef Bacik <josef@toxicpanda.com>
Fri, 12 Mar 2021 20:25:01 +0000 (15:25 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Apr 2021 15:25:19 +0000 (17:25 +0200)
commitaaaccbf87361742179a992138d9c2c7cc7a868ff
treec73cb06905b931bf481d2e5d20ecbea2bcba449f
parente4f0377736bf75e73a568f9ed182393f31431d11
btrfs: do proper error handling in record_reloc_root_in_trans

Generally speaking this shouldn't ever fail, the corresponding fs root
for the reloc root will already be in memory, so we won't get ENOMEM
here.

However if there is no corresponding root for the reloc root then we
could get ENOMEM when we try to allocate it or we could get ENOENT
when we look it up and see that it doesn't exist.

Convert these BUG_ON()'s into ASSERT()'s and add proper error handling
for the case of 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