[PATCH] erofs-utils: mkfs: fix inaccurate assertion of hardlinks in rebuild mode

Gao Xiang hsiangkao at linux.alibaba.com
Mon Sep 9 21:13:05 AEST 2024


`erofs_parent_inode(inode) == dir` is only true for non-hardlink
inodes and directories.

Only debug builds are impacted.

Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 lib/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/inode.c b/lib/inode.c
index d464bc6..bc3cb76 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -1744,7 +1744,8 @@ static int erofs_mkfs_dump_tree(struct erofs_inode *root, bool rebuild,
 				continue;
 
 			if (!erofs_inode_visited(inode)) {
-				DBG_BUGON(rebuild &&
+				DBG_BUGON(rebuild && (inode->i_nlink == 1 ||
+					  S_ISDIR(inode->i_mode)) &&
 					  erofs_parent_inode(inode) != dir);
 				erofs_mark_parent_inode(inode, dir);
 
-- 
2.43.5



More information about the Linux-erofs mailing list