Skip to contentSkip to conversation

The final patches for mountd IPv6 support

PATCH In review Chuck Lever 2 participants 9 messages Sep 20, 2010 – Sep 28, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover The final patches for mountd IPv6 support

Hi Steve-

Here's the last set of patches implementing basic IPv6 support for mountd. This set enables mountd to listen on IPv6 transports, if they are available.

I've done a little re-arranging of Neil's recent changes to control the MNT version, in order to make my changes easier; hopefully you guys won't mind that.

Also included here is an overhaul of rpc.mountd(8).

As a last step, I enable IPv6 support in rpc.nfsd again. This should make NFS server-side IPv6 support, in both user space and in the kernel, complete.

I'm sure there will be bug fixes, but hopefully this is the last of these for a while.

---

Chuck Lever (7):
nfsd: Enable IPv6 support in rpc.nfsd again.
mountd: Update mountd/exportfs man pages to reflect IPv6 changes
mountd: Use MNT status values instead of NFSERR
mountd: Fix up version and usage messages
mountd: Unregister mountd if my_svc_run() returns
mountd: Support TI-RPC mountd listener
mountd: Make NFS version checks more strict

 utils/exportfs/exportfs.man |  287 ++++++++++++++++++++++---------------------
 utils/exportfs/exports.man  |   88 ++++++++-----
 utils/mountd/mountd.c       |  136 ++++++++++++++------
 utils/mountd/mountd.man     |  240 +++++++++++++++++++++++-------------
 utils/nfsd/nfsd.c           |    9 -
 utils/nfsd/nfssvc.c         |    9 -
 6 files changed, 445 insertions(+), 324 deletions(-)
Signature · 1 line
Chuck Lever
#1 lore raw

PATCH 1/7 mountd: Make NFS version checks more strict

Ensure users and programmers specify NFS version numbers correctly. This also makes the next patch more clean.

---

 utils/mountd/mountd.c |   47 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 39 insertions(+), 8 deletions(-)
utils/mountd/mountd.c +39 -8
index 982b06e..753fd37 100644
@@ -71,16 +71,34 @@ static struct option longopts[] =
 	{ NULL, 0, 0, 0 }
 };
 
-static int nfs_version = -1;
+#define NFSVERSBIT(vers)	(0x1 << (vers - 1))
+#define NFSVERSBIT_ALL		(NFSVERSBIT(2) | NFSVERSBIT(3) | NFSVERSBIT(4))
+
+static int nfs_version = NFSVERSBIT_ALL;
+
+static int version2(void)
+{
+	return nfs_version & NFSVERSBIT(2);
+}
+
+static int version3(void)
+{
+	return nfs_version & NFSVERSBIT(3);
+}
+
+static int version_any(void)
+{
+	return nfs_version & NFSVERSBIT_ALL;
+}
 
 static void
 unregister_services (void)
 {
-	if (nfs_version & (0x1 << 1)) {
+	if (version2()) {
 		pmap_unset (MOUNTPROG, MOUNTVERS);
 		pmap_unset (MOUNTPROG, MOUNTVERS_POSIX);
 	}
-	if (nfs_version & (0x1 << 2))
+	if (version3())
 		pmap_unset (MOUNTPROG, MOUNTVERS_NFSV3);
 }
 
@@ -673,6 +691,7 @@ main(int argc, char **argv)
 	int	port = 0;
 	int	descriptors = 0;
 	int	c;
+	int	vers;
 	struct sigaction sa;
 	struct rlimit rlim;
 
@@ -716,7 +735,13 @@ main(int argc, char **argv)
 			}
 			break;
 		case 'N':
-			nfs_version &= ~(1 << (atoi (optarg) - 1));
+			vers = atoi(optarg);
+			if (vers < 2 || vers > 4) {
+				fprintf(stderr, "%s: bad version number: %s\n",
+					argv[0], optarg);
+				usage(argv[0], 1);
+			}
+			nfs_version &= ~NFSVERSBIT(vers);
 			break;
 		case 'n':
 			_rpcfdtype = SOCK_DGRAM;
@@ -735,7 +760,13 @@ main(int argc, char **argv)
 			num_threads = atoi (optarg);
 			break;
 		case 'V':
-			nfs_version |= 1 << (atoi (optarg) - 1);
+			vers = atoi(optarg);
+			if (vers < 2 || vers > 4) {
+				fprintf(stderr, "%s: bad version number: %s\n",
+					argv[0], optarg);
+				usage(argv[0], 1);
+			}
+			nfs_version |= NFSVERSBIT(vers);
 			break;
 		case 'v':
 			printf("kmountd %s\n", VERSION);
@@ -750,7 +781,7 @@ main(int argc, char **argv)
 	/* No more arguments allowed.
 	 * Require at least one valid version (2, 3, or 4)
 	 */
-	if (optind != argc || !(nfs_version & 0xE))
+	if (optind != argc || !version_any())
 		usage(argv [0], 1);
 
 	if (chdir(state_dir)) {
@@ -798,13 +829,13 @@ main(int argc, char **argv)
 	if (new_cache)
 		cache_open();
 
-	if (nfs_version & (0x1 << 1)) {
+	if (version2()) {
 		rpc_init("mountd", MOUNTPROG, MOUNTVERS,
 			 mount_dispatch, port);
 		rpc_init("mountd", MOUNTPROG, MOUNTVERS_POSIX,
 			 mount_dispatch, port);
 	}
-	if (nfs_version & (0x1 << 2))
+	if (version3())
 		rpc_init("mountd", MOUNTPROG, MOUNTVERS_NFSV3,
 			 mount_dispatch, port);
 
#2 lore raw

PATCH 2/7 mountd: Support TI-RPC mountd listener

In reply to Chuck Lever

If TI-RPC is available, use it to create mountd's svc listener. If not, use the old function, rpc_init(), to create mountd's listener.

IPv6 can be supported if TI-RPC is available. In this case, /etc/netconfig is searched to determine which transports to advertise.

---

 utils/mountd/mountd.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)
utils/mountd/mountd.c +17 -9
index 753fd37..a4fdcc8 100644
@@ -86,6 +86,11 @@ static int version3(void)
 	return nfs_version & NFSVERSBIT(3);
 }
 
+static int version23(void)
+{
+	return nfs_version & (NFSVERSBIT(2) | NFSVERSBIT(3));
+}
+
 static int version_any(void)
 {
 	return nfs_version & NFSVERSBIT_ALL;
@@ -95,11 +100,11 @@ static void
 unregister_services (void)
 {
 	if (version2()) {
-		pmap_unset (MOUNTPROG, MOUNTVERS);
-		pmap_unset (MOUNTPROG, MOUNTVERS_POSIX);
+		nfs_svc_unregister(MOUNTPROG, MOUNTVERS);
+		nfs_svc_unregister(MOUNTPROG, MOUNTVERS_POSIX);
 	}
 	if (version3())
-		pmap_unset (MOUNTPROG, MOUNTVERS_NFSV3);
+		nfs_svc_unregister(MOUNTPROG, MOUNTVERS_NFSV3);
 }
 
 static void
@@ -687,6 +692,7 @@ main(int argc, char **argv)
 {
 	char	*export_file = _PATH_EXPORTS;
 	char    *state_dir = NFS_STATEDIR;
+	unsigned int listeners = 0;
 	int	foreground = 0;
 	int	port = 0;
 	int	descriptors = 0;
@@ -830,14 +836,16 @@ main(int argc, char **argv)
 		cache_open();
 
 	if (version2()) {
-		rpc_init("mountd", MOUNTPROG, MOUNTVERS,
-			 mount_dispatch, port);
-		rpc_init("mountd", MOUNTPROG, MOUNTVERS_POSIX,
-			 mount_dispatch, port);
+		listeners += nfs_svc_create("mountd", MOUNTPROG,
+					MOUNTVERS, mount_dispatch, port);
+		listeners += nfs_svc_create("mountd", MOUNTPROG,
+					MOUNTVERS_POSIX, mount_dispatch, port);
 	}
 	if (version3())
-		rpc_init("mountd", MOUNTPROG, MOUNTVERS_NFSV3,
-			 mount_dispatch, port);
+		listeners += nfs_svc_create("mountd", MOUNTPROG,
+					MOUNTVERS_NFSV3, mount_dispatch, port);
+	if (version23() && listeners == 0)
+		xlog(L_FATAL, "mountd: could not create listeners\n");
 
 	sa.sa_handler = killer;
 	sigaction(SIGINT, &sa, NULL);
#3 lore raw

PATCH 3/7 mountd: Unregister mountd if my_svc_run() returns

In reply to Chuck Lever

Fix a long standing bug: when my_svc_run() returns, mountd should unregister itself with the local rpcbind so that it can subsequently start cleanly.

Log a more helpful error message in this case.

---

 utils/mountd/mountd.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
utils/mountd/mountd.c +2 -1
index a4fdcc8..9c7caf9 100644
@@ -888,7 +888,8 @@ main(int argc, char **argv)
 
 	my_svc_run();
 
-	xlog(L_ERROR, "Ack! Gack! svc_run returned!\n");
+	xlog(L_ERROR, "RPC service loop terminated unexpectedly. Exiting...\n");
+	unregister_services();
 	exit(1);
 }
 
#4 lore raw

PATCH 4/7 mountd: Fix up version and usage messages

In reply to Chuck Lever

Clean up: rpc.mountd is no longer known as kmountd. Use the program's basename rather than the full pathname for the usage message. Display a version message at start up similar to statd's.

---

 utils/mountd/mountd.c |   38 ++++++++++++++++++++++----------------
 1 files changed, 22 insertions(+), 16 deletions(-)
utils/mountd/mountd.c +22 -16
index 9c7caf9..1a14a85 100644
@@ -692,6 +692,7 @@ main(int argc, char **argv)
 {
 	char	*export_file = _PATH_EXPORTS;
 	char    *state_dir = NFS_STATEDIR;
+	char	*progname;
 	unsigned int listeners = 0;
 	int	foreground = 0;
 	int	port = 0;
@@ -701,6 +702,12 @@ main(int argc, char **argv)
 	struct sigaction sa;
 	struct rlimit rlim;
 
+	/* Set the basename */
+	if ((progname = strrchr(argv[0], '/')) != NULL)
+		progname++;
+	else
+		progname = argv[0];
+
 	/* Parse the command line options and arguments. */
 	opterr = 0;
 	while ((c = getopt_long(argc, argv, "o:nFd:f:p:P:hH:N:V:vrs:t:g", longopts, NULL)) != EOF)
@@ -712,8 +719,8 @@ main(int argc, char **argv)
 			descriptors = atoi(optarg);
 			if (descriptors <= 0) {
 				fprintf(stderr, "%s: bad descriptors: %s\n",
-					argv [0], optarg);
-				usage(argv [0], 1);
+					progname, optarg);
+				usage(progname, 1);
 			}
 			break;
 		case 'F':
@@ -729,15 +736,15 @@ main(int argc, char **argv)
 			ha_callout_prog = optarg;
 			break;
 		case 'h':
-			usage(argv [0], 0);
+			usage(progname, 0);
 			break;
 		case 'P':	/* XXX for nfs-server compatibility */
 		case 'p':
 			port = atoi(optarg);
 			if (port <= 0 || port > 65535) {
 				fprintf(stderr, "%s: bad port number: %s\n",
-					argv [0], optarg);
-				usage(argv [0], 1);
+					progname, optarg);
+				usage(progname, 1);
 			}
 			break;
 		case 'N':
@@ -758,7 +765,7 @@ main(int argc, char **argv)
 		case 's':
 			if ((state_dir = xstrdup(optarg)) == NULL) {
 				fprintf(stderr, "%s: xstrdup(%s) failed!\n",
-					argv[0], optarg);
+					progname, optarg);
 				exit(1);
 			}
 			break;
@@ -775,30 +782,28 @@ main(int argc, char **argv)
 			nfs_version |= NFSVERSBIT(vers);
 			break;
 		case 'v':
-			printf("kmountd %s\n", VERSION);
+			printf("%s version " VERSION "\n", progname);
 			exit(0);
 		case 0:
 			break;
 		case '?':
 		default:
-			usage(argv [0], 1);
+			usage(progname, 1);
 		}
 
-	/* No more arguments allowed.
-	 * Require at least one valid version (2, 3, or 4)
-	 */
+	/* No more arguments allowed. */
 	if (optind != argc || !version_any())
-		usage(argv [0], 1);
+		usage(progname, 1);
 
 	if (chdir(state_dir)) {
 		fprintf(stderr, "%s: chdir(%s) failed: %s\n",
-			argv [0], state_dir, strerror(errno));
+			progname, state_dir, strerror(errno));
 		exit(1);
 	}
 
 	if (getrlimit (RLIMIT_NOFILE, &rlim) != 0)
 		fprintf(stderr, "%s: getrlimit (RLIMIT_NOFILE) failed: %s\n",
-				argv [0], strerror(errno));
+				progname, strerror(errno));
 	else {
 		/* glibc sunrpc code dies if getdtablesize > FD_SETSIZE */
 		if ((descriptors == 0 && rlim.rlim_cur > FD_SETSIZE) ||
@@ -808,14 +813,14 @@ main(int argc, char **argv)
 			rlim.rlim_cur = descriptors;
 			if (setrlimit (RLIMIT_NOFILE, &rlim) != 0) {
 				fprintf(stderr, "%s: setrlimit (RLIMIT_NOFILE) failed: %s\n",
-					argv [0], strerror(errno));
+					progname, strerror(errno));
 				exit(1);
 			}
 		}
 	}
 	/* Initialize logging. */
 	if (!foreground) xlog_stderr(0);
-	xlog_open("mountd");
+	xlog_open(progname);
 
 	sa.sa_handler = SIG_IGN;
 	sa.sa_flags = 0;
@@ -886,6 +891,7 @@ main(int argc, char **argv)
 	if (num_threads > 1)
 		fork_workers();
 
+	xlog(L_NOTICE, "Version " VERSION " starting");
 	my_svc_run();
 
 	xlog(L_ERROR, "RPC service loop terminated unexpectedly. Exiting...\n");
#5 lore raw

PATCH 5/7 mountd: Use MNT status values instead of NFSERR

In reply to Chuck Lever

Clean up: The MNT protocol has its own enum type defining error status values. While the values can be the same as the NFSERR enum type on some systems, it's not guaranteed to be true everywhere.

---

 utils/mountd/mountd.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
utils/mountd/mountd.c +11 -11
index 1a14a85..d309950 100644
@@ -474,27 +474,27 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, nfs_export **expret,
 	/* Now authenticate the intruder... */
 	exp = auth_authenticate("mount", sap, p);
 	if (exp == NULL) {
-		*error = NFSERR_ACCES;
+		*error = MNT3ERR_ACCES;
 		return NULL;
 	}
 	if (stat(p, &stb) < 0) {
 		xlog(L_WARNING, "can't stat exported dir %s: %s",
 				p, strerror(errno));
 		if (errno == ENOENT)
-			*error = NFSERR_NOENT;
+			*error = MNT3ERR_NOENT;
 		else
-			*error = NFSERR_ACCES;
+			*error = MNT3ERR_ACCES;
 		return NULL;
 	}
 	if (!S_ISDIR(stb.st_mode) && !S_ISREG(stb.st_mode)) {
 		xlog(L_WARNING, "%s is not a directory or regular file", p);
-		*error = NFSERR_NOTDIR;
+		*error = MNT3ERR_NOTDIR;
 		return NULL;
 	}
 	if (stat(exp->m_export.e_path, &estb) < 0) {
 		xlog(L_WARNING, "can't stat export point %s: %s",
 		     p, strerror(errno));
-		*error = NFSERR_NOENT;
+		*error = MNT3ERR_NOENT;
 		return NULL;
 	}
 	if (estb.st_dev != stb.st_dev
@@ -502,7 +502,7 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, nfs_export **expret,
 			   || !(exp->m_export.e_flags & NFSEXP_CROSSMOUNT))) {
 		xlog(L_WARNING, "request to export directory %s below nearest filesystem %s",
 		     p, exp->m_export.e_path);
-		*error = NFSERR_ACCES;
+		*error = MNT3ERR_ACCES;
 		return NULL;
 	}
 	if (exp->m_export.e_mountpoint &&
@@ -511,7 +511,7 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, nfs_export **expret,
 				  exp->m_export.e_path)) {
 		xlog(L_WARNING, "request to export an unmounted filesystem: %s",
 		     p);
-		*error = NFSERR_NOENT;
+		*error = MNT3ERR_NOENT;
 		return NULL;
 	}
 
@@ -522,12 +522,12 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, nfs_export **expret,
 		 */
 
 		if (cache_export(exp, p)) {
-			*error = NFSERR_ACCES;
+			*error = MNT3ERR_ACCES;
 			return NULL;
 		}
 		fh = cache_get_filehandle(exp, v3?64:32, p);
 		if (fh == NULL) {
-			*error = NFSERR_ACCES;
+			*error = MNT3ERR_ACCES;
 			return NULL;
 		}
 	} else {
@@ -557,11 +557,11 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, nfs_export **expret,
 
 		if (fh == NULL) {
 			xlog(L_WARNING, "getfh failed: %s", strerror(errno));
-			*error = NFSERR_ACCES;
+			*error = MNT3ERR_ACCES;
 			return NULL;
 		}
 	}
-	*error = NFS_OK;
+	*error = MNT_OK;
 	mountlist_add(host_ntop(sap, buf, sizeof(buf)), p);
 	if (expret)
 		*expret = exp;
#6 lore raw

PATCH 6/7 mountd: Update mountd/exportfs man pages to reflect IPv6 changes

In reply to Chuck Lever

Document IPv6 support in rpc.mountd and exportfs, and clarify existing language in the man page.

Clean up: Use bold consistently for program names, and italics consistently for file names. Use "rpc.mountd" consistently as the name of the mountd daemon.

---

 utils/exportfs/exportfs.man |  287 ++++++++++++++++++++++---------------------
 utils/exportfs/exports.man  |   88 ++++++++-----
 utils/mountd/mountd.man     |  240 +++++++++++++++++++++++-------------
 3 files changed, 354 insertions(+), 261 deletions(-)
utils/exportfs/exportfs.man +147 -140
index c7b230a..089f75b 100644
@@ -1,11 +1,11 @@
+.\"@(#)exportfs.8"
 .\"
-.\" exportfs(8)
-.\" 
 .\" Copyright (C) 1995 Olaf Kirch <[email protected]>
 .\" Modifications 1999-2003 Neil Brown <[email protected]>
-.TH exportfs 8 "18 July 2003"
+.\"
+.TH exportfs 8 "31 December 2009"
 .SH NAME
-exportfs \- maintain list of NFS exported file systems
+exportfs \- maintain table of exported NFS file systems
 .SH SYNOPSIS
 .BI "/usr/sbin/exportfs [-avi] [-o " "options,.." "] [" "client:/path" " ..]
 .br
@@ -18,229 +18,236 @@ exportfs \- maintain list of NFS exported file systems
 .BI "/usr/sbin/exportfs -f"
 .br
 .SH DESCRIPTION
+An NFS server maintains a table of local physical file systems
+that are accessible to NFS clients.
+Each file system in this table is  referred to as an
+.IR "exported file system" ,
+or
+.IR export ,
+for short.
+.PP
 The
 .B exportfs
-command is used to maintain the current table of exported file systems for
-NFS. This list is kept in a separate file named
-.BR /var/lib/nfs/etab
-which is read by
-.B mountd
-when a remote host requests access to mount a file tree, and parts of
-the list which are active are kept in the kernel's export table.
-.P
-Normally this 
-.B etab
-file is initialized with the list of all file systems named in
-.B /etc/exports 
+command maintains the current table of exports for the NFS server.
+The master export table is kept in a file named
+.IR /var/lib/nfs/etab .
+This file is read by
+.B rpc.mountd
+when a client sends an NFS MOUNT request.
+.PP
+Normally the master export table is initialized with the contents of
+.I /etc/exports
 by invoking
 .BR "exportfs -a" .
-.P
-However, administrators can choose to add and delete individual file systems
-without modifying
-.B /etc/exports
-using
-.BR exportfs .
-.P
+However, a system administrator can choose to add or delete
+exports without modifying
+.I /etc/exports
+by using the
+.B exportfs
+command.
+.PP
 .B exportfs
-and it's partner program
-.B mountd
-work in one of two modes, a legacy mode which applies to 2.4 and
+and its partner program
+.B rpc.mountd
+work in one of two modes: a legacy mode which applies to 2.4 and
 earlier versions of the Linux kernel, and a new mode which applies to
-2.6 and later versions providing the
+2.6 and later versions, providing the
 .B nfsd
 virtual filesystem has been mounted at
-.B /proc/fs/nfsd
+.I /proc/fs/nfsd
 or
-.BR /proc/fs/nfs .
-If this filesystem is not mounted in 2.6, the legacy mode is used.
-.P
+.IR /proc/fs/nfs .
+On 2.6 kernels, if this filesystem is not mounted, the legacy mode is used.
+.PP
 In the new mode,
 .B exportfs
-does not give any information to the kernel but only provides it to
-.B mountd
+does not give any information to the kernel, but provides it only to
+.B rpc.mountd
 through the
-.B /var/lib/nfs/etab
+.I /var/lib/nfs/etab
 file.
-.B mountd
-will listen to requests from the kernel and will provide information
-as needed.
-.P
+.B rpc.mountd
+then manages kernel requests for information about exports, as needed.
+.PP
 In the legacy mode,
-any export requests which identify a specific host (rather than a
-subnet or netgroup etc) are entered directly into the kernel's export
-table as well as being written to
-.BR /var/lib/nfs/etab .
-Further, any mount points listed in
-.B /var/lib/nfs/rmtab
+exports which identify a specific host, rather than a subnet or netgroup,
+are entered directly into the kernel's export table,
+as well as being written to
+.IR /var/lib/nfs/etab .
+Further, exports listed in
+.I /var/lib/nfs/rmtab
 which match a non host-specific export request will cause an
 appropriate export entry for the host given in
-.B rmtab
-to be entered
-into the kernel's export table.
+.I rmtab
+to be added to the kernel's export table.
 .SH OPTIONS
-.TP 
+.TP
 .B -a
 Export or unexport all directories.
 .TP
 .BI "-o " options,...
 Specify a list of export options in the same manner as in
-.BR exports(5) .
+.BR exports (5).
 .TP
 .B -i
 Ignore the
-.B /etc/exports
-file, so that only default options and options given on the command
-line are used.
+.I /etc/exports
+file.  Only default options and options given on the command line are used.
 .TP
 .B -r
-Reexport all directories. It synchronizes /var/lib/nfs/etab
-with /etc/exports. It removes entries in /var/lib/nfs/etab
-which are deleted from /etc/exports, and remove any entries from the
+Reexport all directories, synchronizing
+.I /var/lib/nfs/etab
+with
+.IR /etc/exports .
+This option removes entries in
+.I /var/lib/nfs/etab
+which have been deleted from
+.I /etc/exports, and removes any entries from the
 kernel export table which are no longer valid.
 .TP
 .B -u
 Unexport one or more directories.
 .TP
 .B -f
-In 'new' mode, flush everything out of the kernels export table. Any
-clients that are active will get new entries added by
-.B mountd
-when they make their next request.
+If
+.I /proc/fs/nfsd
+or
+.I /proc/fs/nfs
+is mounted, flush everything out of the kernel's export table.
+Fresh entries for active clients are added to the kernel's export table by
+.B rpc.mountd
+when they make their next NFS mount request.
 .TP
 .B -v
 Be verbose. When exporting or unexporting, show what's going on. When
 displaying the current export list, also display the list of export
 options.
 .SH DISCUSSION
-.\" -------------------- Exporting Directories --------------------
 .SS Exporting Directories
-The first synopsis shows how to invoke the command when adding new
-entries to the export table.  When using 
+The first synopsis shows how to invoke
+.B exportfs
+when adding new entries to the export table.  When using
 .BR "exportfs -a" ,
-all directories in
-.B exports(5)
+all exports listed in
+.I /etc/exports
 are added to
-.B etab
-and the resulting list is pushed into the kernel.
-.P
+.IR /var/lib/nfs/etab .
+The kernel's export table is also updated as needed.
+.PP
 The
 .I host:/path
-argument specifies the directory to export along with the host or hosts to
-export it to. All formats described in
+argument specifies a local directory to export,
+along with the client or clients who are permitted to access it.
+See
 .B exports(5)
-are supported; to export a directory to the world, simply specify
+for a description of supported options and access list formats.
+To export a directory to the world, simply specify
 .IR :/path .
-.P
+.PP
 The export options for a particular host/directory pair derive from
-several sources.  There is a set of default options which can be overridden by
-entries in
-.B /etc/exports
-(unless the
-.B -i
-option is given).
-In addition, the administrator may override any options from these sources
-using the
+several sources.
+The default export options are
+.BR sync,ro,root_squash,wdelay .
+These can be overridden by entries in
+.IR /etc/exports .
+.PP
+A system administrator may override options from these sources using the
 .B -o
-argument which takes a comma-separated list of options in the same fashion
+command-line option on
+.BR exportfs .
+This option takes a comma-separated list of options in the same fashion
 as one would specify them in
-.BR exports(5) .
-Thus,
+.IR /etc/exports .
+In this way
 .B exportfs
-can also be used to modify the export options of an already exported
-directory.
-.P
-Modifications of the kernel export table used by
-.B nfsd(8)
-take place immediately after parsing the command line and updating the
-.B etab
-file.
-.P
-The default export options are
-.BR sync,ro,root_squash,wdelay .
-.\" -------------------- Unexporting Directories ------------------
+can be used to modify the export options of an already exported directory.
 .SS Unexporting Directories
 The third synopsis shows how to unexported a currently exported directory.
 When using
 .BR "exportfs -ua" ,
 all entries listed in
-.B etab
+.I /var/lib/nfs/etab
 are removed from the kernel export tables, and the file is cleared. This
 effectively shuts down all NFS activity.
-.P
-To remove an export to a host, specify a
+.PP
+To remove an export, specify a
 .I host:/path
 pair. This deletes the specified entry from
-.B etab
+.I /var/lib/nfs/etab
 and removes the corresponding kernel entry (if any).
-To remove one or more exports to several hosts, use
-.BR "exportfs -ua" .
-.P
-.\" -------------------- Dumping the Export Table -----------------
-.SS Dumping the Export Table 
+.PP
+.SS Dumping the Export Table
 Invoking
 .B exportfs
-without further options shows the current list of exported file systems.
-When giving the
+without options shows the current list of exported file systems.
+Adding the
 .B -v
-option, the list of flags pertaining to each export are shown in addition.
-.\" -------------------- EXAMPLES ---------------------------------
+option causes
+.B exportfs
+to display the export options for each export.
 .SH EXAMPLES
 The following adds all directories listed in
-.B /etc/exports
+.I /etc/exports
 to
-.B /var/lib/nfs/etab
+.I /var/lib/nfs/etab
 and pushes the resulting export entries into the kernel:
-.P
+.PP
 .nf
 .B "# exportfs -a
 .fi
-.P
+.PP
 To export the
-.B /usr/tmp
-directory to host 
+.I /usr/tmp
+directory to host
 .BR django ,
-allowing asynchronous writes, one would do this:
-.P
+allowing insecure file locking requests from clients:
+.PP
 .nf
-.B "# exportfs -o async django:/usr/tmp
+.B "# exportfs -o insecure_locks django:/usr/tmp
 .fi
-.P
+.PP
 To unexport the
-.B /usr/tmp
+.I /usr/tmp
 directory:
-.P
+.PP
 .nf
 .B "# exportfs -u django:/usr/tmp
 .fi
-.P
-To unexport all the directories listed in
-.B /etc/exports:
-.P
+.PP
+To unexport all exports listed in
+.IR /etc/exports :
+.PP
 .nf
 .B "# exportfs -au
 .fi
-.\" -------------------- DEPENDENCIES -----------------------------
-.SH DEPENDENCIES
-Exporting to IP networks, DNS and NIS domains does not enable clients
-from these groups to access NFS immediately; rather, these sorts of
-exports are hints to
-.B mountd(8)
+.SH USAGE NOTES
+Exporting to IP networks or DNS and NIS domains does not enable clients
+from these groups to access NFS immediately.
+Rather, these sorts of exports are hints to
+.BR rpc.mountd (8)
 to grant any mount requests from these clients.
-This is usually not a big problem, because any existing mounts are preserved
-in
-.B rmtab
+This is usually not a problem, because any existing mounts are preserved in
+.I rmtab
 across reboots.
-.P
+.PP
 When unexporting a network or domain entry, any current exports to members
 of this group will be checked against the remaining valid exports and
 if they themselves are no longer valid they will be removed.
-.P
-.\" -------------------- SEE ALSO --------------------------------
+.SH FILES
+.TP 2.5i
+.I /etc/exports
+input file listing exports, export options, and access control lists
+.TP 2.5i
+.I /var/lib/nfs/etab
+master table of exports
+.TP 2.5i
+.I /var/lib/nfs/rmtab
+table of clients accessing server's exports
 .SH SEE ALSO
-.BR exports(5) ", " mountd(8)
-.\" -------------------- AUTHOR ----------------------------------
+.BR exports (5),
+.BR rpc.mountd (8),
+.BR netgroup (5)
 .SH AUTHORS
-Olaf Kirch, <[email protected]>
+Olaf Kirch <[email protected]>
 .br
-Neil Brown, <[email protected]>
-
+Neil Brown <[email protected]>
utils/exportfs/exports.man +53 -35

191 lines not on this page · raw message

utils/mountd/mountd.man +154 -86

293 lines not on this page · raw message

#7 lore raw

PATCH 7/7 nfsd: Enable IPv6 support in rpc.nfsd again.

In reply to Chuck Lever

Revert commit b2a3cd59 so that rpc.nfsd can create IPv6 listener sockets for the kernel.

---

 utils/nfsd/nfsd.c   |    9 ---------
 utils/nfsd/nfssvc.c |    9 ---------
 2 files changed, 0 insertions(+), 18 deletions(-)
utils/nfsd/nfsd.c +0 -9
index 658b8fa..e7e1470 100644
@@ -27,15 +27,6 @@
 #include "nfssvc.h"
 #include "xlog.h"
 
-/*
- * IPv6 support for nfsd was finished before some of the other daemons (mountd
- * and statd in particular). That could be a problem in the future if someone
- * were to boot a kernel that supports IPv6 serving with  an older nfs-utils. For
- * now, hardcode the IPv6 switch into the off position until the other daemons
- * are functional.
- */
-#undef IPV6_SUPPORTED
-
 static void	usage(const char *);
 
 static struct option longopts[] =
utils/nfsd/nfssvc.c +0 -9
index 7693626..ea36399 100644
@@ -24,15 +24,6 @@
 #include "nfslib.h"
 #include "xlog.h"
 
-/*
- * IPv6 support for nfsd was finished before some of the other daemons (mountd
- * and statd in particular). That could be a problem in the future if someone
- * were to boot a kernel that supports IPv6 serving with an older nfs-utils. For
- * now, hardcode the IPv6 switch into the off position until the other daemons
- * are functional.
- */
-#undef IPV6_SUPPORTED
-
 #ifndef NFSD_FS_DIR
 #define NFSD_FS_DIR	  "/proc/fs/nfsd"
 #endif

A message that is not in the archive (sent off-list or not yet received): 20100920162616.3170.24625.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org

#9 lore raw
Quoted 31 lines · Chuck Lever

Hi Steve-

Here's the last set of patches implementing basic IPv6 support for mountd. This set enables mountd to listen on IPv6 transports, if they are available.

I've done a little re-arranging of Neil's recent changes to control the MNT version, in order to make my changes easier; hopefully you guys won't mind that.

Also included here is an overhaul of rpc.mountd(8).

As a last step, I enable IPv6 support in rpc.nfsd again. This should make NFS server-side IPv6 support, in both user space and in the kernel, complete.

I'm sure there will be bug fixes, but hopefully this is the last of these for a while.

---

Chuck Lever (7):
nfsd: Enable IPv6 support in rpc.nfsd again.
mountd: Update mountd/exportfs man pages to reflect IPv6 changes
mountd: Use MNT status values instead of NFSERR
mountd: Fix up version and usage messages
mountd: Unregister mountd if my_svc_run() returns
mountd: Support TI-RPC mountd listener
mountd: Make NFS version checks more strict

Quoted 8 lines
 utils/exportfs/exportfs.man |  287 ++++++++++++++++++++++---------------------
 utils/exportfs/exports.man  |   88 ++++++++-----
 utils/mountd/mountd.c       |  136 ++++++++++++++------
 utils/mountd/mountd.man     |  240 +++++++++++++++++++++++-------------
 utils/nfsd/nfsd.c           |    9 -
 utils/nfsd/nfssvc.c         |    9 -
 6 files changed, 445 insertions(+), 324 deletions(-)

All seven committed...

steved.