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: Fix an exiting of uninitialized iterator
bch2_dirent_lookup had an error path where we'd exit a btree_iter that hadn't been properly initialized. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
54b2db3d58
commit
496b723879
@ -418,16 +418,15 @@ int __bch2_dirent_lookup_trans(struct btree_trans *trans,
|
|||||||
|
|
||||||
k = bch2_btree_iter_peek_slot(iter);
|
k = bch2_btree_iter_peek_slot(iter);
|
||||||
ret = bkey_err(k);
|
ret = bkey_err(k);
|
||||||
if (ret) {
|
if (ret)
|
||||||
bch2_trans_iter_exit(trans, iter);
|
goto err;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
d = bkey_s_c_to_dirent(k);
|
d = bkey_s_c_to_dirent(k);
|
||||||
|
|
||||||
ret = bch2_dirent_read_target(trans, dir, d, inum);
|
ret = bch2_dirent_read_target(trans, dir, d, inum);
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
|
err:
|
||||||
if (ret)
|
if (ret)
|
||||||
bch2_trans_iter_exit(trans, iter);
|
bch2_trans_iter_exit(trans, iter);
|
||||||
|
|
||||||
@ -448,10 +447,10 @@ u64 bch2_dirent_lookup(struct bch_fs *c, subvol_inum dir,
|
|||||||
|
|
||||||
ret = __bch2_dirent_lookup_trans(&trans, &iter, dir, hash_info,
|
ret = __bch2_dirent_lookup_trans(&trans, &iter, dir, hash_info,
|
||||||
name, inum, 0);
|
name, inum, 0);
|
||||||
|
|
||||||
bch2_trans_iter_exit(&trans, &iter);
|
|
||||||
if (ret == -EINTR)
|
if (ret == -EINTR)
|
||||||
goto retry;
|
goto retry;
|
||||||
|
if (!ret)
|
||||||
|
bch2_trans_iter_exit(&trans, &iter);
|
||||||
bch2_trans_exit(&trans);
|
bch2_trans_exit(&trans);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user