[pnfs] [PATCH] Removed sessions hard-coded 32678 byte max sizes

Andy Adamson andros at umich.edu
Thu Mar 15 17:21:08 EDT 2007


Client: replace fore and back channel 32768 max_rqst_sz, max_resp_sz, and
max_resp_sz_cached with NFS_MAX_FILE_IO_SIZE.

Server: use svc_max_payload(rqstp) to set fore and back channel sizes

NOTE: This is really sessions branch code - but is dependant on the largeio
patch in the pNFS branch. We decided to leave it in the pNFS branch.
---
 fs/nfs/nfs4xdr.c    |   12 ++++++------
 fs/nfsd/nfs4state.c |    9 +++++++++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index f2a5c21..4f18c2f 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1498,18 +1498,18 @@ static int encode_create_session(struct xdr_stream *xdr, struct nfs41_create_ses
 	RESERVE_SPACE(2*28);                    /* 2 channel_attrs */
 
 	/* Fore Channel */
-	WRITE32(32768);                         /* max req size */
-	WRITE32(32768);                         /* max resp size */
-	WRITE32(32768);                         /* Max resp size cached */
+	WRITE32(NFS_MAX_FILE_IO_SIZE);          /* max req size */
+	WRITE32(NFS_MAX_FILE_IO_SIZE);          /* max resp size */
+	WRITE32(NFS_MAX_FILE_IO_SIZE);          /* Max resp size cached */
 	WRITE32(RPC_DEF_SLOT_TABLE);            /* max operations */
 	WRITE32(RPC_DEF_SLOT_TABLE);            /* max requests */
 	WRITE32(0);                             /* Streamchannel attrs */
 	WRITE32(0);                             /*rdmachannel_attrs */
 
 	/* Back Channel */
-	WRITE32(32768);                         /* max req size */
-	WRITE32(32768);                         /* max resp size */
-	WRITE32(32768);                         /* Max resp size cached */
+	WRITE32(NFS_MAX_FILE_IO_SIZE);          /* max req size */
+	WRITE32(NFS_MAX_FILE_IO_SIZE);          /* max resp size */
+	WRITE32(NFS_MAX_FILE_IO_SIZE);          /* Max resp size cached */
 	WRITE32(RPC_DEF_SLOT_TABLE);            /* max operations */
 	WRITE32(RPC_DEF_SLOT_TABLE);            /* max requests */
 	WRITE32(0);                             /* Streamchannel attrs */
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 43fa8ff..259228f 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -74,6 +74,8 @@ static stateid_t onestateid;              /* bits all 1 */
 #define ZERO_STATEID(stateid) (!memcmp((stateid), &zerostateid, sizeof(stateid_t)))
 #define ONE_STATEID(stateid)  (!memcmp((stateid), &onestateid, sizeof(stateid_t)))
 
+extern __u32 svc_max_payload(const struct svc_rqst *rqstp);
+
 /* forward declarations */
 static struct nfs4_stateid * find_stateid(stateid_t *stid, int flags);
 static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid);
@@ -1253,6 +1255,7 @@ int nfsd4_create_session(struct svc_rqst *rqstp, struct nfsd4_create_session *se
 {
 	u32 ip_addr = rqstp->rq_addr.sin_addr.s_addr;
 	struct nfs4_client *conf, *unconf;
+	__u32   max_blocksize = svc_max_payload(rqstp);
 	int status = 0;
 
 	if (STALE_CLIENTID(&session->clientid))
@@ -1302,6 +1305,12 @@ int nfsd4_create_session(struct svc_rqst *rqstp, struct nfsd4_create_session *se
 out_replay:
 	memcpy(session->sessionid, conf->cl_sessionid, 16);
 	session->seqid = conf->cl_seqid;
+	session->fore_channel.maxreq_sz = max_blocksize;
+	session->fore_channel.maxresp_sz = max_blocksize;
+	session->fore_channel.maxresp_cached = max_blocksize;
+	session->back_channel.maxreq_sz = max_blocksize;
+	session->back_channel.maxresp_sz = max_blocksize;
+	session->back_channel.maxresp_cached = max_blocksize;
 out:
 	nfs4_unlock_state();
 	dprintk("%s returns %d %d\n", __FUNCTION__, status, ntohl(status));
-- 
1.5.0.2



More information about the pNFS mailing list