btrfs: remove BUG_ON(!eie) in find_parent_nodes
authorJosef Bacik <josef@toxicpanda.com>
Fri, 5 Nov 2021 20:45:35 +0000 (16:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 08:00:56 +0000 (09:00 +0100)
commitddb2abdaa3b0fb99835129e4c7892b25fc7cc5a1
tree0bba56182bdceca0f54d094355c41bd6714a0ba6
parenta8dcf313882539edca8eb0f4043269de9c3722f0
btrfs: remove BUG_ON(!eie) in find_parent_nodes

[ Upstream commit 9f05c09d6baef789726346397438cca4ec43c3ee ]

If we're looking for leafs that point to a data extent we want to record
the extent items that point at our bytenr.  At this point we have the
reference and we know for a fact that this leaf should have a reference
to our bytenr.  However if there's some sort of corruption we may not
find any references to our leaf, and thus could end up with eie == NULL.
Replace this BUG_ON() with an ASSERT() and then return -EUCLEAN for the
mortals.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/backref.c