All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH] fsck.f2fs: do not repair quota file in dry-run mode
Date: Mon, 31 Aug 2026 10:05:05 +0000	[thread overview]
Message-ID: <20260831100505.3078649-1-chao@kernel.org> (raw)

From: Chao Yu <chao@kernel.org>

Info: Dry run
Info: MKFS version
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: checkpoint stop reason: shutdown(16)
Info: Device[0] : /dev/vdd blkaddr = 0--ffffff
Info: Device[1] : /dev/vdb blkaddr = 1000000--11fffff
Info: Device[2] : /dev/vdc blkaddr = 1200000--14fffff
Info: Host-managed zoned block device:
      32 zones, 134217728u zone size(bytes), 0 randomly writeable zones
      32768 blocks per zone
Info: Device[3] : /dev/nullb0 blkaddr = 1500000--15fffff
Info: Segments per section = 64
Info: Sections per zone = 1
Info: total FS sectors = 184549376 (90112 MB)
Info: CKPT version = 25fc6ba
Info: Casefold: linear_lookup [enable]
Info: checkpoint state = 844 :  quota_need_fsck crc compacted_summary sudden-power-off
[FIX] (move_one_curseg_info:3235)  --> Move curseg[0] 4f7 -> 12c0 after 28000
[FIX] (move_one_curseg_info:3235)  --> Move curseg[1] 1284 -> 1300 after 28000
[FIX] (move_one_curseg_info:3235)  --> Move curseg[2] b2 -> 1340 after 28000
[FIX] (move_one_curseg_info:3235)  --> Move curseg[3] ed -> 1380 after 28000
[FIX] (move_one_curseg_info:3235)  --> Move curseg[4] cf7 -> 13c0 after 28000
[FIX] (move_one_curseg_info:3235)  --> Move curseg[5] 140 -> 1400 after 28000

[ASSERT] (is_valid_ssa_node_blk: 197)  --> Summary footer indicates a node segment: 0xcf7
[ASSERT] (is_valid_ssa_node_blk: 224)  --> Set node summary 0xcf7 -> [0x4] [0x1c6ec5]
[ASSERT] (is_valid_ssa_data_blk: 359)  --> Set data summary 0x4f7 -> [0x4] [0x0] [0x0]
[ASSERT] (is_valid_ssa_data_blk: 359)  --> Set data summary 0x4f7 -> [0x4] [0x0] [0x1]
[ASSERT] (is_valid_ssa_data_blk: 359)  --> Set data summary 0x4f7 -> [0x4] [0x0] [0x2]
[ASSERT] (is_valid_ssa_data_blk: 359)  --> Set data summary 0x4f7 -> [0x4] [0x0] [0x5]
[ASSERT] (is_valid_ssa_data_blk: 359)  --> Set data summary 0x4f7 -> [0x4] [0x0] [0x29]
[ASSERT] (is_valid_ssa_data_blk: 359)  --> Set data summary 0x4f7 -> [0x4] [0x0] [0x34]
[ASSERT] (is_valid_ssa_data_blk: 359)  --> Set data summary 0x4f7 -> [0x4] [0x0] [0x46]
[ASSERT] (is_valid_ssa_data_blk: 359)  --> Set data summary 0x4f7 -> [0x4] [0x0] [0x9e]

In dry-run mode, physical disk writes are skipped by dev_write().
If fsck_chk_quota_files() attempts to rebuild quota files, subsequent
reads on newly allocated blocks will fetch stale, unwritten disk data,
triggering assertion failures or false corruptions.

Skip updating quota files when dry-run mode is enabled, and report
inconsistent quota files as informational messages without flagging
unrepairable filesystem corruptions.

Signed-off-by: Chao Yu <chao@kernel.org>
---
 fsck/fsck.c  | 7 +++++--
 fsck/mount.c | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index 6872b00..e47f7be 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -2411,7 +2411,7 @@ int fsck_chk_quota_files(struct f2fs_sb_info *sbi)
 		}
 
 		/* Something is wrong */
-		if (c.fix_on) {
+		if (c.fix_on && !c.dry_run) {
 			DBG(0, "Fixing Quota file ([%3d] ino [0x%x])\n",
 							qtype, ino);
 			fsck_disconnect_file(sbi, ino, true);
@@ -2424,6 +2424,9 @@ int fsck_chk_quota_files(struct f2fs_sb_info *sbi)
 			} else {
 				ASSERT_MSG("Unable to write quota file");
 			}
+		} else if (c.dry_run) {
+			MSG(0, "Info: Quota file is inconsistent (dry-run, repair skipped)\n");
+			ret = 0;
 		} else {
 			ASSERT_MSG("Quota file is missing or invalid"
 					" quota file content found.");
@@ -3709,7 +3712,7 @@ void fsck_chk_and_fix_write_pointers(struct f2fs_sb_info *sbi)
 	if (c.zoned_model != F2FS_ZONED_HM)
 		return;
 
-	if (c.fix_on) {
+	if (c.fix_on && !c.dry_run) {
 		flush_nat_journal_entries(sbi);
 		flush_sit_journal_entries(sbi);
 
diff --git a/fsck/mount.c b/fsck/mount.c
index 26f213e..a202f3d 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -4222,7 +4222,7 @@ out:
 	print_ckpt_info(sbi);
 
 	if (c.quota_fix) {
-		if (get_cp(ckpt_flags) & CP_QUOTA_NEED_FSCK_FLAG)
+		if ((get_cp(ckpt_flags) & CP_QUOTA_NEED_FSCK_FLAG) && !c.dry_run)
 			c.fix_on = 1;
 	}
 	if (c.layout)
-- 
2.49.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

                 reply	other threads:[~2026-08-31 10:05 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=20260831100505.3078649-1-chao@kernel.org \
    --to=linux-f2fs-devel@lists.sourceforge.net \
    --cc=chao@kernel.org \
    --cc=jaegeuk@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.