Re: [PATCH 3/3] NFSD: Enable NFS server use of PF_INET6

Chuck Lever
2010-01-15T23:10:16Z

On Jan 15, 2010, at 5:35 PM, J. Bruce Fields wrote:

> On Wed, Jan 13, 2010 at 04:10:48PM -0500, Chuck Lever wrote:
>> Try to use an PF_INET6 listener for NFSD if IPv6 is enabled in the
>> kernel.
>>
>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>> ---
>>
>> fs/nfsd/nfsctl.c | 36 +++++++++++++++++++++++++++++-------
>> fs/nfsd/nfssvc.c | 27 ++++++++++++++++++++++-----
>> 2 files changed, 51 insertions(+), 12 deletions(-)
>>
>> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
>> index 2604c3e..7ebb7a5 100644
>> --- a/fs/nfsd/nfsctl.c
>> +++ b/fs/nfsd/nfsctl.c
>> @@ -981,6 +981,26 @@ static ssize_t __write_ports_delfd(char *buf)
>> return len;
>> }
>>
>> +static ssize_t __write_ports_create_xprt(struct svc_serv *serv,
>> + const char *transport,
>> + const int family,
>> + const unsigned short port)
>> +{
>> + int err;
>> +
>> + err = svc_create_xprt(serv, transport, family, port,
>> + SVC_SOCK_ANONYMOUS);
>> +
>> + if (err < 0) {
>> + /* Give a reasonable perror msg for bad transport string */
>> + if (err == -ENOENT)
>> + err = -EPROTONOSUPPORT;
>
> I realize you're just moving this code, not writing it, so this is a
> separate question, but: it looks like it's svc_create_xprt() itself
> that
> chooses ENOENT for this case. Is there any reason it shouldn't just
> use
> EPROTONOSUPPORT from the start?

I guess this little transformation is for the benefit of rpc.nfsd? I
don't know of a reason offhand why you couldn't change
svc_create_xprt(). I don't immediately see any of svc_create_xprt's
callers that might depend on getting ENOENT, but I didn't look very
hard.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com