Skip to contentSkip to conversation

nfsd: pin clients to 4.0/4.1

PATCH New J. Bruce Fields 1 participant 3 messages Oct 1, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The following patches should prevent clients from mixing 4.0 and 4.1 compounds, closing out another minor 4.1 todo. (Though it would probably be a good idea to write some pynfs tests for some of these odd cases.)

--b.

#1 lore raw

PATCH 1/2 nfsd4: set cl_minorversion at create time

From: "J. Bruce Fields" <[email protected]>

And remove some mostly obsolete comments.

---
 fs/nfsd/nfs4state.c |   11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
fs/nfsd/nfs4state.c +1 -10
index 0f8d7e7..73029cd 100644
@@ -1667,6 +1667,7 @@ out_new:
 		status = nfserr_jukebox;
 		goto out;
 	}
+	new->cl_minorversion = 1;
 
 	gen_clid(new);
 	add_to_unconfirmed(new, strhashval);
@@ -1799,12 +1800,6 @@ nfsd4_create_session(struct svc_rqst *rqstp,
 		status = nfserr_stale_clientid;
 		goto out;
 	}
-
-	/*
-	 * XXX: we should probably set this at creation time, and check
-	 * for consistent minorversion use throughout:
-	 */
-	conf->cl_minorversion = 1;
 	/*
 	 * We do not support RDMA or persistent sessions
 	 */
@@ -2216,10 +2211,6 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 		copy_clid(new, conf);
 	else /* case 4 (new client) or cases 2, 3 (client reboot): */
 		gen_clid(new);
-	/*
-	 * XXX: we should probably set this at creation time, and check
-	 * for consistent minorversion use throughout:
-	 */
 	new->cl_minorversion = 0;
 	gen_callback(new, setclid, rqstp);
 	add_to_unconfirmed(new, strhashval);
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/2 nfsd4: enforce per-client sessions/no-sessions distinction

In reply to J. Bruce Fields

From: "J. Bruce Fields" <[email protected]>

Something like creating a client with setclientid and then trying to confirm it with create_session may not crash the server, but I'm not completely positive of that, and in any case it's obviously bad client behavior.

---
 fs/nfsd/nfs4proc.c  |    2 +-
 fs/nfsd/nfs4state.c |   49 +++++++++++++++++++++++++++++--------------------
 fs/nfsd/state.h     |    2 +-
 3 files changed, 31 insertions(+), 22 deletions(-)
fs/nfsd/nfs4proc.c +1 -1
index f2bb0ef..6c9a4b2 100644
@@ -370,7 +370,7 @@ 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);
+			status = nfs4_check_open_reclaim(&open->op_clientid, cstate->minorversion);
 			if (status)
 				goto out;
 		case NFS4_OPEN_CLAIM_FH:
fs/nfsd/nfs4state.c +29 -20

160 lines not on this page · raw message

fs/nfsd/state.h +1 -1
index ec513fd..e036894 100644
@@ -455,7 +455,7 @@ extern void nfs4_unlock_state(void);
 extern int nfs4_in_grace(void);
 extern void nfs4_release_reclaim(void);
 extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(struct nfs4_client *crp);
-extern __be32 nfs4_check_open_reclaim(clientid_t *clid);
+extern __be32 nfs4_check_open_reclaim(clientid_t *clid, bool sessions);
 extern void nfs4_free_openowner(struct nfs4_openowner *);
 extern void nfs4_free_lockowner(struct nfs4_lockowner *);
 extern int set_callback_cred(void);
Signature · 1 line
1.7.9.5