Re: [nfs-utils] [PATCH 2/3] rpc.mountd: set nonblocking mode with libtirpc

NeilBrown
2014-11-05T21:58:01Z

[-- Attachment #1: Type: text/plain, Size: 1689 bytes --]

On 05 Nov 2014 21:23:39 +0100 bstroesser@ts.fujitsu.com wrote:

> From: Bodo Stroesser <bstroesser@ts.fujitsu.com>
> Date: Thu, 09 Oct 2014 13:07:33 +0200
> Subject: [nfs-utils] [PATCH 2/3] 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.
>
> Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>

Reviewed-by: NeilBrown <neilb@suse.de>

The two changes provide identical functionality: one in
svc_create_nconf_rand_port
the other in
svc_create_nconf_fixed_port

We really do want non-blocking sockets here!

Thanks,
NeilBrown

> ---
>
> --- nfs-utils-1.3.1/support/nfs/svc_create.c 2014-10-08 21:39:01.000000000 +0200
> +++ nfs-utils-1.3.1/support/nfs/svc_create.c 2014-10-08 22:20:02.000000000 +0200
> @@ -277,6 +277,12 @@
> "(%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 @@
> int fd;
>
> fd = svc_create_sock(ai->ai_addr, ai->ai_addrlen, nconf);
> + fd = svcsock_nonblock(fd);
> if (fd == -1)
> goto out_free;
>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]