* [PATCH] ext4: preserve force-fsck requests across unmount
@ 2026-10-27 3:58 Hungyu Lin
0 siblings, 0 replies; only message in thread
From: Hungyu Lin @ 2026-10-27 3:58 UTC (permalink / raw)
To: tytso
Cc: adilger.kernel, libaokun, jack, ojaswin, ritesh.list, yi.zhang,
djwong, linux-ext4, linux-kernel, stable, dennylin0707
EXT4_TUNE_FL_FORCE_FSCK sets EXT4_ERROR_FS in the on-disk superblock
but leaves s_mount_state unchanged. On a normal read-write unmount,
ext4_put_super() restores s_state from s_mount_state, clearing the
requested flag.
As a result, a successful EXT4_IOC_SET_TUNE_SB_PARAM call can be lost
before e2fsck runs: after unmount it treats the filesystem as clean
and skips the requested check.
Set EXT4_ERROR_FS in s_mount_state as well, matching the state handling
in ext4_clear_journal_err(), so later superblock updates retain the
request.
Fixes: 04a91570ac67 ("ext4: implemet new ioctls to set and get superblock parameters")
Cc: stable@vger.kernel.org
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
fs/ext4/ioctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index e8e579498c99..3e444e245c98 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -1384,8 +1384,10 @@ static void ext4_sb_setparams(struct ext4_sb_info *sbi,
EXT4_FEATURE_INCOMPAT_CSUM_SEED)
es->s_checksum_seed = cpu_to_le32(sbi->s_csum_seed);
}
- if (params->set_flags & EXT4_TUNE_FL_FORCE_FSCK)
+ if (params->set_flags & EXT4_TUNE_FL_FORCE_FSCK) {
+ sbi->s_mount_state |= EXT4_ERROR_FS;
es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
+ }
}
static int ext4_ioctl_set_tune_sb(struct file *filp,
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-27 3:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-27 3:58 [PATCH] ext4: preserve force-fsck requests across unmount Hungyu Lin
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®