From d140ecd680057af241267a4e27144a9c980fc8cf Mon Sep 17 00:00:00 2001 From: trasz Date: Thu, 30 Oct 2014 08:50:01 +0000 Subject: Add support for "timeo", "actimeo", "noac", and "proto" options to mount_nfs(8). They are implemented on Linux, OS X, and Solaris, and thus can be expected to appear in automounter maps. Reviewed by: rmacklem@ MFC after: 1 month Sponsored by: The FreeBSD Foundation --- sbin/mount_nfs/mount_nfs.8 | 18 +++++++++++++++++- sbin/mount_nfs/mount_nfs.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) (limited to 'sbin/mount_nfs') diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8 index 124ba7d..55080e9 100644 --- a/sbin/mount_nfs/mount_nfs.8 +++ b/sbin/mount_nfs/mount_nfs.8 @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd August 5, 2014 +.Dd October 30, 2014 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -118,6 +118,8 @@ for regular files, and 30 -> 60 seconds for directories. The algorithm to calculate the timeout is based on the age of the file. The older the file, the longer the cache is considered valid, subject to the limits above. +.It Cm actimeo Ns = Ns Aq Ar seconds +Set four cache timeouts above to specified value. .It Cm allgssname This option can be used along with .Fl o Cm gssname @@ -211,6 +213,8 @@ NFS Version 4 protocol. This option is only meaningful when used with the .Cm minorversion option. +.It Cm noac +Disable attribute caching. .It Cm noconn For UDP mount points, do not do a .Xr connect 2 . @@ -282,6 +286,15 @@ use a reserved socket port number (see below). .It Cm port Ns = Ns Aq Ar port_number Use specified port number for NFS requests. The default is to query the portmapper for the NFS port. +.It Cm proto Ns = Ns Aq Ar protocol +Specify transport protocol version to use. +Currently, they are: +.Bd -literal +udp - Use UDP over IPv4 +tcp - Use TCP over IPv4 +udp6 - Use UDP over IPv6 +tcp6 - Use TCP over IPv6 +.Ed .It Cm rdirplus Used with NFSV3 to specify that the \fBReaddirPlus\fR RPC should be used. @@ -369,6 +382,9 @@ value if there is a low retransmit rate but long response delay observed. option should be specified when using this option to manually tune the timeout interval.) +.It Cm timeo Ns = Ns Aq Ar value +Alias for +.Cm timeout . .It Cm udp Use UDP transport. .It Cm vers Ns = Ns Aq Ar vers_number diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index 754c893..6914a03 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -282,6 +282,35 @@ main(int argc, char *argv[]) err(1, "asprintf"); } else if (strcmp(opt, "principal") == 0) { got_principal = 1; + } else if (strcmp(opt, "proto") == 0) { + pass_flag_to_nmount=0; + if (strcmp(val, "tcp") == 0) { + nfsproto = IPPROTO_TCP; + opflags |= OF_NOINET6; + build_iovec(&iov, &iovlen, + "tcp", NULL, 0); + } else if (strcmp(val, "udp") == 0) { + mnttcp_ok = 0; + nfsproto = IPPROTO_UDP; + opflags |= OF_NOINET6; + build_iovec(&iov, &iovlen, + "udp", NULL, 0); + } else if (strcmp(val, "tcp6") == 0) { + nfsproto = IPPROTO_TCP; + opflags |= OF_NOINET4; + build_iovec(&iov, &iovlen, + "tcp", NULL, 0); + } else if (strcmp(val, "udp6") == 0) { + mnttcp_ok = 0; + nfsproto = IPPROTO_UDP; + opflags |= OF_NOINET4; + build_iovec(&iov, &iovlen, + "udp", NULL, 0); + } else { + errx(1, + "illegal proto value -- %s", + val); + } } else if (strcmp(opt, "sec") == 0) { /* * Don't add this option to -- cgit v1.1