[f2fs-dev] [PATCH] mkfs.f2fs: fix parent dentry for lost+found

GarliƄski, Krystian via Linux-f2fs-devel <[email protected]> Tue, 4 Aug 2026 07:04:06 +0000
Newsgroups net.sourceforge.lists.linux-f2fs-devel
Message-ID <YQBP288MB009831270521BF40A51BF32C99D42@YQBP288MB0098.CANP288.PROD.OUTLOOK.COM>
The ".." entry of lost+found currently points to lost+found itself,
while the inode's i_pino field correctly points to the root inode.

As a result, a filesystem freshly created by mkfs.f2fs is immediately
reported as corrupted by fsck.f2fs, which validates the ".." entry
against i_pino.

Set the ".." entry to the root inode instead.

Signed-off-by: Krystian Garli=F1ski <[email protected]>
---
 mkfs/f2fs_format.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 66f2e4d..33d3da9 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -1667,7 +1667,8 @@ static block_t f2fs_add_default_dentry_lpf(void)
 	}
 =

 	add_dentry(dent_blk, &didx, ".", c.lpf_ino, F2FS_FT_DIR);
-	add_dentry(dent_blk, &didx, "..", c.lpf_ino, F2FS_FT_DIR);
+	add_dentry(dent_blk, &didx, "..",
+		   le32_to_cpu(sb->root_ino), F2FS_FT_DIR);
 =

 	data_blkaddr =3D alloc_next_free_block(CURSEG_HOT_DATA);
 =

-- =

2.53.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel