mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daeho Jeong <daeho43@gmail.com>
To: linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com
Cc: Daeho Jeong <daehojeong@google.com>
Subject: [PATCH] fsck.f2fs: do not roll forward a checkpoint-disabled image
Date: Tue, 13 Oct 2026 15:30:06 +0000	[thread overview]
Message-ID: <20261013153006.1200086-1-daeho43@gmail.com> (raw)

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


                 reply	other threads:[~2026-10-13 15:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261013153006.1200086-1-daeho43@gmail.com \
    --to=daeho43@gmail.com \
    --cc=daehojeong@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®