From: Jeff Layton Date: Thu, 17 Apr 2025 18:54:36 +0000 (-0400) Subject: sunrpc: allow SOMAXCONN backlogged TCP connections X-Git-Tag: v6.16-rc1~138^2~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=de08ffb79c8f404adc611ddb580bc74133b2c986;p=thirdparty%2Flinux.git sunrpc: allow SOMAXCONN backlogged TCP connections The connection backlog passed to listen() denotes the number of connections that are fully established, but that have not yet been accept()ed. If the amount goes above that level, new connection requests will be dropped on the floor until the value goes down. If all the knfsd threads are bogged down in (e.g.) disk I/O, new connection attempts can stall because of this. For the same rationale that Trond points out in the userland patch [1], ensure that svc_xprt sockets created by the kernel allow SOMAXCONN (4096) backlogged connections instead of the 64 that they do today. [1]: https://lore.kernel.org/linux-nfs/20240308180223.2965601-1-trond.myklebust@hammerspace.com/ Cc: Trond Myklebust Signed-off-by: Jeff Layton Signed-off-by: Chuck Lever --- diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 72e5a01df3d35..60f2883268faf 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -1542,7 +1542,7 @@ static struct svc_xprt *svc_create_socket(struct svc_serv *serv, if (protocol == IPPROTO_TCP) { sk_net_refcnt_upgrade(sock->sk); - if ((error = kernel_listen(sock, 64)) < 0) + if ((error = kernel_listen(sock, SOMAXCONN)) < 0) goto bummer; }