diff options
author | Josef Bacik <josef@toxicpanda.com> | 2021-11-05 23:45:35 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-01-27 12:54:19 +0300 |
commit | 6b22c9824ddb65d9b32a0a68e3e8e03694f989d7 (patch) | |
tree | 1bc6d7400bee6e04ba5885e942696393e3227c16 /fs/btrfs | |
parent | 623c65bc733683baf5dd7c66fa0593d59965e84f (diff) | |
download | linux-6b22c9824ddb65d9b32a0a68e3e8e03694f989d7.tar.xz |
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>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/backref.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 8b471579e26e..baff31a147e7 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1366,10 +1366,18 @@ again: goto out; if (!ret && extent_item_pos) { /* - * we've recorded that parent, so we must extend - * its inode list here + * We've recorded that parent, so we must extend + * its inode list here. + * + * However if there was corruption we may not + * have found an eie, return an error in this + * case. */ - BUG_ON(!eie); + ASSERT(eie); + if (!eie) { + ret = -EUCLEAN; + goto out; + } while (eie->next) eie = eie->next; eie->next = ref->inode_list; |