diff mbox

[1/3] mount.nfs: Continue to trying address when the server return ENOENT

Message ID 1353961029-6317-1-git-send-email-steved@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Dickson Nov. 26, 2012, 8:17 p.m. UTC
With recent changes to the /etc/hosts file, the 'localhost'
is now multiply defined as both an IPv4 address (127.0.01)
and an IPv6 address (::1). This change causes first address
returned by getaddrinfo('localhost') to be the IPv6 address
instead of the IPv4 address.

The change in the default 'localhost' address type causes
existing exports using '127.0.0.1' to fail, because the
'::1' address is tried first and fails. The problem
being not all the addresses that are returned by
getaddrinfo('localhost') are tried.

So this patch allows that address list to continue to be
process when the 'ENOENT' error is returned by the server.

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/mount/stropts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Steve Dickson Nov. 27, 2012, 4:53 p.m. UTC | #1
Hello,

On 26/11/12 15:17, Steve Dickson wrote:
> With recent changes to the /etc/hosts file, the 'localhost'
> is now multiply defined as both an IPv4 address (127.0.01)
> and an IPv6 address (::1). This change causes first address
> returned by getaddrinfo('localhost') to be the IPv6 address
> instead of the IPv4 address.
> 
> The change in the default 'localhost' address type causes
> existing exports using '127.0.0.1' to fail, because the
> '::1' address is tried first and fails. The problem
> being not all the addresses that are returned by
> getaddrinfo('localhost') are tried.
> 
> So this patch allows that address list to continue to be
> process when the 'ENOENT' error is returned by the server.
> 
> Signed-off-by: Steve Dickson <steved@redhat.com>
After further review and some chat on IRC (thanks Frank!) using
EACCES, instead of ENOENT, to cause the next address to be tried 
is much more straightforward and simpler... V2 is on the way...

steved.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 9b4197b..1119f39 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -666,6 +666,7 @@  static int nfs_try_mount_v3v2(struct nfsmount_info *mi)
 		case EOPNOTSUPP:
 		case EHOSTUNREACH:
 		case ETIMEDOUT:
+		case ENOENT:
 			continue;
 		default:
 			goto out;
@@ -756,11 +757,11 @@  static int nfs_try_mount_v4(struct nfsmount_info *mi)
 		ret = nfs_do_mount_v4(mi, ai->ai_addr, ai->ai_addrlen);
 		if (ret != 0)
 			return ret;
-
 		switch (errno) {
 		case ECONNREFUSED:
 		case EHOSTUNREACH:
 		case ETIMEDOUT:
+		case ENOENT:
 			continue;
 		default:
 			goto out;