bcachefs: bch2_btree_iter_traverse() shouldn't normally call traverse_all()

If there's more than one iterator in the btree_trans, it's requried to
call bch2_trans_begin() to handle transaction restarts.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2021-07-27 18:01:52 -04:00 committed by Kent Overstreet
parent e5af273fce
commit b4e09b351b

View File

@ -1476,8 +1476,10 @@ static int __must_check __bch2_btree_iter_traverse(struct btree_iter *iter)
ret = bch2_trans_cond_resched(trans) ?:
btree_iter_traverse_one(iter, _RET_IP_);
if (unlikely(ret))
if (unlikely(ret) && hweight64(trans->iters_linked) == 1) {
ret = __btree_iter_traverse_all(trans, ret, _RET_IP_);
BUG_ON(ret == -EINTR);
}
return ret;
}