]> www.infradead.org Git - users/jedix/linux-maple.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>
Tue, 6 Apr 2021 17:18:49 +0000 (19:18 +0200)
commit1b9bf158872d77531e11914069f6132c2091ad3c
tree8e9e79074c97914774f782782fa899698a0b80cb
parent6e64534f5cd077aef984c2b4bb32852b20d29910
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