From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Theodore Ts'o <tytso@mit.edu>, Sasha Levin <sashal@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-ext4@vger.kernel.org, ltp@vger.kernel.org,
stable@vger.kernel.org
Subject: [PATCH 5.15 1/2] ext4: make 'abort' mount option handling standard
Date: Tue, 17 Jun 2025 23:09:55 +0200 [thread overview]
Message-ID: <20250617210956.146158-2-amir73il@gmail.com> (raw)
In-Reply-To: <20250617210956.146158-1-amir73il@gmail.com>
[ Upstream commit 22b8d707b07e6e06f50fe1d9ca8756e1f894eb0d ]
[amir: partial backport to 5.15.y without removing s_mount_flags]
'abort' mount option is the only mount option that has special handling
and sets a bit in sbi->s_mount_flags. There is not strong reason for
that so just simplify the code and make 'abort' set a bit in
sbi->s_mount_opt2 as any other mount option. This simplifies the code
and will allow us to drop EXT4_MF_FS_ABORTED completely in the following
patch.
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230616165109.21695-4-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Stable-dep-of: 76486b104168 ("ext4: avoid remount errors with 'abort' mount option")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
fs/ext4/ext4.h | 1 +
fs/ext4/super.c | 6 ++----
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index e1a5ec7362ad..2ee8c3dc25f5 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1255,6 +1255,7 @@ struct ext4_inode_info {
#define EXT4_MOUNT2_MB_OPTIMIZE_SCAN 0x00000080 /* Optimize group
* scanning in mballoc
*/
+#define EXT4_MOUNT2_ABORT 0x00000100 /* Abort filesystem */
#define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \
~EXT4_MOUNT_##opt
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 01fad4554255..7ce25cdf9334 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2023,6 +2023,7 @@ static const struct mount_opts {
MOPT_SET | MOPT_2 | MOPT_EXT4_ONLY},
{Opt_fc_debug_max_replay, 0, MOPT_GTE0},
#endif
+ {Opt_abort, EXT4_MOUNT2_ABORT, MOPT_SET | MOPT_2},
{Opt_err, 0, 0}
};
@@ -2143,9 +2144,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
case Opt_removed:
ext4_msg(sb, KERN_WARNING, "Ignoring removed %s option", opt);
return 1;
- case Opt_abort:
- ext4_set_mount_flag(sb, EXT4_MF_FS_ABORTED);
- return 1;
case Opt_i_version:
sb->s_flags |= SB_I_VERSION;
return 1;
@@ -5851,7 +5849,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
goto restore_opts;
}
- if (ext4_test_mount_flag(sb, EXT4_MF_FS_ABORTED))
+ if (test_opt2(sb, ABORT))
ext4_abort(sb, ESHUTDOWN, "Abort forced by user");
sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
--
2.47.1
next prev parent reply other threads:[~2025-06-17 21:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 21:09 [PATCH 5.15 0/2] fix LTP regression in fanotify22 Amir Goldstein
2025-06-17 21:09 ` Amir Goldstein [this message]
2025-06-19 9:02 ` [PATCH 5.15 1/2] ext4: make 'abort' mount option handling standard Sasha Levin
2025-06-17 21:09 ` [PATCH 5.15 2/2] ext4: avoid remount errors with 'abort' mount option Amir Goldstein
2025-06-19 9:04 ` Sasha Levin
2025-06-17 21:16 ` [PATCH 5.15 0/2] fix LTP regression in fanotify22 Amir Goldstein
2025-06-17 21:16 ` [LTP] " Amir Goldstein
2025-06-18 15:30 ` Jan Kara
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=20250617210956.146158-2-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=ltp@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tytso@mit.edu \
/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.