From aba23f36c4dbc22d0d6d4afe6896bc5bf7f1caa6 Mon Sep 17 00:00:00 2001 From: Bodo Stroesser Date: Wed, 12 Nov 2014 09:19:09 -0500 Subject: rpc.mountd: set nonblocking mode with libtirpc If mountd is built with libtirpc the tcp listeners and the sockets waiting for UDP messages are not in non-blocking mode. Thus if running with multiple threads (-t XX), all threads will wake up from select on a connection request or a UDP message, but only one thread will succeed. All others will wait on accept() or read() for the next event. Reviewed-by: NeilBrown Signed-off-by: Bodo Stroesser Signed-off-by: Steve Dickson --- support/nfs/svc_create.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'support/nfs/svc_create.c') diff --git a/support/nfs/svc_create.c b/support/nfs/svc_create.c index a706f87..5291921 100644 --- a/support/nfs/svc_create.c +++ b/support/nfs/svc_create.c @@ -277,6 +277,12 @@ svc_create_nconf_rand_port(const char *name, const rpcprog_t program, "(%s, %u, %s)", name, version, nconf->nc_netid); return 0; } + if (svcsock_nonblock(xprt->xp_fd) < 0) { + /* close() already done by svcsock_nonblock() */ + xprt->xp_fd = RPC_ANYFD; + SVC_DESTROY(xprt); + return 0; + } if (!svc_reg(xprt, program, version, dispatch, nconf)) { /* svc_reg(3) destroys @xprt in this case */ @@ -332,6 +338,7 @@ svc_create_nconf_fixed_port(const char *name, const rpcprog_t program, int fd; fd = svc_create_sock(ai->ai_addr, ai->ai_addrlen, nconf); + fd = svcsock_nonblock(fd); if (fd == -1) goto out_free; -- cgit