Skip to content

Commit 18c520f

Browse files
author
Kent Overstreet
committed
bcachefs: Fix error path in check_dirent_inode_dirent()
fsck_err() jumps to the fsck_err label when bailing out; need to make sure bp_iter was initialized... Signed-off-by: Kent Overstreet <[email protected]>
1 parent 0696a18 commit 18c520f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fs/bcachefs/fsck.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,6 +1758,7 @@ static int check_dirent_inode_dirent(struct btree_trans *trans,
17581758
{
17591759
struct bch_fs *c = trans->c;
17601760
struct printbuf buf = PRINTBUF;
1761+
struct btree_iter bp_iter = { NULL };
17611762
int ret = 0;
17621763

17631764
if (inode_points_to_dirent(target, d))
@@ -1770,7 +1771,7 @@ static int check_dirent_inode_dirent(struct btree_trans *trans,
17701771
prt_printf(&buf, "\n "),
17711772
bch2_inode_unpacked_to_text(&buf, target),
17721773
buf.buf)))
1773-
goto out_noiter;
1774+
goto err;
17741775

17751776
if (!target->bi_dir &&
17761777
!target->bi_dir_offset) {
@@ -1779,7 +1780,6 @@ static int check_dirent_inode_dirent(struct btree_trans *trans,
17791780
return __bch2_fsck_write_inode(trans, target, target_snapshot);
17801781
}
17811782

1782-
struct btree_iter bp_iter = { NULL };
17831783
struct bkey_s_c_dirent bp_dirent = dirent_get_by_pos(trans, &bp_iter,
17841784
SPOS(target->bi_dir, target->bi_dir_offset, target_snapshot));
17851785
ret = bkey_err(bp_dirent);
@@ -1840,7 +1840,6 @@ static int check_dirent_inode_dirent(struct btree_trans *trans,
18401840
err:
18411841
fsck_err:
18421842
bch2_trans_iter_exit(trans, &bp_iter);
1843-
out_noiter:
18441843
printbuf_exit(&buf);
18451844
bch_err_fn(c, ret);
18461845
return ret;

0 commit comments

Comments
 (0)