svn commit: r321062 - projects/pnfs-planb-server/usr.sbin/nfsd

Rick Macklem rmacklem at FreeBSD.org
Sun Jul 16 21:07:59 UTC 2017


Author: rmacklem
Date: Sun Jul 16 21:07:58 2017
New Revision: 321062
URL: https://svnweb.freebsd.org/changeset/base/321062

Log:
  Fix the nfsd so that it handles the nfssvc() return error of ENXIO for a
  misconfigured "-p" option.

Modified:
  projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c

Modified: projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c
==============================================================================
--- projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c	Sun Jul 16 21:03:58 2017	(r321061)
+++ projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c	Sun Jul 16 21:07:58 2017	(r321062)
@@ -90,6 +90,7 @@ static int	debug = 0;
 #define NFS_VER3	 3
 #define NFS_VER4	 4
 static pid_t children[MAXNFSDCNT]; /* PIDs of children */
+static pid_t masterpid;		   /* PID of master/parent */
 static int nfsdcnt;		/* number of children */
 static int nfsdcnt_set;
 static int minthreads;
@@ -458,6 +459,7 @@ main(int argc, char **argv)
 		 * kernel nfsd thread. The kernel will add more
 		 * threads as needed.
 		 */
+		masterpid = getpid();
 		pid = fork();
 		if (pid == -1) {
 			syslog(LOG_ERR, "fork: %m");
@@ -1061,7 +1063,12 @@ start_server(int master, struct nfsd_nfsd_args *nfsdar
 		error = nfssvc(nfssvc_nfsd, nfsdargp);
 	}
 	if (error < 0) {
-		syslog(LOG_ERR, "nfssvc: %m");
+		if (errno == ENXIO) {
+			syslog(LOG_ERR, "Bad -p option, cannot run");
+			if (masterpid != 0 && master == 0)
+				kill(masterpid, SIGUSR1);
+		} else
+			syslog(LOG_ERR, "nfssvc: %m");
 		status = 1;
 	}
 	if (master)


More information about the svn-src-projects mailing list