mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-08 15:04:45 +00:00
bcachefs: don't lose errors from iterators that have been freed
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
2a039f1ee4
commit
ece254b258
@ -983,6 +983,7 @@ static int __btree_iter_traverse_all(struct btree_trans *trans,
|
||||
}
|
||||
|
||||
if (unlikely(ret == -EIO)) {
|
||||
trans->error = true;
|
||||
iter->flags |= BTREE_ITER_ERROR;
|
||||
iter->l[iter->level].b = BTREE_ITER_NOT_END;
|
||||
goto out;
|
||||
@ -1943,7 +1944,7 @@ void bch2_trans_init(struct btree_trans *trans, struct bch_fs *c)
|
||||
|
||||
int bch2_trans_exit(struct btree_trans *trans)
|
||||
{
|
||||
int ret = bch2_trans_unlock(trans);
|
||||
bch2_trans_unlock(trans);
|
||||
|
||||
kfree(trans->mem);
|
||||
if (trans->used_mempool)
|
||||
@ -1952,5 +1953,6 @@ int bch2_trans_exit(struct btree_trans *trans)
|
||||
kfree(trans->iters);
|
||||
trans->mem = (void *) 0x1;
|
||||
trans->iters = (void *) 0x1;
|
||||
return ret;
|
||||
|
||||
return trans->error ? -EIO : 0;
|
||||
}
|
||||
|
@ -280,6 +280,7 @@ struct btree_trans {
|
||||
u8 nr_updates;
|
||||
u8 size;
|
||||
unsigned used_mempool:1;
|
||||
unsigned error:1;
|
||||
|
||||
unsigned mem_top;
|
||||
unsigned mem_bytes;
|
||||
|
Loading…
Reference in New Issue
Block a user