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: enable fix_on when CP_RESIZEFS_FLAG is set in auto-fix mode
Date: Thu,  1 Oct 2026 18:07:58 +0000	[thread overview]
Message-ID: <20261001180758.2099491-1-daeho43@gmail.com> (raw)

From: Daeho Jeong <daehojeong@google.com>

Commit 9a31cefa2966 ("fsck.f2fs: allow fsck to fix issues with online
resize due to SPO") added logic in sanity_check_ckpt() to recalculate
and fix user_block_count when CP_RESIZEFS_FLAG is set after a sudden
power-off during online resize.

However, sanity_check_ckpt() calls f2fs_should_proceed() and checks
c.fix_on before repairing user_block_count, while f2fs_should_proceed()
did not check CP_RESIZEFS_FLAG when setting c.fix_on in auto_fix (-a) or
preen (-p) mode. As a result, running 'fsck.f2fs -a' after an SPO during
online shrink leaves c.fix_on unset and fails to repair the checkpoint.

Check CP_RESIZEFS_FLAG in f2fs_should_proceed() so that auto-fix and
preen modes properly enable c.fix_on and recover the filesystem.

Fixes: 9a31cefa2966 ("fsck.f2fs: allow fsck to fix issues with online resize due to SPO")
Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
 fsck/mount.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fsck/mount.c b/fsck/mount.c
index 2fd8e1c..8479ed1 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -1515,6 +1515,7 @@ static int f2fs_should_proceed(struct f2fs_super_block *sb, u32 flag)
 	if (!c.fix_on && (c.auto_fix || c.preen_mode)) {
 		if (flag & CP_FSCK_FLAG ||
 			flag & CP_DISABLED_FLAG ||
+			flag & CP_RESIZEFS_FLAG ||
 			flag & CP_QUOTA_NEED_FSCK_FLAG ||
 			c.invalid_sb & SB_NEED_FIX ||
 			(exist_qf_ino(sb) && (flag & CP_ERROR_FLAG))) {
-- 
2.56.0.rc1.315.gc6ed9934b7-goog


                 reply	other threads:[~2026-10-01 18:08 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=20261001180758.2099491-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®