From: Gabriel Krisman Bertazi <krisman@collabora.com>
To: Lukas Czerner <lczerner@redhat.com>
Cc: tytso@mit.edu, linux-ext4@vger.kernel.org, Ye Bin <yebin10@huawei.com>
Subject: Re: [PATCH] ext4: fix remount with 'abort' option
Date: Wed, 02 Feb 2022 11:42:24 -0500 [thread overview]
Message-ID: <87a6f9gqz3.fsf@collabora.com> (raw)
In-Reply-To: <20220201131345.77591-1-lczerner@redhat.com> (Lukas Czerner's message of "Tue, 1 Feb 2022 14:13:45 +0100")
Lukas Czerner <lczerner@redhat.com> writes:
> After commit 6e47a3cc68fc ("ext4: get rid of super block and sbi from
> handle_mount_ops()") the 'abort' options stopped working. This is
> because we're using ctx_set_mount_flags() helper that's expecting an
> argument with the appropriate bit set, but instead got
> EXT4_MF_FS_ABORTED which is a bit position. ext4_set_mount_flag() is
> using set_bit() while ctx_set_mount_flags() was using bitwise OR.
>
> Create a separate helper ctx_set_mount_flag() to handle setting the
> mount_flags correctly.
>
> While we're at it clean up the EXT4_SET_CTX macros so that we're only
> creating helpers that we actually use to avoid warnings.
>
> Fixes: 6e47a3cc68fc ("ext4: get rid of super block and sbi from handle_mount_ops()")
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> Cc: Ye Bin <yebin10@huawei.com>
We also observed this abort issue as a regression of an fanotify LTP
test (fanotify22). This patch fixes that test case for me.
Tested-by: Gabriel Krisman Bertazi <krisman@collabora.com>
> ---
> fs/ext4/super.c | 29 +++++++++++++++++++++--------
> 1 file changed, 21 insertions(+), 8 deletions(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index eee0d9ebfa6c..6f74cd51df2e 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -2045,8 +2045,8 @@ struct ext4_fs_context {
> unsigned int mask_s_mount_opt;
> unsigned int vals_s_mount_opt2;
> unsigned int mask_s_mount_opt2;
> - unsigned int vals_s_mount_flags;
> - unsigned int mask_s_mount_flags;
> + unsigned long vals_s_mount_flags;
> + unsigned long mask_s_mount_flags;
> unsigned int opt_flags; /* MOPT flags */
> unsigned int spec;
> u32 s_max_batch_time;
> @@ -2149,23 +2149,36 @@ static inline void ctx_set_##name(struct ext4_fs_context *ctx, \
> { \
> ctx->mask_s_##name |= flag; \
> ctx->vals_s_##name |= flag; \
> -} \
> +}
> +
> +#define EXT4_CLEAR_CTX(name) \
> static inline void ctx_clear_##name(struct ext4_fs_context *ctx, \
> unsigned long flag) \
> { \
> ctx->mask_s_##name |= flag; \
> ctx->vals_s_##name &= ~flag; \
> -} \
> +}
> +
> +#define EXT4_TEST_CTX(name) \
> static inline unsigned long \
> ctx_test_##name(struct ext4_fs_context *ctx, unsigned long flag) \
> { \
> return (ctx->vals_s_##name & flag); \
> -} \
> +}
>
> -EXT4_SET_CTX(flags);
> +EXT4_SET_CTX(flags); /* set only */
> EXT4_SET_CTX(mount_opt);
> +EXT4_CLEAR_CTX(mount_opt);
> +EXT4_TEST_CTX(mount_opt);
> EXT4_SET_CTX(mount_opt2);
> -EXT4_SET_CTX(mount_flags);
> +EXT4_CLEAR_CTX(mount_opt2);
> +EXT4_TEST_CTX(mount_opt2);
> +
> +static inline void ctx_set_mount_flag(struct ext4_fs_context *ctx, int bit)
> +{
> + set_bit(bit, &ctx->mask_s_mount_flags);
> + set_bit(bit, &ctx->vals_s_mount_flags);
> +}
>
> static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param)
> {
> @@ -2235,7 +2248,7 @@ static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param)
> param->key);
> return 0;
> case Opt_abort:
> - ctx_set_mount_flags(ctx, EXT4_MF_FS_ABORTED);
> + ctx_set_mount_flag(ctx, EXT4_MF_FS_ABORTED);
> return 0;
> case Opt_i_version:
> ext4_msg(NULL, KERN_WARNING, deprecated_msg, param->key, "5.20");
--
Gabriel Krisman Bertazi
next prev parent reply other threads:[~2022-02-02 16:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-21 12:32 [PATCH -next] ext4: Fix remount with 'abort' option isn't effective Ye Bin
2021-12-21 14:43 ` Lukas Czerner
2021-12-22 1:06 ` yebin
2021-12-22 9:19 ` Lukas Czerner
2021-12-23 1:41 ` yebin
2021-12-23 15:41 ` Theodore Ts'o
2022-02-01 13:13 ` [PATCH] ext4: fix remount with 'abort' option Lukas Czerner
2022-02-02 16:42 ` Gabriel Krisman Bertazi [this message]
2022-02-02 19:00 ` Eric Sandeen
2022-03-02 9:43 ` Lukas Czerner
2022-03-03 0:40 ` Theodore Ts'o
2022-03-03 0:41 ` Theodore Ts'o
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=87a6f9gqz3.fsf@collabora.com \
--to=krisman@collabora.com \
--cc=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=yebin10@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