bcachefs: Fix return code from btree_path_traverse_one()

trans->restarted is a positive error code, not the usual negative

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2022-11-15 22:48:03 -05:00
parent 6b1b186a5a
commit 0f35e0860a
2 changed files with 6 additions and 1 deletions

View file

@ -1079,7 +1079,7 @@ static int btree_path_traverse_one(struct btree_trans *trans,
unsigned long trace_ip)
{
unsigned depth_want = path->level;
int ret = trans->restarted;
int ret = -((int) trans->restarted);
if (unlikely(ret))
goto out;

View file

@ -359,6 +359,11 @@ __btree_iter_peek_node_and_restart(struct btree_trans *trans, struct btree_iter
return b;
}
/*
* XXX
* this does not handle transaction restarts from bch2_btree_iter_next_node()
* correctly
*/
#define __for_each_btree_node(_trans, _iter, _btree_id, _start, \
_locks_want, _depth, _flags, _b, _ret) \
for (bch2_trans_node_iter_init((_trans), &(_iter), (_btree_id), \