Skip to contentSkip to conversation

nfs-utils regression on IPv6-less kernels

DISCUSSION Christoph Hellwig 3 participants 9 messages Aug 10, 2015 – Oct 30, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Steve,

since commit "ipv6: Enable IPv6 support by default." rpc.mountd fails to start on a kernel without IPv6 support. Seems like it doesn't have a proper fallback if an address family isn't implemented.

#1 lore raw

Hey,

Quoted 6 lines · Christoph Hellwig

Hi Steve,

since commit "ipv6: Enable IPv6 support by default." rpc.mountd fails to start on a kernel without IPv6 support. Seems like it doesn't have a proper fallback if an address family isn't implemented.

hmm... What do you mean "fails to start"... are there any error messages? If nfs-utils is compiled with the --disable_ipv6 flag, does the same problem happen?

Note, I'm going on holiday for the next couple weeks so my response time might be a bit spotty...

steved.

#2 lore raw
Quoted 1 line · Steve Dickson

hmm... What do you mean "fails to start"... are there any error messages?

[....] Starting NFS kernel daemon: nfsdrpc.nfsd: address family AF_INET6 not supported by protocol TCP
rpc.nfsd: unable to set any sockets for nfsd
failed!

And then any attempts to mount from this machine fail.

Quoted 2 lines

If nfs-utils is compiled with the --disable_ipv6 flag, does the same problem happen?

No, that fixes it.

#3 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 1 line · Steve Dickson

hmm... What do you mean "fails to start"... are there any error messages?

[....] Starting NFS kernel daemon: nfsdrpc.nfsd: address family AF_INET6 not supported by protocol TCP
rpc.nfsd: unable to set any sockets for nfsd
failed!

Quoted 6 lines

And then any attempts to mount from this machine fail.

Quoted 2 lines

If nfs-utils is compiled with the --disable_ipv6 flag, does the same problem happen?

No, that fixes it.

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?

--
Chuck Lever

#4 lore raw
Quoted 8 lines · Chuck Lever

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.

Quoted 7 lines

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 <[email protected]>
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.

utils/nfsd/nfssvc.c +6 -7
index a2b11d8..fc11d23 100644
@@ -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 &&
Reviewed-by
#5 lore raw
Quoted 23 lines · Christoph Hellwig
Quoted 8 lines · Chuck Lever

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.

Quoted 7 lines

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 <[email protected]>
Subject: nfsd: ignore unsupported address types in nfssvc_setfds

Quoted 6 lines

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.

Yep, that's what I was thinking.

And maybe add a "Fixes: 2f8a6020of4c rpc.nfsd: yada" at your discretion.

Quoted 16 lines
utils/nfsd/nfssvc.c +1 -5
index a2b11d8..fc11d23 100644
@@ -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);

utils/nfsd/nfssvc.c nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port) · line 187

Quoted 10 lines
utils/nfsd/nfssvc.c +5 -2
-			rc = errno;
-			goto error;
+				rc = errno;
+				goto error;
+			}
+			addr = addr->ai_next;
+			continue;
 		}
 #ifdef IPV6_SUPPORTED
 		if (addr->ai_family == AF_INET6 &&

--
Chuck Lever

#6 lore raw
In reply to Christoph Hellwig
Quoted 23 lines · Christoph Hellwig
Quoted 8 lines · Chuck Lever

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.

Quoted 7 lines

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 <[email protected]>
Subject: nfsd: ignore unsupported address types in nfssvc_setfds

Quoted 6 lines

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.

Sorry it took so long... committed!

steved.

Quoted 28 lines
utils/nfsd/nfssvc.c +6 -7
index a2b11d8..fc11d23 100644
@@ -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 &&
#7 lore raw
Quoted 29 lines · Steve Dickson
Quoted 23 lines · Christoph Hellwig
Quoted 8 lines · Chuck Lever

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.

Quoted 7 lines

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 <[email protected]>
Subject: nfsd: ignore unsupported address types in nfssvc_setfds

Quoted 7 lines
Quoted 6 lines

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.

Sorry it took so long... committed!

I’m pulling from git://linux-nfs.org/nfs-utils but I don’t see this commit. What’s the correct URL to pull from for upstream nfs-utils?

Quoted 26 lines

steved.

Quoted 24 lines
utils/nfsd/nfssvc.c +6 -7
index a2b11d8..fc11d23 100644
@@ -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;
Quoted 8 lines

utils/nfsd/nfssvc.c nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port) · line 187

Quoted 4 lines
utils/nfsd/nfssvc.c +0 -0
 		}
 #ifdef IPV6_SUPPORTED
 		if (addr->ai_family == AF_INET6 &&

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

—
Chuck Lever

#8 lore raw
Quoted 33 lines · Chuck Lever
Quoted 33 lines · Steve Dickson
Quoted 27 lines · Christoph Hellwig
Quoted 8 lines · Chuck Lever

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.

Quoted 7 lines

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 <[email protected]>
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.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Sorry it took so long... committed!

I’m pulling from git://linux-nfs.org/nfs-utils but I don’t see this commit. What’s the correct URL to pull from for upstream nfs-utils?

Well it is Halloween so maybe a spook got or I did the commit and forgot to do the push... One of those two happen! ;-)

Its there now... Sorry for the confusion...

steved.

Quoted 42 lines
Quoted 28 lines

steved.

Quoted 24 lines
utils/nfsd/nfssvc.c +6 -7
index a2b11d8..fc11d23 100644
@@ -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;
Quoted 8 lines

utils/nfsd/nfssvc.c nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port) · line 187

Quoted 4 lines
utils/nfsd/nfssvc.c +0 -0
 		}
 #ifdef IPV6_SUPPORTED
 		if (addr->ai_family == AF_INET6 &&

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

—
Chuck Lever