diff options
author | Bodo Stroesser <bstroesser@ts.fujitsu.com> | 2014-11-12 09:19:09 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2014-11-12 13:46:59 -0500 |
commit | aba23f36c4dbc22d0d6d4afe6896bc5bf7f1caa6 (patch) | |
tree | db5251494bc1d10628c1989497f6d43f0800bccc | |
parent | e2989f2f5fd709c19eeb92780a51ae58d3501db8 (diff) | |
download | nfs-utils-aba23f36c4dbc22d0d6d4afe6896bc5bf7f1caa6.tar.gz nfs-utils-aba23f36c4dbc22d0d6d4afe6896bc5bf7f1caa6.tar.xz nfs-utils-aba23f36c4dbc22d0d6d4afe6896bc5bf7f1caa6.zip |
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 <neilb@suse.de>
Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r-- | support/nfs/svc_create.c | 7 |
1 files changed, 7 insertions, 0 deletions
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; |