linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Jeff Layton <jlayton@kernel.org>
Cc: aglo@umich.edu, bcodding@redhat.com, linux-nfs@vger.kernel.org,
	trondmy@primarydata.com, tigran.mkrtchyan@desy.de
Subject: Re: [PATCH] nfsd4: send the special close_stateid in v4.0 replies as well
Date: Wed, 21 Feb 2018 19:48:17 -0500	[thread overview]
Message-ID: <20180222004817.GF6535@fieldses.org> (raw)
In-Reply-To: <20180215201618.2617-1-jlayton@kernel.org>

On Thu, Feb 15, 2018 at 03:16:18PM -0500, Jeff Layton wrote:
> From: Jeff Layton <jlayton@redhat.com>
> 
> We already send it for v4.1, but RFC7530 also notes that the stateid in
> the close reply is bogus.
> 
> Always send the special close stateid, even in v4.0 responses. No client
> should put any meaning on it whatsoever. For now, we continue to
> increment the stateid value, though that might not be necessary either.

Thanks!  Applying for 4.17.--b.

> 
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/nfsd/nfs4state.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 150521c9671b..08c700864fee 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -5481,15 +5481,26 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>  		goto out; 
>  
>  	stp->st_stid.sc_type = NFS4_CLOSED_STID;
> +
> +	/*
> +	 * Technically we don't _really_ have to increment or copy it, since
> +	 * it should just be gone after this operation and we clobber the
> +	 * copied value below, but we continue to do so here just to ensure
> +	 * that racing ops see that there was a state change.
> +	 */
>  	nfs4_inc_and_copy_stateid(&close->cl_stateid, &stp->st_stid);
>  
>  	nfsd4_close_open_stateid(stp);
>  	mutex_unlock(&stp->st_mutex);
>  
> -	/* See RFC5661 sectionm 18.2.4 */
> -	if (stp->st_stid.sc_client->cl_minorversion)
> -		memcpy(&close->cl_stateid, &close_stateid,
> -				sizeof(close->cl_stateid));
> +	/* v4.1+ suggests that we send a special stateid in here, since the
> +	 * clients should just ignore this anyway. Since this is not useful
> +	 * for v4.0 clients either, we set it to the special close_stateid
> +	 * universally.
> +	 *
> +	 * See RFC5661 section 18.2.4, and RFC7530 section 16.2.5
> +	 */
> +	memcpy(&close->cl_stateid, &close_stateid, sizeof(close->cl_stateid));
>  
>  	/* put reference from nfs4_preprocess_seqid_op */
>  	nfs4_put_stid(&stp->st_stid);
> -- 
> 2.14.3

      reply	other threads:[~2018-02-22  0:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15 20:16 [PATCH] nfsd4: send the special close_stateid in v4.0 replies as well Jeff Layton
2018-02-22  0:48 ` J. Bruce Fields [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=20180222004817.GF6535@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=aglo@umich.edu \
    --cc=bcodding@redhat.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=tigran.mkrtchyan@desy.de \
    --cc=trondmy@primarydata.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).