]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: do not panic in __add_reloc_root
authorJosef Bacik <josef@toxicpanda.com>
Fri, 12 Mar 2021 20:25:30 +0000 (15:25 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Apr 2021 15:25:22 +0000 (17:25 +0200)
commit5f5efc62fd538581cd3daea0773f3fcc0cb314ad
tree820b2d54131f4173c069c9158a8a6c3c98d994c9
parentefe63dfd0615c9468834dff5f18f0216c709e894
btrfs: do not panic in __add_reloc_root

If we have a duplicate entry for a reloc root then we could have fs
corruption that resulted in a double allocation.  Since this shouldn't
happen unless there is corruption, add an ASSERT(ret != -EEXIST) to all
of the callers of __add_reloc_root() to catch any logic mistakes for
developers, otherwise normal error handling will happen 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