bcachefs: Assert that iterators aren't being double freed

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2021-03-19 20:40:31 -04:00 committed by Kent Overstreet
parent 50dc0f692a
commit e9895f0ab9
2 changed files with 5 additions and 0 deletions

View File

@ -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);

View File

@ -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;
}