]> git.baikalelectronics.ru Git - kernel.git/commit
sunrpc: add sv_maxconn field to svc_serv (try #3)
authorJeff Layton <jlayton@redhat.com>
Mon, 20 Oct 2008 15:51:57 +0000 (11:51 -0400)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Tue, 6 Jan 2009 16:53:47 +0000 (11:53 -0500)
commit797b80e1687f0a29b2ad68bddf65dcd5de54bbea
tree22f9f999e0d48a5f3aae6b32f9ff702eb4db05cc
parentbca25b3d1d385b7a47c4627451d168f9e4c9a480
sunrpc: add sv_maxconn field to svc_serv (try #3)

svc_check_conn_limits() attempts to prevent denial of service attacks
by having the service close old connections once it reaches a
threshold. This threshold is based on the number of threads in the
service:

(serv->sv_nrthreads + 3) * 20

Once we reach this, we drop the oldest connections and a printk pops
to warn the admin that they should increase the number of threads.

Increasing the number of threads isn't an option however for services
like lockd. We don't want to eliminate this check entirely for such
services but we need some way to increase this limit.

This patch adds a sv_maxconn field to the svc_serv struct. When it's
set to 0, we use the current method to calculate the max number of
connections. RPC services can then set this on an as-needed basis.

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>
include/linux/sunrpc/svc.h
net/sunrpc/svc_xprt.c