Commit e9895f0a authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Assert that iterators aren't being double freed

Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 50dc0f69
......@@ -1956,6 +1956,7 @@ int bch2_trans_iter_put(struct btree_trans *trans,
return 0;
BUG_ON(trans->iters + iter->idx != iter);
BUG_ON(!btree_iter_live(trans, iter));
ret = btree_iter_err(iter);
......
......@@ -1500,6 +1500,10 @@ static struct btree_iter *trans_get_update(struct btree_trans *trans,
bkey_cmp(pos, i->k->k.p) < 0
: !bkey_cmp(pos, i->iter->pos))) {
*k = bkey_i_to_s_c(i->k);
/* ugly hack.. */
BUG_ON(btree_iter_live(trans, i->iter));
trans->iters_live |= 1ULL << i->iter->idx;
return i->iter;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment