Skip to content

Commit c4f89a1

Browse files
author
Kent Overstreet
committed
bcachefs: Make btree_iter_peek_prev() assert more precise
The issue this assert is guarding against is that in BTREE_ITER_filter_snapshots mode we only want to be iterating within a single inode number - if we iterate into another inode number with keys for a different snapshot tree, we'll loop arbitrarily long before finding a key we can return. This comes up in the unit tests, where we're using inode 0 for our test keys. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 394ef27 commit c4f89a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/bcachefs/btree_iter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2602,7 +2602,7 @@ struct bkey_s_c bch2_btree_iter_peek_prev_min(struct btree_trans *trans, struct
26022602

26032603
bch2_trans_verify_not_unlocked_or_in_restart(trans);
26042604
bch2_btree_iter_verify_entry_exit(iter);
2605-
EBUG_ON((iter->flags & BTREE_ITER_filter_snapshots) && bpos_eq(end, POS_MIN));
2605+
EBUG_ON((iter->flags & BTREE_ITER_filter_snapshots) && iter->pos.inode != end.inode);
26062606

26072607
int ret = trans_maybe_inject_restart(trans, _RET_IP_);
26082608
if (unlikely(ret)) {

0 commit comments

Comments
 (0)