[Devel] [PATCH v2 vz10] ext4: avoid remount errors with 'abort' mount option
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Mon Dec 8 07:24:40 MSK 2025
Note: dropped mainstream kernel people from our review loop. Please avoid CC'ing original authors when porting mainstream patches. See suppresscc=all gitconfig option.
On 12/3/25 23:48, Vasileios Almpanis wrote:
> From: Jan Kara <jack at suse.cz>
>
> When we remount filesystem with 'abort' mount option while changing
> other mount options as well (as is LTP test doing), we can return error
> from the system call after commit d3476f3dad4a ("ext4: don't set
> SB_RDONLY after filesystem errors") because the application of mount
> option changes detects shutdown filesystem and refuses to do anything.
> The behavior of application of other mount options in presence of
> 'abort' mount option is currently rather arbitary as some mount option
> changes are handled before 'abort' and some after it.
>
> Move aborting of the filesystem to the end of remount handling so all
> requested changes are properly applied before the filesystem is shutdown
> to have a reasonably consistent behavior.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-120065
>
> Fixes: d3476f3dad4a ("ext4: don't set SB_RDONLY after filesystem errors")
> Reported-by: Jan Stancek <jstancek at redhat.com>
> Link: https://lore.kernel.org/all/Zvp6L+oFnfASaoHl@t14s
> Signed-off-by: Jan Kara <jack at suse.cz>
> Tested-by: Jan Stancek <jstancek at redhat.com>
> Link: https://patch.msgid.link/20241004221556.19222-1-jack@suse.cz
> Signed-off-by: Theodore Ts'o <tytso at mit.edu>
> Signed-off-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
When we port mainstream patches we usually add all "our" stuff after the original message, so it should be:
<original commit message>
https://virtuozzo.atlassian.net/browse/VSTOR-120065
Signed-off-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
instead of:
<original commit ...>
https://virtuozzo.atlassian.net/browse/VSTOR-120065
<... message>
Signed-off-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
Also you miss the "(cherry picked from commit ...)" line which should go before your signed-off-by when you port mainstream patches (note: same for porting patches from other VZ version (e.g. "from vz7 commit"). You can add it automatically via "git-cherry-pick -x".
>
> Feature: ext4 fixes
>
I suggest adding "---" before version comments, so that git-am will drop them when applying to the tree. The "vX:" comments are usually useful in the mailing list, but less so in the commit log.
> v2:
> - Adds bug id in commit message
> - Adds feature in commit message
>
> ---
> fs/ext4/super.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 6cc6c408cf94..a810dcaa135c 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -6635,9 +6635,6 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
> goto restore_opts;
> }
>
> - if (test_opt2(sb, ABORT))
> - ext4_abort(sb, ESHUTDOWN, "Abort forced by user");
> -
> sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
> (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
>
> @@ -6809,6 +6806,14 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
> if (!ext4_has_feature_mmp(sb) || sb_rdonly(sb))
> ext4_stop_mmpd(sbi);
>
> + /*
> + * Handle aborting the filesystem as the last thing during remount to
> + * avoid obsure errors during remount when some option changes fail to
> + * apply due to shutdown filesystem.
> + */
> + if (test_opt2(sb, ABORT))
> + ext4_abort(sb, ESHUTDOWN, "Abort forced by user");
> +
> return 0;
>
> restore_opts:
--
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.
More information about the Devel
mailing list