Skip to content

Commit 623c65b

Browse files
josefbacikgregkh
authored andcommitted
btrfs: remove BUG_ON() in find_parent_nodes()
[ Upstream commit fcba012 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 44cbd2a commit 623c65b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎fs/btrfs/backref.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,12 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
12131213
ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0);
12141214
if (ret < 0)
12151215
goto out;
1216-
BUG_ON(ret == 0);
1216+
if (ret == 0) {
1217+
/* This shouldn't happen, indicates a bug or fs corruption. */
1218+
ASSERT(ret != 0);
1219+
ret = -EUCLEAN;
1220+
goto out;
1221+
}
12171222

12181223
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
12191224
if (trans && likely(trans->type != __TRANS_DUMMY) &&

0 commit comments

Comments
 (0)