bcachefs: fix bch2_hash_delete() error path

we were exiting an iterator that hadn't been initialized

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2024-10-14 22:40:20 -04:00
parent 74ec2f3024
commit 94bdeec8f5

View File

@ -363,8 +363,11 @@ int bch2_hash_delete(struct btree_trans *trans,
struct btree_iter iter;
struct bkey_s_c k = bch2_hash_lookup(trans, &iter, desc, info, inum, key,
BTREE_ITER_intent);
int ret = bkey_err(k) ?:
bch2_hash_delete_at(trans, desc, info, &iter, 0);
int ret = bkey_err(k);
if (ret)
return ret;
ret = bch2_hash_delete_at(trans, desc, info, &iter, 0);
bch2_trans_iter_exit(trans, &iter);
return ret;
}