diff mbox

nfsd41: Deny new lock before RECLAIM_COMPLETE done

Message ID 4DB76D60.3010802@cn.fujitsu.com
State New, archived
Headers show

Commit Message

Mi Jinlong April 27, 2011, 1:12 a.m. UTC
Before nfs41 client's RECLAIM_COMPLETE done, nfs server should 
deny it's new lock.

Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
---
 fs/nfsd/nfs4state.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

Comments

J. Bruce Fields April 27, 2011, 1:54 p.m. UTC | #1
On Wed, Apr 27, 2011 at 09:12:00AM +0800, Mi Jinlong wrote:
> Before nfs41 client's RECLAIM_COMPLETE done, nfs server should 
> deny it's new lock.
> 
> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>

Is nfserr_grace the right error?  (Honest question, I haven't looked it
up.)

Also I'd think this check should go in nfsd4_open: opens are also
prohibited before RECLAIM_COMPLETE, and if we check there then we don't
need to check here, as you have to have open state before you can do a
lock.

--b.

> ---
>  fs/nfsd/nfs4state.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 4b36ec3..43cda94 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -3803,6 +3803,15 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>  		 */
>  		struct nfs4_stateid *open_stp = NULL;
>  		
> +		/*
> +		 * RFC5661 18.51.3
> +		 * Before RECLAIM_COMPLETE done, return NFS4ERR_GRACE
> +		 */
> +		status = nfserr_grace;
> +		if (nfsd4_has_session(cstate) &&
> +		    !cstate->session->se_client->cl_firststate)
> +			goto out;
> +
>  		status = nfserr_stale_clientid;
>  		if (!nfsd4_has_session(cstate) &&
>  		    STALE_CLIENTID(&lock->lk_new_clientid))
> -- 
> 1.7.4.1
> 
> 
--
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
diff mbox

Patch

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 4b36ec3..43cda94 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3803,6 +3803,15 @@  nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 		 */
 		struct nfs4_stateid *open_stp = NULL;
 		
+		/*
+		 * RFC5661 18.51.3
+		 * Before RECLAIM_COMPLETE done, return NFS4ERR_GRACE
+		 */
+		status = nfserr_grace;
+		if (nfsd4_has_session(cstate) &&
+		    !cstate->session->se_client->cl_firststate)
+			goto out;
+
 		status = nfserr_stale_clientid;
 		if (!nfsd4_has_session(cstate) &&
 		    STALE_CLIENTID(&lock->lk_new_clientid))