Linux-f2fs-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] fsck.f2fs: do not repair quota file in dry-run mode
@ 2026-08-31 10:05 Chao Yu via Linux-f2fs-devel
  0 siblings, 0 replies; only message in thread
From: Chao Yu via Linux-f2fs-devel @ 2026-08-31 10:05 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel

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

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

only message in thread, other threads:[~2026-08-31 10:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 10:05 [f2fs-dev] [PATCH] fsck.f2fs: do not repair quota file in dry-run mode Chao Yu via Linux-f2fs-devel

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