[Midnightbsd-cvs] src [8472] trunk/usr.sbin/mountd/mountd.c: add -S flag to mound that allows suspend of nfsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 18 18:25:53 EDT 2016


Revision: 8472
          http://svnweb.midnightbsd.org/src/?rev=8472
Author:   laffer1
Date:     2016-09-18 18:25:53 -0400 (Sun, 18 Sep 2016)
Log Message:
-----------
add -S flag to mound that allows suspend of nfsd

Modified Paths:
--------------
    trunk/usr.sbin/mountd/mountd.c

Modified: trunk/usr.sbin/mountd/mountd.c
===================================================================
--- trunk/usr.sbin/mountd/mountd.c	2016-09-18 22:25:22 UTC (rev 8471)
+++ trunk/usr.sbin/mountd/mountd.c	2016-09-18 22:25:53 UTC (rev 8472)
@@ -246,6 +246,7 @@
 static int	*sock_fd;
 static int	sock_fdcnt;
 static int	sock_fdpos;
+static int	suspend_nfsd = 0;
 
 int opt_flags;
 static int have_v6 = 1;
@@ -311,7 +312,7 @@
 	else
 		close(s);
 
-	while ((c = getopt(argc, argv, "2deh:lnop:r")) != -1)
+	while ((c = getopt(argc, argv, "2deh:lnop:rS")) != -1)
 		switch (c) {
 		case '2':
 			force_v2 = 1;
@@ -363,6 +364,9 @@
 				out_of_mem();
 			}
 			break;
+		case 'S':
+			suspend_nfsd = 1;
+			break;
 		default:
 			usage();
 		};
@@ -921,7 +925,7 @@
 {
 	fprintf(stderr,
 		"usage: mountd [-2] [-d] [-e] [-l] [-n] [-p <port>] [-r] "
-		"[-h <bindip>] [export_file ...]\n");
+		"[-S] [-h <bindip>] [export_file ...]\n");
 	exit(1);
 }
 
@@ -1660,6 +1664,8 @@
 	int done;
 	struct nfsex_args eargs;
 
+	if (suspend_nfsd != 0)
+		(void)nfssvc(NFSSVC_SUSPENDNFSD, NULL);
 	v4root_dirpath[0] = '\0';
 	bzero(&export, sizeof(export));
 	export.ex_flags = MNT_DELEXPORT;
@@ -1790,6 +1796,9 @@
 	 */
 	if (run_v4server > 0 && has_publicfh == 0)
 		(void) nfssvc(NFSSVC_NOPUBLICFH, NULL);
+
+	/* Resume the nfsd. If they weren't suspended, this is harmless. */
+	(void)nfssvc(NFSSVC_RESUMENFSD, NULL);
 }
 
 /*



More information about the Midnightbsd-cvs mailing list