diff options
author | Jeff Layton <jlayton@redhat.com> | 2008-10-20 11:51:58 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-01-06 11:53:48 -0500 |
commit | c72a476b4b7ecadb80185de31236edb303c1a5d0 (patch) | |
tree | c57ac715970c4a3363b28122ce2d3b47fe179b7f /fs | |
parent | c9233eb7b0b11ef176d4bf68da2ce85464b6ec39 (diff) |
lockd: set svc_serv->sv_maxconn to a more reasonable value (try #3)
The default method for calculating the number of connections allowed
per RPC service arbitrarily limits single-threaded services to 80
connections. This is too low for services like lockd and artificially
limits the number of TCP clients that it can support.
Have lockd set a default sv_maxconn value to 1024 (which is the typical
default value for RLIMIT_NOFILE. Also add a module parameter to allow an
admin to set this to an arbitrary value.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Neil Brown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/lockd/svc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 252d80163d02..bc3c3cb62db5 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -62,6 +62,9 @@ static unsigned long nlm_timeout = LOCKD_DFLT_TIMEO; | |||
62 | static int nlm_udpport, nlm_tcpport; | 62 | static int nlm_udpport, nlm_tcpport; |
63 | int nsm_use_hostnames = 0; | 63 | int nsm_use_hostnames = 0; |
64 | 64 | ||
65 | /* RLIM_NOFILE defaults to 1024. That seems like a reasonable default here. */ | ||
66 | static unsigned int nlm_max_connections = 1024; | ||
67 | |||
65 | /* | 68 | /* |
66 | * Constants needed for the sysctl interface. | 69 | * Constants needed for the sysctl interface. |
67 | */ | 70 | */ |
@@ -143,6 +146,9 @@ lockd(void *vrqstp) | |||
143 | long timeout = MAX_SCHEDULE_TIMEOUT; | 146 | long timeout = MAX_SCHEDULE_TIMEOUT; |
144 | RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); | 147 | RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); |
145 | 148 | ||
149 | /* update sv_maxconn if it has changed */ | ||
150 | rqstp->rq_server->sv_maxconn = nlm_max_connections; | ||
151 | |||
146 | if (signalled()) { | 152 | if (signalled()) { |
147 | flush_signals(current); | 153 | flush_signals(current); |
148 | if (nlmsvc_ops) { | 154 | if (nlmsvc_ops) { |
@@ -276,6 +282,7 @@ int lockd_up(void) | |||
276 | } | 282 | } |
277 | 283 | ||
278 | svc_sock_update_bufs(serv); | 284 | svc_sock_update_bufs(serv); |
285 | serv->sv_maxconn = nlm_max_connections; | ||
279 | 286 | ||
280 | nlmsvc_task = kthread_run(lockd, nlmsvc_rqst, serv->sv_name); | 287 | nlmsvc_task = kthread_run(lockd, nlmsvc_rqst, serv->sv_name); |
281 | if (IS_ERR(nlmsvc_task)) { | 288 | if (IS_ERR(nlmsvc_task)) { |
@@ -485,6 +492,7 @@ module_param_call(nlm_udpport, param_set_port, param_get_int, | |||
485 | module_param_call(nlm_tcpport, param_set_port, param_get_int, | 492 | module_param_call(nlm_tcpport, param_set_port, param_get_int, |
486 | &nlm_tcpport, 0644); | 493 | &nlm_tcpport, 0644); |
487 | module_param(nsm_use_hostnames, bool, 0644); | 494 | module_param(nsm_use_hostnames, bool, 0644); |
495 | module_param(nlm_max_connections, uint, 0644); | ||
488 | 496 | ||
489 | /* | 497 | /* |
490 | * Initialising and terminating the module. | 498 | * Initialising and terminating the module. |