aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-08-29 20:03:52 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2016-09-19 13:08:36 -0400
commit5405fc44c3377358205ab4095fe9c44716aa0900 (patch)
tree0cc85d03b5503ee017f84318c9c32a86fd6e6fc1 /fs/nfs
parentbb6aeba736ba9fd4d9569eec4bc3f7aecb42162a (diff)
NFSv4.x: Add kernel parameter to control the callback server
Add support for the kernel parameter nfs.callback_nr_threads to set the number of threads that will be assigned to the callback channel. Add support for the kernel parameter nfs.nfs.max_session_cb_slots to set the maximum size of the callback channel slot table. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/callback.c5
-rw-r--r--fs/nfs/callback.h3
-rw-r--r--fs/nfs/nfs4_fs.h1
-rw-r--r--fs/nfs/nfs4proc.c7
-rw-r--r--fs/nfs/nfs4session.h1
-rw-r--r--fs/nfs/super.c10
6 files changed, 21 insertions, 6 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index b91c49f4670b..532d8e242d4d 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -148,11 +148,14 @@ static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
148static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt, 148static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
149 struct svc_serv *serv) 149 struct svc_serv *serv)
150{ 150{
151 const int nrservs = NFS4_NR_CALLBACK_THREADS; 151 int nrservs = nfs_callback_nr_threads;
152 int ret; 152 int ret;
153 153
154 nfs_callback_bc_serv(minorversion, xprt, serv); 154 nfs_callback_bc_serv(minorversion, xprt, serv);
155 155
156 if (nrservs < NFS4_MIN_NR_CALLBACK_THREADS)
157 nrservs = NFS4_MIN_NR_CALLBACK_THREADS;
158
156 if (serv->sv_nrthreads-1 == nrservs) 159 if (serv->sv_nrthreads-1 == nrservs)
157 return 0; 160 return 0;
158 161
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h
index 14bd863495db..41ad65151ec8 100644
--- a/fs/nfs/callback.h
+++ b/fs/nfs/callback.h
@@ -198,8 +198,9 @@ extern void nfs_callback_down(int minorversion, struct net *net);
198#define NFS41_BC_MIN_CALLBACKS 1 198#define NFS41_BC_MIN_CALLBACKS 1
199#define NFS41_BC_MAX_CALLBACKS 1 199#define NFS41_BC_MAX_CALLBACKS 1
200 200
201#define NFS4_NR_CALLBACK_THREADS 1 201#define NFS4_MIN_NR_CALLBACK_THREADS 1
202 202
203extern unsigned int nfs_callback_set_tcpport; 203extern unsigned int nfs_callback_set_tcpport;
204extern unsigned short nfs_callback_nr_threads;
204 205
205#endif /* __LINUX_FS_NFS_CALLBACK_H */ 206#endif /* __LINUX_FS_NFS_CALLBACK_H */
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 9bf64eacba5b..f230aa62ca59 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -471,6 +471,7 @@ extern struct nfs_subversion nfs_v4;
471struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *, struct nfs_subversion *); 471struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *, struct nfs_subversion *);
472extern bool nfs4_disable_idmapping; 472extern bool nfs4_disable_idmapping;
473extern unsigned short max_session_slots; 473extern unsigned short max_session_slots;
474extern unsigned short max_session_cb_slots;
474extern unsigned short send_implementation_id; 475extern unsigned short send_implementation_id;
475extern bool recover_lost_locks; 476extern bool recover_lost_locks;
476 477
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index a9dec32ba9ba..251e48e7ba16 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7463,7 +7463,7 @@ static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args,
7463 args->bc_attrs.max_resp_sz = max_bc_payload; 7463 args->bc_attrs.max_resp_sz = max_bc_payload;
7464 args->bc_attrs.max_resp_sz_cached = 0; 7464 args->bc_attrs.max_resp_sz_cached = 0;
7465 args->bc_attrs.max_ops = NFS4_MAX_BACK_CHANNEL_OPS; 7465 args->bc_attrs.max_ops = NFS4_MAX_BACK_CHANNEL_OPS;
7466 args->bc_attrs.max_reqs = NFS41_BC_MAX_CALLBACKS; 7466 args->bc_attrs.max_reqs = min_t(unsigned short, max_session_cb_slots, 1);
7467 7467
7468 dprintk("%s: Back Channel : max_rqst_sz=%u max_resp_sz=%u " 7468 dprintk("%s: Back Channel : max_rqst_sz=%u max_resp_sz=%u "
7469 "max_resp_sz_cached=%u max_ops=%u max_reqs=%u\n", 7469 "max_resp_sz_cached=%u max_ops=%u max_reqs=%u\n",
@@ -7510,10 +7510,9 @@ static int nfs4_verify_back_channel_attrs(struct nfs41_create_session_args *args
7510 return -EINVAL; 7510 return -EINVAL;
7511 if (rcvd->max_resp_sz_cached > sent->max_resp_sz_cached) 7511 if (rcvd->max_resp_sz_cached > sent->max_resp_sz_cached)
7512 return -EINVAL; 7512 return -EINVAL;
7513 /* These would render the backchannel useless: */ 7513 if (rcvd->max_ops > sent->max_ops)
7514 if (rcvd->max_ops != sent->max_ops)
7515 return -EINVAL; 7514 return -EINVAL;
7516 if (rcvd->max_reqs != sent->max_reqs) 7515 if (rcvd->max_reqs > sent->max_reqs)
7517 return -EINVAL; 7516 return -EINVAL;
7518out: 7517out:
7519 return 0; 7518 return 0;
diff --git a/fs/nfs/nfs4session.h b/fs/nfs/nfs4session.h
index f703b755351b..3bb6af70973c 100644
--- a/fs/nfs/nfs4session.h
+++ b/fs/nfs/nfs4session.h
@@ -9,6 +9,7 @@
9 9
10/* maximum number of slots to use */ 10/* maximum number of slots to use */
11#define NFS4_DEF_SLOT_TABLE_SIZE (64U) 11#define NFS4_DEF_SLOT_TABLE_SIZE (64U)
12#define NFS4_DEF_CB_SLOT_TABLE_SIZE (1U)
12#define NFS4_MAX_SLOT_TABLE (1024U) 13#define NFS4_MAX_SLOT_TABLE (1024U)
13#define NFS4_NO_SLOT ((u32)-1) 14#define NFS4_NO_SLOT ((u32)-1)
14 15
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index d39601381adf..001796bcd6c8 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2848,19 +2848,23 @@ out_invalid_transport_udp:
2848 * NFS client for backwards compatibility 2848 * NFS client for backwards compatibility
2849 */ 2849 */
2850unsigned int nfs_callback_set_tcpport; 2850unsigned int nfs_callback_set_tcpport;
2851unsigned short nfs_callback_nr_threads;
2851/* Default cache timeout is 10 minutes */ 2852/* Default cache timeout is 10 minutes */
2852unsigned int nfs_idmap_cache_timeout = 600; 2853unsigned int nfs_idmap_cache_timeout = 600;
2853/* Turn off NFSv4 uid/gid mapping when using AUTH_SYS */ 2854/* Turn off NFSv4 uid/gid mapping when using AUTH_SYS */
2854bool nfs4_disable_idmapping = true; 2855bool nfs4_disable_idmapping = true;
2855unsigned short max_session_slots = NFS4_DEF_SLOT_TABLE_SIZE; 2856unsigned short max_session_slots = NFS4_DEF_SLOT_TABLE_SIZE;
2857unsigned short max_session_cb_slots = NFS4_DEF_CB_SLOT_TABLE_SIZE;
2856unsigned short send_implementation_id = 1; 2858unsigned short send_implementation_id = 1;
2857char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN] = ""; 2859char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN] = "";
2858bool recover_lost_locks = false; 2860bool recover_lost_locks = false;
2859 2861
2862EXPORT_SYMBOL_GPL(nfs_callback_nr_threads);
2860EXPORT_SYMBOL_GPL(nfs_callback_set_tcpport); 2863EXPORT_SYMBOL_GPL(nfs_callback_set_tcpport);
2861EXPORT_SYMBOL_GPL(nfs_idmap_cache_timeout); 2864EXPORT_SYMBOL_GPL(nfs_idmap_cache_timeout);
2862EXPORT_SYMBOL_GPL(nfs4_disable_idmapping); 2865EXPORT_SYMBOL_GPL(nfs4_disable_idmapping);
2863EXPORT_SYMBOL_GPL(max_session_slots); 2866EXPORT_SYMBOL_GPL(max_session_slots);
2867EXPORT_SYMBOL_GPL(max_session_cb_slots);
2864EXPORT_SYMBOL_GPL(send_implementation_id); 2868EXPORT_SYMBOL_GPL(send_implementation_id);
2865EXPORT_SYMBOL_GPL(nfs4_client_id_uniquifier); 2869EXPORT_SYMBOL_GPL(nfs4_client_id_uniquifier);
2866EXPORT_SYMBOL_GPL(recover_lost_locks); 2870EXPORT_SYMBOL_GPL(recover_lost_locks);
@@ -2887,6 +2891,9 @@ static const struct kernel_param_ops param_ops_portnr = {
2887#define param_check_portnr(name, p) __param_check(name, p, unsigned int); 2891#define param_check_portnr(name, p) __param_check(name, p, unsigned int);
2888 2892
2889module_param_named(callback_tcpport, nfs_callback_set_tcpport, portnr, 0644); 2893module_param_named(callback_tcpport, nfs_callback_set_tcpport, portnr, 0644);
2894module_param_named(callback_nr_threads, nfs_callback_nr_threads, ushort, 0644);
2895MODULE_PARM_DESC(callback_nr_threads, "Number of threads that will be "
2896 "assigned to the NFSv4 callback channels.");
2890module_param(nfs_idmap_cache_timeout, int, 0644); 2897module_param(nfs_idmap_cache_timeout, int, 0644);
2891module_param(nfs4_disable_idmapping, bool, 0644); 2898module_param(nfs4_disable_idmapping, bool, 0644);
2892module_param_string(nfs4_unique_id, nfs4_client_id_uniquifier, 2899module_param_string(nfs4_unique_id, nfs4_client_id_uniquifier,
@@ -2896,6 +2903,9 @@ MODULE_PARM_DESC(nfs4_disable_idmapping,
2896module_param(max_session_slots, ushort, 0644); 2903module_param(max_session_slots, ushort, 0644);
2897MODULE_PARM_DESC(max_session_slots, "Maximum number of outstanding NFSv4.1 " 2904MODULE_PARM_DESC(max_session_slots, "Maximum number of outstanding NFSv4.1 "
2898 "requests the client will negotiate"); 2905 "requests the client will negotiate");
2906module_param(max_session_cb_slots, ushort, 0644);
2907MODULE_PARM_DESC(max_session_slots, "Maximum number of parallel NFSv4.1 "
2908 "callbacks the client will process for a given server");
2899module_param(send_implementation_id, ushort, 0644); 2909module_param(send_implementation_id, ushort, 0644);
2900MODULE_PARM_DESC(send_implementation_id, 2910MODULE_PARM_DESC(send_implementation_id,
2901 "Send implementation ID with NFSv4.1 exchange_id"); 2911 "Send implementation ID with NFSv4.1 exchange_id");