All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: Steve Dickson <SteveD@redhat.com>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: nfs-utils regression on IPv6-less kernels
Date: Mon, 17 Aug 2015 09:06:39 -0700	[thread overview]
Message-ID: <20150817160639.GA1173@infradead.org> (raw)
In-Reply-To: <F810C54A-A075-40D1-9912-80A85A7A0D63@oracle.com>

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 <hch@lst.de>
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 <chuck.lever@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>

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 &&

  reply	other threads:[~2015-08-17 16:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 13:13 nfs-utils regression on IPv6-less kernels Christoph Hellwig
2015-08-11 10:48 ` Steve Dickson
2015-08-17 12:42   ` Christoph Hellwig
2015-08-17 15:40     ` Chuck Lever
2015-08-17 16:06       ` Christoph Hellwig [this message]
2015-08-17 16:09         ` Chuck Lever
2015-09-09 15:47         ` Steve Dickson
2015-10-29 21:22           ` Chuck Lever
2015-10-30 13:22             ` Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150817160639.GA1173@infradead.org \
    --to=hch@infradead.org \
    --cc=SteveD@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.