diff options
Diffstat (limited to 'fs/bcachefs/namei.c')
-rw-r--r-- | fs/bcachefs/namei.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/bcachefs/namei.c b/fs/bcachefs/namei.c index da758c2767ea..d1019052f182 100644 --- a/fs/bcachefs/namei.c +++ b/fs/bcachefs/namei.c @@ -743,6 +743,7 @@ static int bch2_check_dirent_inode_dirent(struct btree_trans *trans, { struct bch_fs *c = trans->c; CLASS(printbuf, buf)(); + struct btree_iter bp_iter = {}; int ret = 0; if (inode_points_to_dirent(target, d)) @@ -773,8 +774,8 @@ static int bch2_check_dirent_inode_dirent(struct btree_trans *trans, return __bch2_fsck_write_inode(trans, target); } - CLASS(btree_iter, bp_iter)(trans, BTREE_ID_dirents, - SPOS(target->bi_dir, target->bi_dir_offset, target->bi_snapshot), 0); + bch2_trans_iter_init(trans, &bp_iter, BTREE_ID_dirents, + SPOS(target->bi_dir, target->bi_dir_offset, target->bi_snapshot), 0); struct bkey_s_c_dirent bp_dirent = bch2_bkey_get_typed(&bp_iter, dirent); ret = bkey_err(bp_dirent); if (ret && !bch2_err_matches(ret, ENOENT)) @@ -824,6 +825,8 @@ static int bch2_check_dirent_inode_dirent(struct btree_trans *trans, S_ISDIR(target->bi_mode) ? "directory" : "subvolume", target->bi_inum, target->bi_snapshot, buf.buf); } + + goto out; } else { /* * hardlinked file with nlink 0: @@ -837,11 +840,15 @@ static int bch2_check_dirent_inode_dirent(struct btree_trans *trans, target->bi_nlink++; target->bi_flags &= ~BCH_INODE_unlinked; ret = __bch2_fsck_write_inode(trans, target); + if (ret) + goto err; } } } +out: err: fsck_err: + bch2_trans_iter_exit(&bp_iter); bch_err_fn(c, ret); return ret; } |