The two most recent diffs here:
http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/mountd/mountd.c?only_with_tag=MAIN
Here's the referenced PR:
https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=48282
Essentially, we daemonize after rather than before registering the
service.
Diff below. Is anyone running an NFS server on -current willing to test?
Index: mountd.c
===================================================================
RCS file: /cvs/src/sbin/mountd/mountd.c,v
retrieving revision 1.81
diff -u -p -r1.81 mountd.c
--- mountd.c 20 Aug 2015 22:16:35 -0000 1.81
+++ mountd.c 2 Nov 2015 06:12:12 -0000
@@ -242,6 +242,24 @@ main(int argc, char *argv[])
get_mountlist();
if (debug)
fprintf(stderr, "Here we go.\n");
+
+ signal(SIGHUP, (void (*)(int)) new_exportlist);
+ signal(SIGTERM, (void (*)(int)) send_umntall);
+ signal(SIGSYS, SIG_IGN);
+ if ((udptransp = svcudp_create(RPC_ANYSOCK)) == NULL ||
+ (tcptransp = svctcp_create(RPC_ANYSOCK, 0, 0)) == NULL) {
+ syslog(LOG_ERR, "Can't create socket");
+ exit(1);
+ }
+ pmap_unset(RPCPROG_MNT, RPCMNT_VER1);
+ pmap_unset(RPCPROG_MNT, RPCMNT_VER3);
+ if (!svc_register(udptransp, RPCPROG_MNT, RPCMNT_VER1, mntsrv,
IPPROTO_UDP) ||
+ !svc_register(udptransp, RPCPROG_MNT, RPCMNT_VER3, mntsrv,
IPPROTO_UDP) ||
+ !svc_register(tcptransp, RPCPROG_MNT, RPCMNT_VER1, mntsrv,
IPPROTO_TCP) ||
+ !svc_register(tcptransp, RPCPROG_MNT, RPCMNT_VER3, mntsrv,
IPPROTO_TCP)) {
+ syslog(LOG_ERR, "Can't register mount");
+ exit(1);
+ }
if (debug == 0) {
daemon(0, 0);
signal(SIGINT, SIG_IGN);
@@ -263,24 +281,6 @@ main(int argc, char *argv[])
if (pidfile) {
fprintf(pidfile, "%ld\n", (long)getpid());
fclose(pidfile);
- }
-
- signal(SIGHUP, (void (*)(int)) new_exportlist);
- signal(SIGTERM, (void (*)(int)) send_umntall);
- signal(SIGSYS, SIG_IGN);
- if ((udptransp = svcudp_create(RPC_ANYSOCK)) == NULL ||
- (tcptransp = svctcp_create(RPC_ANYSOCK, 0, 0)) == NULL) {
- syslog(LOG_ERR, "Can't create socket");
- exit(1);
- }
- pmap_unset(RPCPROG_MNT, RPCMNT_VER1);
- pmap_unset(RPCPROG_MNT, RPCMNT_VER3);
- if (!svc_register(udptransp, RPCPROG_MNT, RPCMNT_VER1, mntsrv,
IPPROTO_UDP) ||
- !svc_register(udptransp, RPCPROG_MNT, RPCMNT_VER3, mntsrv,
IPPROTO_UDP) ||
- !svc_register(tcptransp, RPCPROG_MNT, RPCMNT_VER1, mntsrv,
IPPROTO_TCP) ||
- !svc_register(tcptransp, RPCPROG_MNT, RPCMNT_VER3, mntsrv,
IPPROTO_TCP)) {
- syslog(LOG_ERR, "Can't register mount");
- exit(1);
}
mountd_svc_run();
syslog(LOG_ERR, "Mountd died");