Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Nov 2014 15:41:56 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r275249 - in stable/10: sbin/mount_nfs sys/fs/nfsclient
Message-ID:  <201411291541.sATFfujs056925@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sat Nov 29 15:41:55 2014
New Revision: 275249
URL: https://svnweb.freebsd.org/changeset/base/275249

Log:
  MFC r273849:
  
  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.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/10/sbin/mount_nfs/mount_nfs.8
  stable/10/sbin/mount_nfs/mount_nfs.c
  stable/10/sys/fs/nfsclient/nfs_clvfsops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/mount_nfs/mount_nfs.8
==============================================================================
--- stable/10/sbin/mount_nfs/mount_nfs.8	Sat Nov 29 15:39:31 2014	(r275248)
+++ stable/10/sbin/mount_nfs/mount_nfs.8	Sat Nov 29 15:41:55 2014	(r275249)
@@ -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: stable/10/sbin/mount_nfs/mount_nfs.c
==============================================================================
--- stable/10/sbin/mount_nfs/mount_nfs.c	Sat Nov 29 15:39:31 2014	(r275248)
+++ stable/10/sbin/mount_nfs/mount_nfs.c	Sat Nov 29 15:41:55 2014	(r275249)
@@ -284,6 +284,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: stable/10/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- stable/10/sys/fs/nfsclient/nfs_clvfsops.c	Sat Nov 29 15:39:31 2014	(r275248)
+++ stable/10/sys/fs/nfsclient/nfs_clvfsops.c	Sat Nov 29 15:41:55 2014	(r275249)
@@ -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?201411291541.sATFfujs056925>