Browse Source

NFSv4.1 data server timeo and retrans module parameters

Set the recovery parameters for data servers.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Andy Adamson 13 years ago
parent
commit
98fc685ae2
4 changed files with 30 additions and 11 deletions
  1. 4 8
      fs/nfs/client.c
  2. 3 1
      fs/nfs/internal.h
  3. 7 0
      fs/nfs/nfs4filelayout.h
  4. 16 2
      fs/nfs/nfs4filelayoutdev.c

+ 4 - 8
fs/nfs/client.c

@@ -1477,8 +1477,8 @@ error:
  * the MDS.
  * the MDS.
  */
  */
 struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
 struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
-		const struct sockaddr *ds_addr,
-		int ds_addrlen, int ds_proto)
+		const struct sockaddr *ds_addr, int ds_addrlen,
+		int ds_proto, unsigned int ds_timeo, unsigned int ds_retrans)
 {
 {
 	struct nfs_client_initdata cl_init = {
 	struct nfs_client_initdata cl_init = {
 		.addr = ds_addr,
 		.addr = ds_addr,
@@ -1488,12 +1488,7 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
 		.minorversion = mds_clp->cl_minorversion,
 		.minorversion = mds_clp->cl_minorversion,
 		.net = mds_clp->net,
 		.net = mds_clp->net,
 	};
 	};
-	struct rpc_timeout ds_timeout = {
-		.to_initval = 15 * HZ,
-		.to_maxval = 15 * HZ,
-		.to_retries = 1,
-		.to_exponential = 1,
-	};
+	struct rpc_timeout ds_timeout;
 	struct nfs_client *clp;
 	struct nfs_client *clp;
 
 
 	/*
 	/*
@@ -1501,6 +1496,7 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
 	 * cl_ipaddr so as to use the same EXCHANGE_ID co_ownerid as the MDS
 	 * cl_ipaddr so as to use the same EXCHANGE_ID co_ownerid as the MDS
 	 * (section 13.1 RFC 5661).
 	 * (section 13.1 RFC 5661).
 	 */
 	 */
+	nfs_init_timeout_values(&ds_timeout, ds_proto, ds_timeo, ds_retrans);
 	clp = nfs_get_client(&cl_init, &ds_timeout, mds_clp->cl_ipaddr,
 	clp = nfs_get_client(&cl_init, &ds_timeout, mds_clp->cl_ipaddr,
 			     mds_clp->cl_rpcclient->cl_auth->au_flavor, 0);
 			     mds_clp->cl_rpcclient->cl_auth->au_flavor, 0);
 
 

+ 3 - 1
fs/nfs/internal.h

@@ -172,7 +172,9 @@ extern void nfs_mark_client_ready(struct nfs_client *clp, int state);
 extern int nfs4_check_client_ready(struct nfs_client *clp);
 extern int nfs4_check_client_ready(struct nfs_client *clp);
 extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
 extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
 					     const struct sockaddr *ds_addr,
 					     const struct sockaddr *ds_addr,
-					     int ds_addrlen, int ds_proto);
+					     int ds_addrlen, int ds_proto,
+					     unsigned int ds_timeo,
+					     unsigned int ds_retrans);
 #ifdef CONFIG_PROC_FS
 #ifdef CONFIG_PROC_FS
 extern int __init nfs_fs_proc_init(void);
 extern int __init nfs_fs_proc_init(void);
 extern void nfs_fs_proc_exit(void);
 extern void nfs_fs_proc_exit(void);

+ 7 - 0
fs/nfs/nfs4filelayout.h

@@ -32,6 +32,13 @@
 
 
 #include "pnfs.h"
 #include "pnfs.h"
 
 
+/*
+ * Default data server connection timeout and retrans vaules.
+ * Set by module paramters dataserver_timeo and dataserver_retrans.
+ */
+#define NFS4_DEF_DS_TIMEO   60
+#define NFS4_DEF_DS_RETRANS 5
+
 /*
 /*
  * Field testing shows we need to support up to 4096 stripe indices.
  * Field testing shows we need to support up to 4096 stripe indices.
  * We store each index as a u8 (u32 on the wire) to keep the memory footprint
  * We store each index as a u8 (u32 on the wire) to keep the memory footprint

+ 16 - 2
fs/nfs/nfs4filelayoutdev.c

@@ -30,12 +30,16 @@
 
 
 #include <linux/nfs_fs.h>
 #include <linux/nfs_fs.h>
 #include <linux/vmalloc.h>
 #include <linux/vmalloc.h>
+#include <linux/module.h>
 
 
 #include "internal.h"
 #include "internal.h"
 #include "nfs4filelayout.h"
 #include "nfs4filelayout.h"
 
 
 #define NFSDBG_FACILITY		NFSDBG_PNFS_LD
 #define NFSDBG_FACILITY		NFSDBG_PNFS_LD
 
 
+static unsigned int dataserver_timeo = NFS4_DEF_DS_TIMEO;
+static unsigned int dataserver_retrans = NFS4_DEF_DS_RETRANS;
+
 /*
 /*
  * Data server cache
  * Data server cache
  *
  *
@@ -165,8 +169,9 @@ nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
 			__func__, ds->ds_remotestr, da->da_remotestr);
 			__func__, ds->ds_remotestr, da->da_remotestr);
 
 
 		clp = nfs4_set_ds_client(mds_srv->nfs_client,
 		clp = nfs4_set_ds_client(mds_srv->nfs_client,
-				 (struct sockaddr *)&da->da_addr,
-				 da->da_addrlen, IPPROTO_TCP);
+					(struct sockaddr *)&da->da_addr,
+					da->da_addrlen, IPPROTO_TCP,
+					dataserver_timeo, dataserver_retrans);
 		if (!IS_ERR(clp))
 		if (!IS_ERR(clp))
 			break;
 			break;
 	}
 	}
@@ -821,3 +826,12 @@ mark_dev_invalid:
 	filelayout_mark_devid_invalid(devid);
 	filelayout_mark_devid_invalid(devid);
 	return NULL;
 	return NULL;
 }
 }
+
+module_param(dataserver_retrans, uint, 0644);
+MODULE_PARM_DESC(dataserver_retrans, "The  number of times the NFSv4.1 client "
+			"retries a request before it attempts further "
+			" recovery  action.");
+module_param(dataserver_timeo, uint, 0644);
+MODULE_PARM_DESC(dataserver_timeo, "The time (in tenths of a second) the "
+			"NFSv4.1  client  waits for a response from a "
+			" data server before it retries an NFS request.");