Commit 496b7238 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 54b2db3d
......@@ -418,16 +418,15 @@ int __bch2_dirent_lookup_trans(struct btree_trans *trans,
k = bch2_btree_iter_peek_slot(iter);
ret = bkey_err(k);
if (ret) {
bch2_trans_iter_exit(trans, iter);
return ret;
}
if (ret)
goto err;
d = bkey_s_c_to_dirent(k);
ret = bch2_dirent_read_target(trans, dir, d, inum);
if (ret > 0)
ret = -ENOENT;
err:
if (ret)
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,
name, inum, 0);
bch2_trans_iter_exit(&trans, &iter);
if (ret == -EINTR)
goto retry;
if (!ret)
bch2_trans_iter_exit(&trans, &iter);
bch2_trans_exit(&trans);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment