cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] gfs2: Fix initialisation of args for remount
Date: Tue, 29 Oct 2019 22:58:23 +0100	[thread overview]
Message-ID: <CAHc6FU5MyPf09RQL-mKcwqqyUAssHKfrV+8iF8K3MnLMOvv9Hw@mail.gmail.com> (raw)
In-Reply-To: <20191029200934.16088-1-anprice@redhat.com>

On Tue, Oct 29, 2019 at 9:10 PM Andrew Price <anprice@redhat.com> wrote:
> When gfs2 was converted to use fs_context, the initialisation of the
> mount args structure to the currently active args was lost with the
> removal of gfs2_remount_fs(), so the checks of the new args on remount
> became checks against the default values instead of the current ones.
> This caused unexpected remount behaviour and test failures (xfstests
> generic/294, generic/306 and generic/452).
>
> Reinstate the args initialisation, this time in gfs2_init_fs_context()
> and conditional upon fc->purpose, as that's the only time we get control
> before the mount args are parsed in the remount process.
>
> Fixes: 1f52aa08d12f ("gfs2: Convert gfs2 to fs_context")
> Signed-off-by: Andrew Price <anprice@redhat.com>
> ---
>
>  fs/gfs2/ops_fstype.c | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index dc61af2c4d5e..1f247a0ab6ef 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -1544,13 +1544,18 @@ static int gfs2_init_fs_context(struct fs_context *fc)
>         if (args == NULL)
>                 return -ENOMEM;
>
> -       args->ar_quota = GFS2_QUOTA_DEFAULT;
> -       args->ar_data = GFS2_DATA_DEFAULT;
> -       args->ar_commit = 30;
> -       args->ar_statfs_quantum = 30;
> -       args->ar_quota_quantum = 60;
> -       args->ar_errors = GFS2_ERRORS_DEFAULT;
> +       if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
> +               struct gfs2_sbd *sdp = fc->root->d_sb->s_fs_info;
>
> +               *args = sdp->sd_args;

Since we're fully overwriting args here, shouldn't we use kmalloc to
allocate args above ...

> +       } else {

... and memset it to 0 in this case?

> +               args->ar_quota = GFS2_QUOTA_DEFAULT;
> +               args->ar_data = GFS2_DATA_DEFAULT;
> +               args->ar_commit = 30;
> +               args->ar_statfs_quantum = 30;
> +               args->ar_quota_quantum = 60;
> +               args->ar_errors = GFS2_ERRORS_DEFAULT;
> +       }
>         fc->fs_private = args;
>         fc->ops = &gfs2_context_ops;
>         return 0;
> --
> 2.21.0
>

Thanks,
Andreas



  reply	other threads:[~2019-10-29 21:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-29 20:09 [Cluster-devel] [PATCH] gfs2: Fix initialisation of args for remount Andrew Price
2019-10-29 21:58 ` Andreas Gruenbacher [this message]
2019-10-30  8:16   ` [Cluster-devel] [PATCH v2] " Andrew Price

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=CAHc6FU5MyPf09RQL-mKcwqqyUAssHKfrV+8iF8K3MnLMOvv9Hw@mail.gmail.com \
    --to=agruenba@redhat.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;
as well as URLs for NNTP newsgroup(s).