Skip to contentSkip to conversation

nfsd41: donot check reclaim for open with filehandle

PATCH In review Mi Jinlong 2 participants 4 messages Nov 17, 2011 – Nov 30, 2011

Subsystems (2)
lore
Share & tools
lore

Mi Jinlong

author
#0 lore raw

PATCH 1/1 nfsd41: donot check reclaim for open with filehandle

Opening file with filehandle, check reclaim is not needed.

---
 fs/nfsd/nfs4proc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
fs/nfsd/nfs4proc.c +3 -2
index fa38336..681dff3 100644
@@ -266,8 +266,9 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
 {
 	__be32 status;
 
-	/* Only reclaims from previously confirmed clients are valid */
-	if ((status = nfs4_check_open_reclaim(&open->op_clientid)))
+	if (open->op_claim_type != NFS4_OPEN_CLAIM_FH
+	    && open->op_claim_type != NFS4_OPEN_CLAIM_DELEG_CUR_FH
+	    && (status = nfs4_check_open_reclaim(&open->op_clientid)))
 		return status;
 
 	/* We don't know the target directory, and therefore can not
Signature · 1 line
1.7.7
#1 lore raw
Quoted 12 lines · Mi Jinlong

Opening file with filehandle, check reclaim is not needed.

---
 fs/nfsd/nfs4proc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
fs/nfsd/nfs4proc.c +0 -0
index fa38336..681dff3 100644

fs/nfsd/nfs4proc.c do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ · line 270

Quoted 7 lines
fs/nfsd/nfs4proc.c +2 -2
@@ -266,8 +266,9 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
 {
 	__be32 status;
 
-	/* Only reclaims from previously confirmed clients are valid */
-	if ((status = nfs4_check_open_reclaim(&open->op_clientid)))
+	if (open->op_claim_type != NFS4_OPEN_CLAIM_FH
+	    && open->op_claim_type != NFS4_OPEN_CLAIM_DELEG_CUR_FH

Thanks for catching that.

I think it would be simpler to pull this check out into nfsd4_open(), something like:

	case NFS4_OPEN_CLAIM_PREVIOUS:
		open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
		status = nfs4_check_open_reclaim(&open->op_clientid);
		if (status)
			goto out;
	case NFS4_OPEN_CLAIM_FH:
	...

--b.

Quoted 8 lines
fs/nfsd/nfs4proc.c +1 -0
+	    && (status = nfs4_check_open_reclaim(&open->op_clientid)))
 		return status;
 
 	/* We don't know the target directory, and therefore can not
Signature · 1 line
1.7.7
author
#2 lore raw

PATCH v2 1/1 nfsd41: check reclaim for open claim previous at nfsd4_open

Opening file with filehandle, check reclaim is not needed. So, let open reclaim check at nfsd4_open.

---
 fs/nfsd/nfs4proc.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
fs/nfsd/nfs4proc.c +3 -4
index fa38336..9415bc4 100644
@@ -266,10 +266,6 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
 {
 	__be32 status;
 
-	/* Only reclaims from previously confirmed clients are valid */
-	if ((status = nfs4_check_open_reclaim(&open->op_clientid)))
-		return status;
-
 	/* We don't know the target directory, and therefore can not
 	* set the change info
 	*/
@@ -373,6 +369,9 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 			break;
 		case NFS4_OPEN_CLAIM_PREVIOUS:
 			open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
+			status = nfs4_check_open_reclaim(&open->op_clientid);
+			if (status)
+				goto out;
 		case NFS4_OPEN_CLAIM_FH:
 		case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
 			status = do_open_fhandle(rqstp, &cstate->current_fh,
Signature · 1 line
1.7.7
#3 lore raw

Re: [PATCH v2] nfsd41: check reclaim for open claim previous at nfsd4_open

Quoted 2 lines · Mi Jinlong

Opening file with filehandle, check reclaim is not needed. So, let open reclaim check at nfsd4_open.

Thanks! Applying for 3.3.--b.

Quoted 35 lines
---
 fs/nfsd/nfs4proc.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
fs/nfsd/nfs4proc.c +3 -4
index fa38336..9415bc4 100644
@@ -266,10 +266,6 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
 {
 	__be32 status;
 
-	/* Only reclaims from previously confirmed clients are valid */
-	if ((status = nfs4_check_open_reclaim(&open->op_clientid)))
-		return status;
-
 	/* We don't know the target directory, and therefore can not
 	* set the change info
 	*/
@@ -373,6 +369,9 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 			break;
 		case NFS4_OPEN_CLAIM_PREVIOUS:
 			open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
+			status = nfs4_check_open_reclaim(&open->op_clientid);
+			if (status)
+				goto out;
 		case NFS4_OPEN_CLAIM_FH:
 		case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
 			status = do_open_fhandle(rqstp, &cstate->current_fh,
Signature · 1 line
1.7.7