[2/5] nfsd: CLOSE SHOULD return the invalid special stateid for NFSv4.x (x>0)
diff mbox

Message ID 20171031000951.18294-3-trond.myklebust@primarydata.com
State New
Headers show

Commit Message

Trond Myklebust Oct. 31, 2017, 12:09 a.m. UTC
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfsd/nfs4state.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Frank Filz Oct. 31, 2017, 5:32 p.m. UTC | #1
On 10/30/2017 05:09 PM, Trond Myklebust wrote:
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> ---
>  fs/nfsd/nfs4state.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index b246aaa20863..0fa42c704b9a 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -63,6 +63,9 @@ static const stateid_t zero_stateid = {
>  static const stateid_t currentstateid = {
>  	.si_generation = 1,
>  };
> +static const stateid_t close_stateid = {
> +	.si_generation = 0xffffffffU,
> +};
>  
>  static u64 current_sessionid = 1;
>  
> @@ -5390,6 +5393,11 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>  	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));
> +
>  	/* put reference from nfs4_preprocess_seqid_op */
>  	nfs4_put_stid(&stp->st_stid);
>  out:

Ooh, I'd never noticed that... Ganesha needs to do that also.


Bruce, can we get a pynfs test case to verify this?


Thanks

Frank

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index b246aaa20863..0fa42c704b9a 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -63,6 +63,9 @@  static const stateid_t zero_stateid = {
 static const stateid_t currentstateid = {
 	.si_generation = 1,
 };
+static const stateid_t close_stateid = {
+	.si_generation = 0xffffffffU,
+};
 
 static u64 current_sessionid = 1;
 
@@ -5390,6 +5393,11 @@  nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 	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));
+
 	/* put reference from nfs4_preprocess_seqid_op */
 	nfs4_put_stid(&stp->st_stid);
 out: