Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Oct 2014 08:50:02 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273849 - in head: sbin/mount_nfs sys/fs/nfsclient
Message-ID:  <201410300850.s9U8o2s6090624@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Thu Oct 30 08:50:01 2014
New Revision: 273849
URL: https://svnweb.freebsd.org/changeset/base/273849

Log:
  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

Modified:
  head/sbin/mount_nfs/mount_nfs.8
  head/sbin/mount_nfs/mount_nfs.c
  head/sys/fs/nfsclient/nfs_clvfsops.c

Modified: head/sbin/mount_nfs/mount_nfs.8
==============================================================================
--- head/sbin/mount_nfs/mount_nfs.8	Thu Oct 30 08:05:51 2014	(r273848)
+++ head/sbin/mount_nfs/mount_nfs.8	Thu Oct 30 08:50:01 2014	(r273849)
@@ -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 
 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 b
 .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 
 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

Modified: head/sbin/mount_nfs/mount_nfs.c
==============================================================================
--- head/sbin/mount_nfs/mount_nfs.c	Thu Oct 30 08:05:51 2014	(r273848)
+++ head/sbin/mount_nfs/mount_nfs.c	Thu Oct 30 08:50:01 2014	(r273849)
@@ -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

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c	Thu Oct 30 08:05:51 2014	(r273848)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c	Thu Oct 30 08:50:01 2014	(r273849)
@@ -722,15 +722,15 @@ nfs_decode_args(struct mount *mp, struct
 }
 
 static const char *nfs_opts[] = { "from", "nfs_args",
-    "noatime", "noexec", "suiddir", "nosuid", "nosymfollow", "union",
+    "noac", "noatime", "noexec", "suiddir", "nosuid", "nosymfollow", "union",
     "noclusterr", "noclusterw", "multilabel", "acls", "force", "update",
     "async", "noconn", "nolockd", "conn", "lockd", "intr", "rdirplus",
     "readdirsize", "soft", "hard", "mntudp", "tcp", "udp", "wsize", "rsize",
-    "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "resvport",
-    "readahead", "hostname", "timeout", "addr", "fh", "nfsv3", "sec",
-    "principal", "nfsv4", "gssname", "allgssname", "dirpath", "minorversion",
-    "nametimeo", "negnametimeo", "nocto", "noncontigwr", "pnfs",
-    "wcommitsize",
+    "retrans", "actimeo", "acregmin", "acregmax", "acdirmin", "acdirmax",
+    "resvport", "readahead", "hostname", "timeo", "timeout", "addr", "fh",
+    "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath",
+    "minorversion", "nametimeo", "negnametimeo", "nocto", "noncontigwr",
+    "pnfs", "wcommitsize",
     NULL };
 
 /*
@@ -815,6 +815,12 @@ nfs_mount(struct mount *mp)
 	}
 
 	/* Handle the new style options. */
+	if (vfs_getopt(mp->mnt_optnew, "noac", NULL, NULL) == 0) {
+		args.acdirmin = args.acdirmax =
+		    args.acregmin = args.acregmax = 0;
+		args.flags |= NFSMNT_ACDIRMIN | NFSMNT_ACDIRMAX |
+		    NFSMNT_ACREGMIN | NFSMNT_ACREGMAX;
+	}
 	if (vfs_getopt(mp->mnt_optnew, "noconn", NULL, NULL) == 0)
 		args.flags |= NFSMNT_NOCONN;
 	if (vfs_getopt(mp->mnt_optnew, "conn", NULL, NULL) == 0)
@@ -930,6 +936,18 @@ nfs_mount(struct mount *mp)
 		}
 		args.flags |= NFSMNT_RETRANS;
 	}
+	if (vfs_getopt(mp->mnt_optnew, "actimeo", (void **)&opt, NULL) == 0) {
+		ret = sscanf(opt, "%d", &args.acregmin);
+		if (ret != 1 || args.acregmin < 0) {
+			vfs_mount_error(mp, "illegal actimeo: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.acdirmin = args.acdirmax = args.acregmax = args.acregmin;
+		args.flags |= NFSMNT_ACDIRMIN | NFSMNT_ACDIRMAX |
+		    NFSMNT_ACREGMIN | NFSMNT_ACREGMAX;
+	}
 	if (vfs_getopt(mp->mnt_optnew, "acregmin", (void **)&opt, NULL) == 0) {
 		ret = sscanf(opt, "%d", &args.acregmin);
 		if (ret != 1 || args.acregmin < 0) {
@@ -979,6 +997,16 @@ nfs_mount(struct mount *mp)
 		}
 		args.flags |= NFSMNT_WCOMMITSIZE;
 	}
+	if (vfs_getopt(mp->mnt_optnew, "timeo", (void **)&opt, NULL) == 0) {
+		ret = sscanf(opt, "%d", &args.timeo);
+		if (ret != 1 || args.timeo <= 0) {
+			vfs_mount_error(mp, "illegal timeo: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_TIMEO;
+	}
 	if (vfs_getopt(mp->mnt_optnew, "timeout", (void **)&opt, NULL) == 0) {
 		ret = sscanf(opt, "%d", &args.timeo);
 		if (ret != 1 || args.timeo <= 0) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410300850.s9U8o2s6090624>