Skip to content

Commit 7029cc4

Browse files
author
Kent Overstreet
committed
bcachefs: fsck: Print path when we find a subvol loop
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 9ba6930 commit 7029cc4

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

fs/bcachefs/fsck.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2578,6 +2578,11 @@ static int check_subvol_path(struct btree_trans *trans, struct btree_iter *iter,
25782578
if (k.k->type != KEY_TYPE_subvolume)
25792579
return 0;
25802580

2581+
subvol_inum start = {
2582+
.subvol = k.k->p.offset,
2583+
.inum = le64_to_cpu(bkey_s_c_to_subvolume(k).v->inode),
2584+
};
2585+
25812586
while (k.k->p.offset != BCACHEFS_ROOT_SUBVOL) {
25822587
ret = darray_push(&subvol_path, k.k->p.offset);
25832588
if (ret)
@@ -2596,11 +2601,11 @@ static int check_subvol_path(struct btree_trans *trans, struct btree_iter *iter,
25962601

25972602
if (darray_u32_has(&subvol_path, parent)) {
25982603
printbuf_reset(&buf);
2599-
prt_printf(&buf, "subvolume loop:\n");
2604+
prt_printf(&buf, "subvolume loop: ");
26002605

2601-
darray_for_each_reverse(subvol_path, i)
2602-
prt_printf(&buf, "%u ", *i);
2603-
prt_printf(&buf, "%u", parent);
2606+
ret = bch2_inum_to_path(trans, start, &buf);
2607+
if (ret)
2608+
goto err;
26042609

26052610
if (fsck_err(trans, subvol_loop, "%s", buf.buf))
26062611
ret = reattach_subvol(trans, s);

0 commit comments

Comments
 (0)