All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Czerner <lczerner@redhat.com>
To: Ye Bin <yebin10@huawei.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	jack@suse.cz
Subject: Re: [PATCH -next] ext4: Fix remount with 'abort' option isn't effective
Date: Tue, 21 Dec 2021 15:43:05 +0100	[thread overview]
Message-ID: <20211221144305.nlryh7q2cgdbpmi5@work> (raw)
In-Reply-To: <20211221123214.2410593-1-yebin10@huawei.com>

Hi,

nice catch. This is a bug indeed. However I am currently in a process of
changing the ctx_set/clear/test_ helpers because currently it generates
functions that are unused.

While I am at it I can just create a custom ctx_set_mount_flags()
helper that would behave as expected so that we won't have to specify
"1 < EXT4_MF_FS_ABORTED" which is not really obvious and hence error
prone.

My plan is to send my patch set including this one tomorrow, will that
be fine with you ?

-Lukas

On Tue, Dec 21, 2021 at 08:32:14PM +0800, Ye Bin wrote:
> We test remount with 'abort' option as follows:
> [root@localhost home]# mount  /dev/sda test
> [root@localhost home]# mount | grep test
> /dev/sda on /home/test type ext4 (rw,relatime)
> [root@localhost home]# mount -o remount,abort test
> [root@localhost home]# mount | grep test
> /dev/sda on /home/test type ext4 (rw,relatime)
> 
> Obviously, remount 'abort' option isn't effective.
> After 6e47a3cc68fc commit we process abort option with 'ctx_set_mount_flags':
> static inline void ctx_set_mount_flags(struct ext4_fs_context *ctx, int flag)
> {
> 	ctx->mask_s_mount_flags |= flag;
> 	ctx->vals_s_mount_flags |= flag;
> }
> 
> But we test 'abort' option with 'ext4_test_mount_flag':
> static inline int ext4_test_mount_flag(struct super_block *sb, int bit)
> {
>         return test_bit(bit, &EXT4_SB(sb)->s_mount_flags);
> }
> 
> To solve this issue, pass (1 <<  EXT4_MF_FS_ABORTED) to 'ctx_set_mount_flags'.
> 
> Fixes:6e47a3cc68fc("ext4: get rid of super block and sbi from handle_mount_ops()")
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
>  fs/ext4/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index b72d989b77fb..071b7b3c5678 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -2236,7 +2236,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_flags(ctx, 1 << EXT4_MF_FS_ABORTED);
>  		return 0;
>  	case Opt_i_version:
>  		ctx_set_flags(ctx, SB_I_VERSION);
> -- 
> 2.31.1
> 


  reply	other threads:[~2021-12-21 14:43 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 [this message]
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
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=20211221144305.nlryh7q2cgdbpmi5@work \
    --to=lczerner@redhat.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@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 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.