mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +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);
|
||||
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 @@ retry:
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user