Skip to contentSkip to conversation

mount.nfs: Continue to trying address when the server return EACCES

PATCH In review Steve Dickson 1 participant 4 messages Nov 27, 2012 – Nov 28, 2012

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

PATCH v2 1/2 mount.nfs: Continue to trying address when the server return EACCES

With recent changes to the /etc/hosts file, the 'localhost' host name is now multiply defined as both an IPv4 address (127.0.01) and an IPv6 address (::1). This 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 is not all the addresses in the address list are being tried.

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

---
 utils/mount/stropts.c | 2 ++
 1 file changed, 2 insertions(+)
utils/mount/stropts.c +2 -0
index 9b4197b..8ee3024 100644
@@ -666,6 +666,7 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi)
 		case EOPNOTSUPP:
 		case EHOSTUNREACH:
 		case ETIMEDOUT:
+		case EACCES:
 			continue;
 		default:
 			goto out;
@@ -761,6 +762,7 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi)
 		case ECONNREFUSED:
 		case EHOSTUNREACH:
 		case ETIMEDOUT:
+		case EACCES:
 			continue;
 		default:
 			goto out;
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH v2 2/2 mount.nfs: error message clean up.

Remove a unnecessary newline in an error message.

---
 utils/mount/error.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utils/mount/error.c +1 -1
index 83ad1d2..f8fc13f 100644
@@ -225,7 +225,7 @@ void mount_error(const char *spec, const char *mount_point, int error)
 	case ENOENT:
 		if (spec)
 			nfs_error(_("%s: mounting %s failed, "
-				"reason given by server:\n  %s"),
+				"reason given by server: %s"),
 				progname, spec, strerror(error));
 		else
 			nfs_error(_("%s: mount point %s does not exist"),
Signature · 1 line
1.7.11.7
#2 lore raw

Re: [PATCH 2/2 V2] mount.nfs: error message clean up.

Quoted 7 lines · Steve Dickson

Remove a unnecessary newline in an error message.

---
 utils/mount/error.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Committed....

steved.

Quoted 14 lines
utils/mount/error.c +1 -1
index 83ad1d2..f8fc13f 100644
@@ -225,7 +225,7 @@ void mount_error(const char *spec, const char *mount_point, int error)
 	case ENOENT:
 		if (spec)
 			nfs_error(_("%s: mounting %s failed, "
-				"reason given by server:\n  %s"),
+				"reason given by server: %s"),
 				progname, spec, strerror(error));
 		else
 			nfs_error(_("%s: mount point %s does not exist"),
#3 lore raw
In reply to Steve Dickson
Quoted 11 lines · Steve Dickson

With recent changes to the /etc/hosts file, the 'localhost' host name is now multiply defined as both an IPv4 address (127.0.01) and an IPv6 address (::1). This 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 is not all the addresses in the address list are being tried.

Quoted 4 lines

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

Committed...

steved.

Quoted 25 lines
---
 utils/mount/stropts.c | 2 ++
 1 file changed, 2 insertions(+)
utils/mount/stropts.c +2 -0
index 9b4197b..8ee3024 100644
@@ -666,6 +666,7 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi)
 		case EOPNOTSUPP:
 		case EHOSTUNREACH:
 		case ETIMEDOUT:
+		case EACCES:
 			continue;
 		default:
 			goto out;
@@ -761,6 +762,7 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi)
 		case ECONNREFUSED:
 		case EHOSTUNREACH:
 		case ETIMEDOUT:
+		case EACCES:
 			continue;
 		default:
 			goto out;