bcachefs: Fix two btree iterator leaks

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-04-20 20:21:39 -04:00 committed by Kent Overstreet
parent 51c804ed2a
commit 7b7278bbaf
2 changed files with 5 additions and 2 deletions

View file

@ -1621,6 +1621,7 @@ int bch2_stripes_write(struct bch_fs *c, unsigned flags)
if (ret)
break;
}
bch2_trans_iter_put(&trans, iter);
bch2_trans_exit(&trans);

View file

@ -761,7 +761,7 @@ static int bch2_move_btree(struct bch_fs *c,
id == start_btree_id ? start_pos : POS_MIN,
BTREE_ITER_PREFETCH, b) {
if (kthread && kthread_should_stop())
goto out;
break;
if ((cmp_int(id, end_btree_id) ?:
bkey_cmp(b->key.k.p, end_pos)) > 0)
@ -788,8 +788,10 @@ static int bch2_move_btree(struct bch_fs *c,
}
ret = bch2_trans_iter_free(&trans, iter) ?: ret;
if (kthread && kthread_should_stop())
break;
}
out:
bch2_trans_exit(&trans);
if (ret)