Skip to contentSkip to conversation

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

PATCH New Gao Xiang 1 participant 1 message Sep 9, 2024 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: mkfs: fix inaccurate assertion of hardlinks in rebuild mode

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

Only debug builds are impacted.

---
 lib/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/inode.c +2 -1
index d464bc6..bc3cb76 100644
@@ -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);
 
Signature · 1 line
2.43.5