1
0
forked from pool/util-linux
util-linux/util-linux-2.12-nfs-tcp.diff

62 lines
1.7 KiB
Diff
Raw Normal View History

--- util-linux-2.12q/mount/nfs.5
+++ util-linux-2.12q/mount/nfs.5
@@ -199,11 +199,11 @@
.TP 1.5i
.I tcp
Mount the NFS filesystem using the TCP protocol instead of the
-default UDP protocol. Many NFS servers only support UDP.
+UDP protocol. This is the default, but in case it fails (many NFS servers only
+support UDP) it will fallback and try UDP.
.TP 1.5i
.I udp
-Mount the NFS filesystem using the UDP protocol. This
-is the default.
+Mount the NFS filesystem using the UDP protocol.
.TP 1.5i
.I noacl
Assume no extended access control mechanisms like POSIX ACLs are used
@@ -227,8 +227,5 @@
The posix, and nocto options are parsed by mount
but currently are silently ignored.
.P
-The tcp and namlen options are implemented but are not currently
-supported by the Linux kernel.
-.P
The umount command should notify the server
when an NFS filesystem is unmounted.
--- util-linux-2.12q/mount/nfsmount.c
+++ util-linux-2.12q/mount/nfsmount.c
@@ -319,7 +319,7 @@
noacl = 0;
noac = 0;
retry = 10000; /* 10000 minutes ~ 1 week */
- tcp = 0;
+ tcp = 2;
mountprog = MOUNTPROG;
mountvers = 0;
@@ -439,6 +439,8 @@
}
}
}
+
+retry_udp:
proto = (tcp) ? IPPROTO_TCP : IPPROTO_UDP;
data.flags = (soft ? NFS_MOUNT_SOFT : 0)
@@ -742,7 +744,13 @@
* '0' for port (service unavailable), we then exit,
* notifying the user, rather than hanging up mount.
*/
- if (port == 0 && tcp == 1) {
+ if (port == 0 && tcp) {
+ if (tcp == 2) {
+ fprintf(stderr, "nfs server reported tcp not available, falling back to udp\n");
+ close(fsock);
+ tcp = 0;
+ goto retry_udp;
+ }
perror(_("nfs server reported service unavailable"));
goto fail;
}