Re: [PATCH 5/5] NFSD: Create PF_INET6 listener in write_ports

J. Bruce Fields
2010-01-27T22:02:42Z

On Wed, Jan 27, 2010 at 04:18:45PM -0500, Chuck Lever wrote:
>
> On Jan 26, 2010, at 6:30 PM, J. Bruce Fields wrote:
>> Any objection to moving the extra error-handling to the end, as in the
>> following? If there's no objection, I'll fold it into your last
>> patch.
>
> I guess that's fine, but out_close: would be more succinct than
> out_err_cleanup_inet, and somewhat more conventional.

Agreed, thanks. Applied, with that change.

--b.

>
>> --b.
>>
>> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
>> index f0a614e..f4474e5 100644
>> --- a/fs/nfsd/nfsctl.c
>> +++ b/fs/nfsd/nfsctl.c
>> @@ -988,6 +988,7 @@ static ssize_t __write_ports_delfd(char *buf)
>> static ssize_t __write_ports_addxprt(char *buf)
>> {
>> char transport[16];
>> + struct svc_xprt *xprt;
>> int port, err;
>>
>> if (sscanf(buf, "%15s %4u", transport, &port) != 2)
>> @@ -1007,18 +1008,15 @@ static ssize_t __write_ports_addxprt(char
>> *buf)
>>
>> err = svc_create_xprt(nfsd_serv, transport,
>> PF_INET6, port, SVC_SOCK_ANONYMOUS);
>> - if (err < 0 && err != -EAFNOSUPPORT) {
>> - struct svc_xprt *xprt;
>> - xprt = svc_find_xprt(nfsd_serv, transport, PF_INET, port);
>> - if (xprt != NULL) {
>> - svc_close_xprt(xprt);
>> - svc_xprt_put(xprt);
>> - }
>> - goto out_err;
>> - }
>> -
>> + if (err < 0 && err != -EAFNOSUPPORT)
>> + goto out_err_cleanup_inet;
>> return 0;
>> -
>> +out_err_cleanup_inet:
>> + xprt = svc_find_xprt(nfsd_serv, transport, PF_INET, port);
>> + if (xprt != NULL) {
>> + svc_close_xprt(xprt);
>> + svc_xprt_put(xprt);
>> + }
>> out_err:
>> /* Decrease the count, but don't shut down the service */
>> nfsd_serv->sv_nrthreads--;
>
> --
> Chuck Lever
> chuck[dot]lever[at]oracle[dot]com
>
>
>
>