Skip to contentSkip to conversation

NFSv4.1 Do not overwrite negotiated session sizes

PATCH New [email protected] 1 participant 2 messages Jun 26, 2013

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

cover NFSv4.1 Do not overwrite negotiated session sizes

From: Andy Adamson <[email protected]>

Version 1 was 2 patches:
0001-NFSv4.1-Add-the-RPC-header-and-other-overhead-to-ses.patch 0002-NFSv4.1-Do-not-overwrite-negotiated-session-sizes.patch

These have been collapsed into "NFSv4.1 Refactor nfs4_init_session and nfs4_init_channel_attrs"

I have tested mounting NFSv4.1, pNFS, LIF moves, and pynfs SESSIONRESET1, SESSIONRESET2 tests.

Andy Adamson (1):
NFSv4.1 Refactor nfs4_init_session and nfs4_init_channel_attrs

 fs/nfs/nfs4client.c  |  2 +-
 fs/nfs/nfs4proc.c    | 17 +++++++----------
 fs/nfs/nfs4session.c | 41 +++--------------------------------------
 fs/nfs/nfs4session.h |  7 ++-----
 4 files changed, 13 insertions(+), 54 deletions(-)
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 1/1 NFSv4.1 Refactor nfs4_init_session and nfs4_init_channel_attrs

From: Andy Adamson <[email protected]>

nfs4_init_session was originally written to be called prior to nfs4_init_channel_attrs, setting the session target_max response and request sizes that nfs4_init_channel_attrs would pay attention to.

In the current code flow, nfs4_init_session, just like nfs4_init_ds_session for the data server case, is called after the session is all negotiated, and is actually used in a RECLAIM COMPLETE call to the server.

Remove the un-needed fc_target_max response and request fields from nfs4_session and just set the max_resp_sz and max_rqst_sz in nfs4_init_channel_attrs.

---
 fs/nfs/nfs4client.c  |  2 +-
 fs/nfs/nfs4proc.c    | 17 +++++++----------
 fs/nfs/nfs4session.c | 41 +++--------------------------------------
 fs/nfs/nfs4session.h |  7 ++-----
 4 files changed, 13 insertions(+), 54 deletions(-)
fs/nfs/nfs4client.c +1 -1
index c22565b..3432a6f 100644
@@ -735,7 +735,7 @@ static int nfs4_server_common_setup(struct nfs_server *server,
 		return -ENOMEM;
 
 	/* We must ensure the session is initialised first */
-	error = nfs4_init_session(server);
+	error = nfs4_init_session(server->nfs_client);
 	if (error < 0)
 		goto out;
 
fs/nfs/nfs4proc.c +7 -10
index 3e40876..d95616f 100644
@@ -6184,17 +6184,14 @@ int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo)
  */
 static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args)
 {
-	struct nfs4_session *session = args->client->cl_session;
-	unsigned int mxrqst_sz = session->fc_target_max_rqst_sz,
-		     mxresp_sz = session->fc_target_max_resp_sz;
-
-	if (mxrqst_sz == 0)
-		mxrqst_sz = NFS_MAX_FILE_IO_SIZE;
-	if (mxresp_sz == 0)
-		mxresp_sz = NFS_MAX_FILE_IO_SIZE;
+	unsigned int max_rqst_sz, max_resp_sz;
+
+	max_rqst_sz = NFS_MAX_FILE_IO_SIZE + nfs41_maxwrite_overhead;
+	max_resp_sz = NFS_MAX_FILE_IO_SIZE + nfs41_maxread_overhead;
+
 	/* Fore channel attributes */
-	args->fc_attrs.max_rqst_sz = mxrqst_sz;
-	args->fc_attrs.max_resp_sz = mxresp_sz;
+	args->fc_attrs.max_rqst_sz = max_rqst_sz;
+	args->fc_attrs.max_resp_sz = max_resp_sz;
 	args->fc_attrs.max_ops = NFS4_MAX_OPS;
 	args->fc_attrs.max_reqs = max_session_slots;
 
fs/nfs/nfs4session.c +3 -38

51 lines not on this page · raw message

fs/nfs/nfs4session.h +2 -5
index ff7d9f0..3a153d8 100644
@@ -66,9 +66,6 @@ struct nfs4_session {
 	struct nfs4_channel_attrs	bc_attrs;
 	struct nfs4_slot_table		bc_slot_table;
 	struct nfs_client		*clp;
-	/* Create session arguments */
-	unsigned int			fc_target_max_rqst_sz;
-	unsigned int			fc_target_max_resp_sz;
 };
 
 enum nfs4_session_state {
@@ -89,7 +86,7 @@ extern int nfs4_setup_session_slot_tables(struct nfs4_session *ses);
 
 extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp);
 extern void nfs4_destroy_session(struct nfs4_session *session);
-extern int nfs4_init_session(struct nfs_server *server);
+extern int nfs4_init_session(struct nfs_client *clp);
 extern int nfs4_init_ds_session(struct nfs_client *, unsigned long);
 
 extern void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl);
@@ -122,7 +119,7 @@ static inline int nfs4_has_persistent_session(const struct nfs_client *clp)
 
 #else /* defined(CONFIG_NFS_V4_1) */
 
-static inline int nfs4_init_session(struct nfs_server *server)
+static inline int nfs4_init_session(struct nfs_client *clp)
 {
 	return 0;
 }
Signature · 1 line
1.7.11.7