From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:46191 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752147AbbIIPri (ORCPT ); Wed, 9 Sep 2015 11:47:38 -0400 Subject: Re: nfs-utils regression on IPv6-less kernels To: Christoph Hellwig , Chuck Lever References: <20150810131358.GA19466@infradead.org> <55C9D2F2.1020300@RedHat.com> <20150817124220.GA17877@infradead.org> <20150817160639.GA1173@infradead.org> Cc: Linux NFS Mailing List From: Steve Dickson Message-ID: <55F05499.3090505@RedHat.com> Date: Wed, 9 Sep 2015 11:47:37 -0400 MIME-Version: 1.0 In-Reply-To: <20150817160639.GA1173@infradead.org> Content-Type: text/plain; charset=windows-1252 Sender: linux-nfs-owner@vger.kernel.org List-ID: On 08/17/2015 12:06 PM, Christoph Hellwig wrote: > On Mon, Aug 17, 2015 at 08:40:25AM -0700, Chuck Lever wrote: >> Probably stopped working with "rpc.nfsd: Squelch DNS errors when >> using --host option". >> >> getaddrinfo(3) returns a list of addresses, some of which are >> IPv6 addresses. It gets the list from /etc/hosts, or DNS. Even >> on kernels which do not support IPv6, there may be at least one >> IPv6 address in the list. >> >> nfssvc_setfds() then loops over this list. The error handling >> in nfssvc_setfds() causes the loop to exit if the socket(2) >> call fails. It should "continue" if the error is EAFNOSUPPORT. >> In fact, that xlog notice can also be removed. >> >> I'm traveling this week. Is this enough for you to generate a >> fix? > > Yes, that works: > > --- > From: Christoph Hellwig > Subject: nfsd: ignore unsupported address types in nfssvc_setfds > > Just continue and try a different record returned from getaddrinfo > if the kernel does not support an address family. This fixes nfsd > startup on kernels without IPv6 support. > > Suggested-by: Chuck Lever > Signed-off-by: Christoph Hellwig Sorry it took so long... committed! steved. > > diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c > index a2b11d8..fc11d23 100644 > --- a/utils/nfsd/nfssvc.c > +++ b/utils/nfsd/nfssvc.c > @@ -174,15 +174,14 @@ nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port) > sockfd = socket(addr->ai_family, addr->ai_socktype, > addr->ai_protocol); > if (sockfd < 0) { > - if (errno == EAFNOSUPPORT) > - xlog(L_NOTICE, "address family %s not " > - "supported by protocol %s", > - family, proto); > - else > + if (errno != EAFNOSUPPORT) { > xlog(L_ERROR, "unable to create %s %s socket: " > "errno %d (%m)", family, proto, errno); > - rc = errno; > - goto error; > + rc = errno; > + goto error; > + } > + addr = addr->ai_next; > + continue; > } > #ifdef IPV6_SUPPORTED > if (addr->ai_family == AF_INET6 && >