From: Jeff Layton <jlayton@kernel.org>
To: Chen Hanxiao <chenhx.fnst@fujitsu.com>,
Trond Myklebust <trond.myklebust@hammerspace.com>,
Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org, Dave Wysochanski <dwysocha@redhat.com>,
David Howells <dhowells@redhat.com>
Subject: Re: [PATCH v3] nfs: fix regression in handling of fsc= option in NFSv4
Date: Wed, 31 Jan 2024 06:06:22 -0500 [thread overview]
Message-ID: <8ef9e759db3908f79ac0faee72c3361dbdbcdf7e.camel@kernel.org> (raw)
In-Reply-To: <20240131094917.850-1-chenhx.fnst@fujitsu.com>
On Wed, 2024-01-31 at 17:49 +0800, Chen Hanxiao wrote:
> Setting the uniquifier for fscache via the fsc= mount
> option is currently broken in NFSv4.
>
> Fix this by passing fscache_uniq to root_fc if possible.
>
> Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
> ---
> v3:
> properly set param_fsc.size
> v2:
> use kmemdup_nul instead of snprintf
>
> fs/nfs/nfs4super.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c
> index d09bcfd7db89..8da5a9c000f4 100644
> --- a/fs/nfs/nfs4super.c
> +++ b/fs/nfs/nfs4super.c
> @@ -145,6 +145,7 @@ static int do_nfs4_mount(struct nfs_server *server,
> const char *export_path)
> {
> struct nfs_fs_context *root_ctx;
> + struct nfs_fs_context *ctx;
> struct fs_context *root_fc;
> struct vfsmount *root_mnt;
> struct dentry *dentry;
> @@ -157,6 +158,12 @@ static int do_nfs4_mount(struct nfs_server *server,
> .dirfd = -1,
> };
>
> + struct fs_parameter param_fsc = {
> + .key = "fsc",
> + .type = fs_value_is_string,
> + .dirfd = -1,
> + };
> +
> if (IS_ERR(server))
> return PTR_ERR(server);
>
> @@ -168,9 +175,26 @@ static int do_nfs4_mount(struct nfs_server *server,
> kfree(root_fc->source);
> root_fc->source = NULL;
>
> + ctx = nfs_fc2context(fc);
> root_ctx = nfs_fc2context(root_fc);
> root_ctx->internal = true;
> root_ctx->server = server;
> +
> + if (ctx->fscache_uniq) {
> + len = strlen(ctx->fscache_uniq);
> + param_fsc.size = len;
> + param_fsc.string = kmemdup_nul(ctx->fscache_uniq, len, GFP_KERNEL);
> + if (param_fsc.string == NULL) {
> + put_fs_context(root_fc);
> + return -ENOMEM;
> + }
> + ret = vfs_parse_fs_param(root_fc, ¶m_fsc);
> + kfree(param_fsc.string);
> + if (ret < 0) {
> + put_fs_context(root_fc);
> + return ret;
> + }
> + }
> /* We leave export_path unset as it's not used to find the root. */
>
> len = strlen(hostname) + 5;
Looks good:
Reviewed-by: Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2024-01-31 11:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-31 9:49 [PATCH v3] nfs: fix regression in handling of fsc= option in NFSv4 Chen Hanxiao
2024-01-31 11:06 ` Jeff Layton [this message]
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=8ef9e759db3908f79ac0faee72c3361dbdbcdf7e.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=anna@kernel.org \
--cc=chenhx.fnst@fujitsu.com \
--cc=dhowells@redhat.com \
--cc=dwysocha@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@hammerspace.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).