Skip to contentSkip to conversation

mount.nfs: try the next address after mount fails with ETIMEDOUT

PATCH In review Jeff Layton 3 participants 5 messages May 31, 2012 – Jun 19, 2012

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

PATCH 1/1 mount.nfs: try the next address after mount fails with ETIMEDOUT

If a NFS mount attempt fails with an ETIMEDOUT error, the mount.nfs code doesn't currently attempt the next address in the list. For a NFSv4 mount the initial mount() call almost always ends up going over NFS_DEF_FG_TIMEOUT_MINUTES and the mount is never retried.

For a v3 mount, it ends up continually retrying against the same IPv6 address, and never tries the IPv4 address. Eventually it gives up once it hits the NFS_DEF_FG_TIMEOUT_MINUTES timeout.

It's possible that a server is just unreachable via IPv6 (due to a routing misconfiguration for instance), or is dropping IPv6 frames on the floor. In that situation, it might still be reachable via IPv4 and trying the next address could have allowed the mount to succeed.

Fix this by treating ETIMEDOUT in a similar fashion to ECONNREFUSED. Have the client try the next address in the list before giving up and returning an error.

Our QA folks noticed this after a routing problem in one of our test labs. I was able to reproduce it by having the server drop incoming IPv6 frames from the client's address.

With this patch, the mount eventually succeeds over IPv4 instead of returning an error.

---
 utils/mount/stropts.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
utils/mount/stropts.c +2 -0
index e09aa7c..0aa9a75 100644
@@ -665,6 +665,7 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi)
 		case ECONNREFUSED:
 		case EOPNOTSUPP:
 		case EHOSTUNREACH:
+		case ETIMEDOUT:
 			continue;
 		default:
 			goto out;
@@ -752,6 +753,7 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi)
 		switch (errno) {
 		case ECONNREFUSED:
 		case EHOSTUNREACH:
+		case ETIMEDOUT:
 			continue;
 		default:
 			goto out;
Signature · 1 line
1.7.1
#1 lore raw
Quoted 9 lines · Jeff Layton

If a NFS mount attempt fails with an ETIMEDOUT error, the mount.nfs code doesn't currently attempt the next address in the list. For a NFSv4 mount the initial mount() call almost always ends up going over NFS_DEF_FG_TIMEOUT_MINUTES and the mount is never retried.

For a v3 mount, it ends up continually retrying against the same IPv6 address, and never tries the IPv4 address. Eventually it gives up once it hits the NFS_DEF_FG_TIMEOUT_MINUTES timeout.

Quoted 8 lines

It's possible that a server is just unreachable via IPv6 (due to a routing misconfiguration for instance), or is dropping IPv6 frames on the floor. In that situation, it might still be reachable via IPv4 and trying the next address could have allowed the mount to succeed.

Fix this by treating ETIMEDOUT in a similar fashion to ECONNREFUSED. Have the client try the next address in the list before giving up and returning an error.

Bzzzzt. AF fallback is only legal to do if the admin did not specify a netid.

Can you demonstrate that your patch works correctly if an IPv6 netid is specified? "Correctly" here means that no fallback occurs.

Quoted 36 lines

Our QA folks noticed this after a routing problem in one of our test labs. I was able to reproduce it by having the server drop incoming IPv6 frames from the client's address.

With this patch, the mount eventually succeeds over IPv4 instead of returning an error.

---
utils/mount/stropts.c | 2 ++

1 files changed, 2 insertions(+), 0 deletions(-)
utils/mount/stropts.c +2 -0
index e09aa7c..0aa9a75 100644
@@ -665,6 +665,7 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi)
 		case ECONNREFUSED:
 		case EOPNOTSUPP:
 		case EHOSTUNREACH:
+		case ETIMEDOUT:
 			continue;
 		default:
 			goto out;
@@ -752,6 +753,7 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi)
 		switch (errno) {
 		case ECONNREFUSED:
 		case EHOSTUNREACH:
+		case ETIMEDOUT:
 			continue;
 		default:
 			goto out;
Signature · 1 line
1.7.1
Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
#2 lore raw
Quoted 17 lines · On Thu, 31 May 2012 10:28:49 -0400 Chuck Lever <[email protected]> wrote:
Quoted 14 lines · Jeff Layton

If a NFS mount attempt fails with an ETIMEDOUT error, the mount.nfs code doesn't currently attempt the next address in the list. For a NFSv4 mount the initial mount() call almost always ends up going over NFS_DEF_FG_TIMEOUT_MINUTES and the mount is never retried.

For a v3 mount, it ends up continually retrying against the same IPv6 address, and never tries the IPv4 address. Eventually it gives up once it hits the NFS_DEF_FG_TIMEOUT_MINUTES timeout.

It's possible that a server is just unreachable via IPv6 (due to a routing misconfiguration for instance), or is dropping IPv6 frames on the floor. In that situation, it might still be reachable via IPv4 and trying the next address could have allowed the mount to succeed.

Quoted 8 lines
Quoted 3 lines

Fix this by treating ETIMEDOUT in a similar fashion to ECONNREFUSED. Have the client try the next address in the list before giving up and returning an error.

Bzzzzt. AF fallback is only legal to do if the admin did not specify a netid.

Can you demonstrate that your patch works correctly if an IPv6 netid is specified? "Correctly" here means that no fallback occurs.

If someone specifies an IPv6 netid (via proto= option) then we would set AF_INET6 in the addrinfo "hints" and there will be no IPv4 addresses in the mi->address list. So, this does still work correctly when someone specifies an ipv6 netid.

Chuck also pointed out on IRC that the description was a little unclear, since it was specific to my test rig where the server had a single IPv6 and IPv4 address in DNS.

The loop that retries against different addresses doesn't care about whether the addrs are v4 or v6. What this really tells mount.nfs to do is to keep trying different addresses in the list if there are any instead of giving up on an ETIMEDOUT error.

Signature · 1 line
Jeff Layton <[email protected]>
#3 lore raw
Quoted 34 lines · Jeff Layton
Quoted 17 lines · On Thu, 31 May 2012 10:28:49 -0400 Chuck Lever <[email protected]> wrote:
Quoted 14 lines · Jeff Layton

If a NFS mount attempt fails with an ETIMEDOUT error, the mount.nfs code doesn't currently attempt the next address in the list. For a NFSv4 mount the initial mount() call almost always ends up going over NFS_DEF_FG_TIMEOUT_MINUTES and the mount is never retried.

For a v3 mount, it ends up continually retrying against the same IPv6 address, and never tries the IPv4 address. Eventually it gives up once it hits the NFS_DEF_FG_TIMEOUT_MINUTES timeout.

It's possible that a server is just unreachable via IPv6 (due to a routing misconfiguration for instance), or is dropping IPv6 frames on the floor. In that situation, it might still be reachable via IPv4 and trying the next address could have allowed the mount to succeed.

Quoted 8 lines
Quoted 3 lines

Fix this by treating ETIMEDOUT in a similar fashion to ECONNREFUSED. Have the client try the next address in the list before giving up and returning an error.

Bzzzzt. AF fallback is only legal to do if the admin did not specify a netid.

Can you demonstrate that your patch works correctly if an IPv6 netid is specified? "Correctly" here means that no fallback occurs.

If someone specifies an IPv6 netid (via proto= option) then we would set AF_INET6 in the addrinfo "hints" and there will be no IPv4 addresses in the mi->address list. So, this does still work correctly when someone specifies an ipv6 netid.

Quoted 6 lines

Chuck also pointed out on IRC that the description was a little unclear, since it was specific to my test rig where the server had a single IPv6 and IPv4 address in DNS.

The loop that retries against different addresses doesn't care about whether the addrs are v4 or v6.

Correct.

Moreover, we do get the right behavior because the initial DNS lookup populates the list of addresses to try, based on a specified netid (proto=). Thus, if no netid is specified, the list contains INET and INET6; if a netid is specified, the list contains only one address family. That properly limits the addresses that can be used when mount.nfs retries.

Quoted 10 lines

What this really tells mount.nfs
to do is to keep trying different addresses in the list if there are any instead of giving up on an ETIMEDOUT error.

Signature · 5 lines
Jeff Layton <[email protected]>
--
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
Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
#4 lore raw
In reply to Jeff Layton
Quoted 22 lines · Jeff Layton

If a NFS mount attempt fails with an ETIMEDOUT error, the mount.nfs code doesn't currently attempt the next address in the list. For a NFSv4 mount the initial mount() call almost always ends up going over NFS_DEF_FG_TIMEOUT_MINUTES and the mount is never retried.

For a v3 mount, it ends up continually retrying against the same IPv6 address, and never tries the IPv4 address. Eventually it gives up once it hits the NFS_DEF_FG_TIMEOUT_MINUTES timeout.

It's possible that a server is just unreachable via IPv6 (due to a routing misconfiguration for instance), or is dropping IPv6 frames on the floor. In that situation, it might still be reachable via IPv4 and trying the next address could have allowed the mount to succeed.

Fix this by treating ETIMEDOUT in a similar fashion to ECONNREFUSED. Have the client try the next address in the list before giving up and returning an error.

Our QA folks noticed this after a routing problem in one of our test labs. I was able to reproduce it by having the server drop incoming IPv6 frames from the client's address.

Quoted 5 lines

With this patch, the mount eventually succeeds over IPv4 instead of returning an error.

Committed...

steved.

Quoted 24 lines
---
 utils/mount/stropts.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
utils/mount/stropts.c +2 -0
index e09aa7c..0aa9a75 100644
@@ -665,6 +665,7 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi)
 		case ECONNREFUSED:
 		case EOPNOTSUPP:
 		case EHOSTUNREACH:
+		case ETIMEDOUT:
 			continue;
 		default:
 			goto out;
@@ -752,6 +753,7 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi)
 		switch (errno) {
 		case ECONNREFUSED:
 		case EHOSTUNREACH:
+		case ETIMEDOUT:
 			continue;
 		default:
 			goto out;