From: Hungyu Lin <dennylin0707@gmail.com>
To: tytso@mit.edu
Cc: adilger.kernel@dilger.ca, libaokun@linux.alibaba.com,
jack@suse.cz, ojaswin@linux.ibm.com, ritesh.list@gmail.com,
yi.zhang@huawei.com, djwong@kernel.org,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, dennylin0707@gmail.com
Subject: [PATCH] ext4: preserve force-fsck requests across unmount
Date: Tue, 27 Oct 2026 03:58:57 +0000 [thread overview]
Message-ID: <20261027035857.72265-1-dennylin0707@gmail.com> (raw)
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
reply other threads:[~2026-10-27 3:59 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=20261027035857.72265-1-dennylin0707@gmail.com \
--to=dennylin0707@gmail.com \
--cc=adilger.kernel@dilger.ca \
--cc=djwong@kernel.org \
--cc=jack@suse.cz \
--cc=libaokun@linux.alibaba.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=stable@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=yi.zhang@huawei.com \
/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®