Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: fsck: fix directory loop tracking
@ 2026-03-21 14:28 Vansh Choudhary
  2026-03-21 16:05 ` Nithurshen
  0 siblings, 1 reply; 3+ messages in thread
From: Vansh Choudhary @ 2026-03-21 14:28 UTC (permalink / raw)
  To: linux-erofs; +Cc: Vansh Choudhary

Store the current directory nid in the recursion stack.

The loop check compares inode.nid against the entries already on the
stack, so pushing pnid there can miss self-referential directory loops
and report the wrong failure later.

Signed-off-by: Vansh Choudhary <ch@vnsh.in>
---
 fsck/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fsck/main.c b/fsck/main.c
index 16a354f..3530707 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -1022,7 +1022,7 @@ static int erofsfsck_check_inode(erofs_nid_t pnid, erofs_nid_t nid)
 		for (i = 0; i < fsckcfg.dirstack.top; ++i)
 			if (inode.nid == fsckcfg.dirstack.dirs[i])
 				return -ELOOP;
-		fsckcfg.dirstack.dirs[fsckcfg.dirstack.top++] = pnid;
+		fsckcfg.dirstack.dirs[fsckcfg.dirstack.top++] = inode.nid;
 		ret = erofs_iterate_dir(&ctx, true);
 		--fsckcfg.dirstack.top;
 	}
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-22  0:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-21 14:28 [PATCH] erofs-utils: fsck: fix directory loop tracking Vansh Choudhary
2026-03-21 16:05 ` Nithurshen
2026-03-22  0:41   ` Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox