Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sunrpc: remove all connection limit configuration

Now that the connection limit only apply to unconfirmed connections,
there is no need to configure it. So remove all the configuration and
fix the number of unconfirmed connections as always 64 - which is
now given a name: XPT_MAX_TMP_CONN

Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

NeilBrown and committed by
Chuck Lever
a4b853f1 eccbbc7c

+7 -72
-8
fs/lockd/svc.c
··· 70 70 unsigned long nlm_timeout = LOCKD_DFLT_TIMEO; 71 71 static int nlm_udpport, nlm_tcpport; 72 72 73 - /* RLIM_NOFILE defaults to 1024. That seems like a reasonable default here. */ 74 - static unsigned int nlm_max_connections = 1024; 75 - 76 73 /* 77 74 * Constants needed for the sysctl interface. 78 75 */ ··· 133 136 * NFS mount or NFS daemon has gone away. 134 137 */ 135 138 while (!svc_thread_should_stop(rqstp)) { 136 - /* update sv_maxconn if it has changed */ 137 - rqstp->rq_server->sv_maxconn = nlm_max_connections; 138 - 139 139 nlmsvc_retry_blocked(rqstp); 140 140 svc_recv(rqstp); 141 141 } ··· 334 340 return -ENOMEM; 335 341 } 336 342 337 - serv->sv_maxconn = nlm_max_connections; 338 343 error = svc_set_num_threads(serv, NULL, 1); 339 344 if (error < 0) { 340 345 svc_destroy(&serv); ··· 535 542 module_param_call(nlm_tcpport, param_set_port, param_get_int, 536 543 &nlm_tcpport, 0644); 537 544 module_param(nsm_use_hostnames, bool, 0644); 538 - module_param(nlm_max_connections, uint, 0644); 539 545 540 546 static int lockd_init_net(struct net *net) 541 547 {
-6
fs/nfsd/netns.h
··· 128 128 seqlock_t writeverf_lock; 129 129 unsigned char writeverf[8]; 130 130 131 - /* 132 - * Max number of non-validated connections this nfsd container 133 - * will allow. Defaults to '0' gets mapped to 64. 134 - */ 135 - unsigned int max_connections; 136 - 137 131 u32 clientid_base; 138 132 u32 clientid_counter; 139 133 u32 clverifier_counter;
-42
fs/nfsd/nfsctl.c
··· 48 48 NFSD_Versions, 49 49 NFSD_Ports, 50 50 NFSD_MaxBlkSize, 51 - NFSD_MaxConnections, 52 51 NFSD_Filecache, 53 52 NFSD_Leasetime, 54 53 NFSD_Gracetime, ··· 67 68 static ssize_t write_versions(struct file *file, char *buf, size_t size); 68 69 static ssize_t write_ports(struct file *file, char *buf, size_t size); 69 70 static ssize_t write_maxblksize(struct file *file, char *buf, size_t size); 70 - static ssize_t write_maxconn(struct file *file, char *buf, size_t size); 71 71 #ifdef CONFIG_NFSD_V4 72 72 static ssize_t write_leasetime(struct file *file, char *buf, size_t size); 73 73 static ssize_t write_gracetime(struct file *file, char *buf, size_t size); ··· 85 87 [NFSD_Versions] = write_versions, 86 88 [NFSD_Ports] = write_ports, 87 89 [NFSD_MaxBlkSize] = write_maxblksize, 88 - [NFSD_MaxConnections] = write_maxconn, 89 90 #ifdef CONFIG_NFSD_V4 90 91 [NFSD_Leasetime] = write_leasetime, 91 92 [NFSD_Gracetime] = write_gracetime, ··· 899 902 nfsd_max_blksize); 900 903 } 901 904 902 - /* 903 - * write_maxconn - Set or report the current max number of connections 904 - * 905 - * Input: 906 - * buf: ignored 907 - * size: zero 908 - * OR 909 - * 910 - * Input: 911 - * buf: C string containing an unsigned 912 - * integer value representing the new 913 - * number of max connections 914 - * size: non-zero length of C string in @buf 915 - * Output: 916 - * On success: passed-in buffer filled with '\n'-terminated C string 917 - * containing numeric value of max_connections setting 918 - * for this net namespace; 919 - * return code is the size in bytes of the string 920 - * On error: return code is zero or a negative errno value 921 - */ 922 - static ssize_t write_maxconn(struct file *file, char *buf, size_t size) 923 - { 924 - char *mesg = buf; 925 - struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id); 926 - unsigned int maxconn = nn->max_connections; 927 - 928 - if (size > 0) { 929 - int rv = get_uint(&mesg, &maxconn); 930 - 931 - if (rv) 932 - return rv; 933 - trace_nfsd_ctl_maxconn(netns(file), maxconn); 934 - nn->max_connections = maxconn; 935 - } 936 - 937 - return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%u\n", maxconn); 938 - } 939 - 940 905 #ifdef CONFIG_NFSD_V4 941 906 static ssize_t __nfsd4_write_time(struct file *file, char *buf, size_t size, 942 907 time64_t *time, struct nfsd_net *nn) ··· 1331 1372 [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR}, 1332 1373 [NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO}, 1333 1374 [NFSD_MaxBlkSize] = {"max_block_size", &transaction_ops, S_IWUSR|S_IRUGO}, 1334 - [NFSD_MaxConnections] = {"max_connections", &transaction_ops, S_IWUSR|S_IRUGO}, 1335 1375 [NFSD_Filecache] = {"filecache", &nfsd_file_cache_stats_fops, S_IRUGO}, 1336 1376 #ifdef CONFIG_NFSD_V4 1337 1377 [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR},
-5
fs/nfsd/nfssvc.c
··· 668 668 if (serv == NULL) 669 669 return -ENOMEM; 670 670 671 - serv->sv_maxconn = nn->max_connections; 672 671 error = svc_bind(serv, net); 673 672 if (error < 0) { 674 673 svc_destroy(&serv); ··· 953 954 * The main request loop 954 955 */ 955 956 while (!svc_thread_should_stop(rqstp)) { 956 - /* Update sv_maxconn if it has changed */ 957 - rqstp->rq_server->sv_maxconn = nn->max_connections; 958 - 959 957 svc_recv(rqstp); 960 - 961 958 nfsd_file_net_dispose(nn); 962 959 } 963 960
-4
include/linux/sunrpc/svc.h
··· 72 72 spinlock_t sv_lock; 73 73 unsigned int sv_nprogs; /* Number of sv_programs */ 74 74 unsigned int sv_nrthreads; /* # of server threads */ 75 - unsigned int sv_maxconn; /* max connections allowed or 76 - * '0' causing max to be based 77 - * on number of threads. */ 78 - 79 75 unsigned int sv_max_payload; /* datagram payload size */ 80 76 unsigned int sv_max_mesg; /* max_payload + 1 page for overheads */ 81 77 unsigned int sv_xdrsize; /* XDR buffer size */
+6
include/linux/sunrpc/svc_xprt.h
··· 105 105 */ 106 106 }; 107 107 108 + /* 109 + * Maximum number of "tmp" connections - those without XPT_PEER_VALID - 110 + * permitted on any service. 111 + */ 112 + #define XPT_MAX_TMP_CONN 64 113 + 108 114 static inline void svc_xprt_set_valid(struct svc_xprt *xpt) 109 115 { 110 116 if (test_bit(XPT_TEMP, &xpt->xpt_flags) &&
+1 -7
net/sunrpc/svc_xprt.c
··· 619 619 * The only somewhat efficient mechanism would be if drop old 620 620 * connections from the same IP first. But right now we don't even 621 621 * record the client IP in svc_sock. 622 - * 623 - * single-threaded services that expect a lot of clients will probably 624 - * need to set sv_maxconn to override the default value which is based 625 - * on the number of threads 626 622 */ 627 623 static void svc_check_conn_limits(struct svc_serv *serv) 628 624 { 629 - unsigned int limit = serv->sv_maxconn ? serv->sv_maxconn : 64; 630 - 631 - if (serv->sv_tmpcnt > limit) { 625 + if (serv->sv_tmpcnt > XPT_MAX_TMP_CONN) { 632 626 struct svc_xprt *xprt = NULL, *xprti; 633 627 spin_lock_bh(&serv->sv_lock); 634 628 if (!list_empty(&serv->sv_tempsocks)) {