diff options
author | Josef Bacik <josef@toxicpanda.com> | 2021-11-05 16:45:34 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-01-03 15:09:47 +0100 |
commit | fcba0120edf88328524a4878d1d6f4ad39f2ec81 (patch) | |
tree | d5818bed3968f8688b76e5b7c8d956afab6e67cb /fs/btrfs/backref.c | |
parent | e0b7661d44dab027febaf37f6f7766a3007af932 (diff) | |
download | linux-fcba0120edf88328524a4878d1d6f4ad39f2ec81.tar.bz2 |
btrfs: remove BUG_ON() in find_parent_nodes()
We search for an extent entry with .offset = -1, which shouldn't be a
thing, but corruption happens. Add an ASSERT() for the developers,
return -EUCLEAN for mortals.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/backref.c')
-rw-r--r-- | fs/btrfs/backref.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index cebdb75ac6bb..01e1a0897195 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1210,7 +1210,12 @@ again: ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); if (ret < 0) goto out; - BUG_ON(ret == 0); + if (ret == 0) { + /* This shouldn't happen, indicates a bug or fs corruption. */ + ASSERT(ret != 0); + ret = -EUCLEAN; + goto out; + } if (trans && likely(trans->type != __TRANS_DUMMY) && time_seq != BTRFS_SEQ_LAST) { |