[PATCH] retry for NFS v3 mounts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mounting an NFS v3 volume from a server that is currently down,
immediately fails with a timeout error, instead of retrying:

# mount -t nfs -v -overs=3,proto=udp,bg server:/foo /mnt
mount.nfs: trying text-based options 'vers=3,proto=udp,bg,addr=172.17.2.94'
mount.nfs: prog 100003, trying vers=3, prot=17
mount.nfs: portmap query failed: RPC: Timed out

mount.nfs: mount to NFS server 'server:/foo' failed: timed out, giving up

# mount -t nfs -v -overs=3,proto=tcp,bg server:/foo /mnt
mount.nfs: trying text-based options 'vers=3,proto=tcp,bg,addr=172.17.2.94'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: portmap query failed: RPC: Remote system error - No route to host

mount.nfs: No route to host

As a result, NFS mounts may not come up after a power failure when the
client boots faster than the server. The attached patch for nfs-utils
adds ESPIPE to the list of errors considered temporary, so that the
mount will be retried:

# mount -t nfs -v -overs=3,proto=udp,bg server:/foo /mnt
mount.nfs: trying text-based options 'vers=3,proto=udp,bg,addr=172.17.2.94'
mount.nfs: prog 100003, trying vers=3, prot=17
mount.nfs: portmap query failed: RPC: Timed out

mount.nfs: backgrounding "server:/foo"
mount.nfs: mount options: "vers=3,proto=udp,bg,addr=172.17.2.94"

# mount -t nfs -v -overs=3,proto=tcp,bg server:/foo /mnt
mount.nfs: trying text-based options 'vers=3,proto=tcp,bg,addr=172.17.2.94'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: portmap query failed: RPC: Remote system error - No route to host

mount.nfs: backgrounding "server:/foo"
mount.nfs: mount options: "vers=3,proto=tcp,bg,addr=172.17.2.94"

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 4032bf3..7ca0b3e 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -663,6 +663,7 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi)
 		case ECONNREFUSED:
 		case EOPNOTSUPP:
 		case EHOSTUNREACH:
+		case ESPIPE:
 			continue;
 		default:
 			goto out;
@@ -848,6 +849,7 @@ static int nfs_is_permanent_error(int error)
 	case ETIMEDOUT:
 	case ECONNREFUSED:
 	case EHOSTUNREACH:
+	case ESPIPE:
 		return 0;	/* temporary */
 	default:
 		return 1;	/* permanent */

-- 
Dick

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


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux