mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fsck.f2fs: do not roll forward a checkpoint-disabled image
@ 2026-10-13 15:30 Daeho Jeong
  0 siblings, 0 replies; only message in thread
From: Daeho Jeong @ 2026-10-13 15:30 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong

From: Daeho Jeong <daehojeong@google.com>

With checkpoint=disable, the kernel does not write a checkpoint at
umount. The last checkpoint is the one written when checkpoint was
disabled, with CP_DISABLED_FLAG set and without CP_UMOUNT_FLAG. The
kernel never rolls forward such an image: f2fs_fill_super() skips the
recovery when CP_DISABLED_FLAG is set, and drops all writes after the
checkpoint.

fsck decides to record fsync data only by CP_UMOUNT_FLAG, so it walks
the warm node chain of an image that the kernel will not recover. While
checkpoint is disabled, SSR reuses blocks written and invalidated after
the checkpoint, so the chain can point back to a block written earlier
in the same session with the same cp_ver. fsck then reports "detect
looped node chain" and fails. xfstests generic/320 and generic/642 hit
this almost every time with checkpoint=disable.

Skip recording fsync data when CP_DISABLED_FLAG is set, as the kernel
does.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
 fsck/mount.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fsck/mount.c b/fsck/mount.c
index 8479ed1..98d797e 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -4096,6 +4096,10 @@ static int record_fsync_data(struct f2fs_sb_info *sbi)
 	if (!need_fsync_data_record(sbi))
 		return 0;
 
+	/* the kernel does not roll forward a checkpoint-disabled image */
+	if (is_set_ckpt_flags(F2FS_CKPT(sbi), CP_DISABLED_FLAG))
+		return 0;
+
 	ret = f2fs_find_fsync_inode(sbi, &inode_list);
 	if (ret)
 		goto out;
-- 
2.56.0.385.gd3acb90ef8-goog


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-13 15:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-13 15:30 [PATCH] fsck.f2fs: do not roll forward a checkpoint-disabled image Daeho Jeong

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

all inboxes | Powered by JetHome®