Re: [PATCH 2/2] lockd: set svc_serv->sv_maxconn to a more reasonable value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 17, 2008 at 02:26:10PM -0400, Jeff Layton wrote:
> 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 RLIMIT_NOFILE for the
> lockd thread (usually this will be 1024). Also add a module parameter
> to allow an admin to set this to an arbitrary value at module load
> time.

I guess this is OK.

As long as we're picking a number out of thin air, I'd rather we make
that obvious, instead of making it look like we made some kind of
sophisticated choice that the poor reader will feel obliged to
understand.

So I'd be for a default that's just a constant, until someone has a
better idea.

What would actually happen if we allowed too many connections?  What
would fail first?  Is there some way to detect that situation and use
that to drop connections?

--b.

> 
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> ---
>  fs/lockd/svc.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
> index c631a83..81c336a 100644
> --- a/fs/lockd/svc.c
> +++ b/fs/lockd/svc.c
> @@ -61,6 +61,7 @@ static unsigned long		nlm_grace_period;
>  static unsigned long		nlm_timeout = LOCKD_DFLT_TIMEO;
>  static int			nlm_udpport, nlm_tcpport;
>  int				nsm_use_hostnames = 0;
> +unsigned int			nlm_max_connections;
>  
>  /*
>   * Constants needed for the sysctl interface.
> @@ -287,6 +288,9 @@ int lockd_up(void)
>  		goto destroy_and_out;
>  	}
>  
> +	serv->sv_maxconn = nlm_max_connections ? nlm_max_connections :
> +			    nlmsvc_task->signal->rlim[RLIMIT_NOFILE].rlim_cur;
> +
>  	/*
>  	 * Note: svc_serv structures have an initial use count of 1,
>  	 * so we exit through here on both success and failure.
> @@ -484,6 +488,7 @@ module_param_call(nlm_udpport, param_set_port, param_get_int,
>  module_param_call(nlm_tcpport, param_set_port, param_get_int,
>  		  &nlm_tcpport, 0644);
>  module_param(nsm_use_hostnames, bool, 0644);
> +module_param(nlm_max_connections, uint, 0644);
>  
>  /*
>   * Initialising and terminating the module.
> -- 
> 1.5.5.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux