From: Jeff Layton <jlayton@kernel.org>
To: Sagi Grimberg <sagi@grimberg.me>, Chuck Lever <chuck.lever@oracle.com>
Cc: Dai Ngo <dai.ngo@oracle.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH rfc 1/2] nfsd: don't assume copy notify when preprocessing the stateid
Date: Fri, 26 Jul 2024 09:23:36 -0400 [thread overview]
Message-ID: <fef005f0872b0795a5d106fb92ebe7c94c1d2ce9.camel@kernel.org> (raw)
In-Reply-To: <20240724170138.1942307-1-sagi@grimberg.me>
On Wed, 2024-07-24 at 10:01 -0700, Sagi Grimberg wrote:
> Move the stateid handling to nfsd4_copy_notify, if
> nfs4_preprocess_stateid_op
> did not produce an output stateid, error out.
>
> Copy notify specifically does not permit the use of special stateids,
> so enforce that outside generic stateid pre-processing.
>
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
> ---
> fs/nfsd/nfs4proc.c | 4 +++-
> fs/nfsd/nfs4state.c | 6 +-----
> 2 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 46bd20fe5c0f..7b70309ad8fb 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1942,7 +1942,7 @@ nfsd4_copy_notify(struct svc_rqst *rqstp,
> struct nfsd4_compound_state *cstate,
> struct nfsd4_copy_notify *cn = &u->copy_notify;
> __be32 status;
> struct nfsd_net *nn = net_generic(SVC_NET(rqstp),
> nfsd_net_id);
> - struct nfs4_stid *stid;
> + struct nfs4_stid *stid = NULL;
> struct nfs4_cpntf_state *cps;
> struct nfs4_client *clp = cstate->clp;
>
> @@ -1951,6 +1951,8 @@ nfsd4_copy_notify(struct svc_rqst *rqstp,
> struct nfsd4_compound_state *cstate,
> &stid);
> if (status)
> return status;
> + if (!stid)
> + return nfserr_bad_stateid;
>
> cn->cpn_lease_time.tv_sec = nn->nfsd4_lease;
> cn->cpn_lease_time.tv_nsec = 0;
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 69d576b19eb6..dc61a8adfcd4 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -7020,11 +7020,7 @@ nfs4_preprocess_stateid_op(struct svc_rqst
> *rqstp,
> *nfp = NULL;
>
> if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) {
> - if (cstid)
> - status = nfserr_bad_stateid;
> - else
> - status = check_special_stateids(net, fhp,
> stateid,
> -
> flags);
> + status = check_special_stateids(net, fhp, stateid,
> flags);
> goto done;
> }
>
Nice cleanup.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2024-07-26 13:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 17:01 [PATCH rfc 1/2] nfsd: don't assume copy notify when preprocessing the stateid Sagi Grimberg
2024-07-24 17:01 ` [PATCH rfc 2/2] NFSD: allow client to use write delegation stateid for READ Sagi Grimberg
2024-07-24 19:29 ` Olga Kornievskaia
2024-07-24 21:47 ` Sagi Grimberg
2024-07-26 14:00 ` Jeff Layton
2024-07-26 13:54 ` Jeff Layton
2024-07-26 14:49 ` Jeff Layton
2024-07-26 14:06 ` Chuck Lever
2024-07-27 17:00 ` Dai Ngo
2024-07-27 19:22 ` Sagi Grimberg
2024-07-27 19:26 ` Sagi Grimberg
2024-07-27 19:53 ` Chuck Lever
2024-07-27 19:58 ` Chuck Lever
2024-07-27 16:46 ` Dai Ngo
2024-07-27 16:52 ` Chuck Lever
2024-07-27 18:55 ` Dai Ngo
2024-07-27 19:33 ` Sagi Grimberg
2024-07-27 22:13 ` Dai Ngo
2024-07-27 19:28 ` Sagi Grimberg
2024-07-24 17:06 ` [PATCH rfc 1/2] nfsd: don't assume copy notify when preprocessing the stateid Chuck Lever
2024-07-24 19:12 ` Olga Kornievskaia
2024-07-24 21:43 ` Sagi Grimberg
2024-07-25 13:51 ` Olga Kornievskaia
2024-07-26 13:47 ` Chuck Lever
2024-07-26 14:07 ` Olga Kornievskaia
2024-07-26 13:23 ` 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=fef005f0872b0795a5d106fb92ebe7c94c1d2ce9.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=sagi@grimberg.me \
/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