* [PATCH 1/3] mount.nfs: Continue to trying address when the server return ENOENT
@ 2012-11-26 20:17 Steve Dickson
2012-11-26 20:17 ` [PATCH 2/3] mount.nfs: error message clean up Steve Dickson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Steve Dickson @ 2012-11-26 20:17 UTC (permalink / raw)
To: Linux NFS Mailing list
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(-)
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;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] mount.nfs: error message clean up.
2012-11-26 20:17 [PATCH 1/3] mount.nfs: Continue to trying address when the server return ENOENT Steve Dickson
@ 2012-11-26 20:17 ` Steve Dickson
2012-11-26 20:17 ` [PATCH 3/3] mountd: Return ENOENT when an export does not exist Steve Dickson
2012-11-27 16:53 ` [PATCH 1/3] mount.nfs: Continue to trying address when the server return ENOENT Steve Dickson
2 siblings, 0 replies; 4+ messages in thread
From: Steve Dickson @ 2012-11-26 20:17 UTC (permalink / raw)
To: Linux NFS Mailing list
Remove a unnecessary newline in an error message.
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/mount/error.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/mount/error.c b/utils/mount/error.c
index 83ad1d2..f8fc13f 100644
--- a/utils/mount/error.c
+++ b/utils/mount/error.c
@@ -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"),
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] mountd: Return ENOENT when an export does not exist.
2012-11-26 20:17 [PATCH 1/3] mount.nfs: Continue to trying address when the server return ENOENT Steve Dickson
2012-11-26 20:17 ` [PATCH 2/3] mount.nfs: error message clean up Steve Dickson
@ 2012-11-26 20:17 ` Steve Dickson
2012-11-27 16:53 ` [PATCH 1/3] mount.nfs: Continue to trying address when the server return ENOENT Steve Dickson
2 siblings, 0 replies; 4+ messages in thread
From: Steve Dickson @ 2012-11-26 20:17 UTC (permalink / raw)
To: Linux NFS Mailing list
When an export does not exist, ENOENT should be
returned instead of EACCES
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/mountd/auth.c | 11 ++++++++++-
utils/mountd/mountd.c | 5 ++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/utils/mountd/auth.c b/utils/mountd/auth.c
index 508040a..c81c3a8 100644
--- a/utils/mountd/auth.c
+++ b/utils/mountd/auth.c
@@ -232,7 +232,7 @@ auth_authenticate(const char *what, const struct sockaddr *caller,
char *p = NULL;
char buf[INET6_ADDRSTRLEN];
struct addrinfo *ai = NULL;
- enum auth_error error = bad_path;
+ enum auth_error error = bad_path, first_error = success;
if (path[0] != '/') {
xlog(L_WARNING, "Bad path in %s request from %s: \"%s\"",
@@ -258,7 +258,15 @@ auth_authenticate(const char *what, const struct sockaddr *caller,
p = strrchr(epath, '/');
if (p == epath) p++;
*p = '\0';
+ /*
+ * Recored the first error, ignoring the error when "/"
+ * is tried and fails
+ */
+ if (first_error == success)
+ first_error = error;
}
+ if (first_error != success)
+ error = first_error;
switch (error) {
case bad_path:
@@ -277,6 +285,7 @@ auth_authenticate(const char *what, const struct sockaddr *caller,
break;
case not_exported:
+ errno = ENOENT;
xlog(L_WARNING, "refused %s request from %s for %s (%s): not exported",
what, ai->ai_canonname, path, epath);
break;
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 993b6e6..efd4b49 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -472,7 +472,10 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, nfs_export **expret,
/* Now authenticate the intruder... */
exp = auth_authenticate("mount", sap, p);
if (exp == NULL) {
- *error = MNT3ERR_ACCES;
+ if (errno == ENOENT)
+ *error = MNT3ERR_NOENT;
+ else
+ *error = MNT3ERR_ACCES;
return NULL;
}
if (stat(p, &stb) < 0) {
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] mount.nfs: Continue to trying address when the server return ENOENT
2012-11-26 20:17 [PATCH 1/3] mount.nfs: Continue to trying address when the server return ENOENT Steve Dickson
2012-11-26 20:17 ` [PATCH 2/3] mount.nfs: error message clean up Steve Dickson
2012-11-26 20:17 ` [PATCH 3/3] mountd: Return ENOENT when an export does not exist Steve Dickson
@ 2012-11-27 16:53 ` Steve Dickson
2 siblings, 0 replies; 4+ messages in thread
From: Steve Dickson @ 2012-11-27 16:53 UTC (permalink / raw)
To: Steve Dickson; +Cc: Linux NFS Mailing list
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-27 16:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-26 20:17 [PATCH 1/3] mount.nfs: Continue to trying address when the server return ENOENT Steve Dickson
2012-11-26 20:17 ` [PATCH 2/3] mount.nfs: error message clean up Steve Dickson
2012-11-26 20:17 ` [PATCH 3/3] mountd: Return ENOENT when an export does not exist Steve Dickson
2012-11-27 16:53 ` [PATCH 1/3] mount.nfs: Continue to trying address when the server return ENOENT Steve Dickson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).