NetBSD Problem Report #8791
Received: (qmail 27855 invoked from network); 14 Nov 1999 04:31:50 -0000
Message-Id: <19991114043133.AA7482415@towers-of-dub.eterna.com.au>
Date: Sun, 14 Nov 1999 15:31:33 +1100 (EST)
From: mrg@eterna.com.au
Reply-To: mrg@eterna.com.au
To: gnats-bugs@gnats.netbsd.org
Subject: mountd is bozotic
X-Send-Pr-Version: 3.95
>Number: 8791
>Category: bin
>Synopsis: mountd is bozotic
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Nov 13 20:33:01 +0000 1999
>Closed-Date: Thu Jul 29 02:29:54 +0000 2010
>Last-Modified: Thu Jul 29 02:29:54 +0000 2010
>Originator: matthew green
>Release: 19991109
>Organization:
people's front against (bozotic) www (softwar foundation)
>Environment:
System: NetBSD towers-of-dub.eterna.com.au 1.4M NetBSD 1.4M (_towers_) #25: Wed Nov 10 23:51:03 EST 1999 mrg@towers-of-dub.eterna.com.au:/orb/y/_towers_ alpha
>Description:
before re-reading the exports list (such as on SIGHUP), NetBSD
mountd(8) traveses the current mount list removing export from
all these filesystems, then it goes and re-exports them as it
processes /etc/exports.
this leaves a nice time when file systems are not exported and
thus can cause clients to fail. i have had countless builds
fail because of this over the years. it recently started
affected my mp3 player -- things got serious.
>How-To-Repeat:
run "make bulid" on a machine using /usr/src over NFS to a
NetBSD server. run "kill -HUP <mountd.pid>" a Lot until
the make build breaks due to failed permissions check. a
slower NFS server will probably make it easier to reproduce.
>Fix:
restructre the code so that it only un-exports file systems
that require this. this was surprisingly simple and i was
unable to reproduce the lossage previously encountered
with this change (indeed, running it in debug mode showed
what is now correct operation).
Index: mountd.c
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/mountd/mountd.c,v
retrieving revision 1.57
diff -p -c -r1.57 mountd.c
*** mountd.c 1999/09/10 16:20:22 1.57
--- mountd.c 1999/11/14 04:21:36
*************** get_exportlist(n)
*** 823,863 ****
grphead = NULL;
/*
! * And delete exports that are in the kernel for all local
! * file systems.
! * XXX: Should know how to handle all local exportable file systems
! * instead of just MOUNT_FFS.
*/
num = getmntinfo(&fsp, MNT_NOWAIT);
- for (i = 0; i < num; i++) {
- union {
- struct ufs_args ua;
- struct iso_args ia;
- struct mfs_args ma;
- struct msdosfs_args da;
- struct adosfs_args aa;
- } targs;
-
- if (!strncmp(fsp->f_fstypename, MOUNT_MFS, MFSNAMELEN) ||
- !strncmp(fsp->f_fstypename, MOUNT_FFS, MFSNAMELEN) ||
- !strncmp(fsp->f_fstypename, MOUNT_EXT2FS, MFSNAMELEN) ||
- !strncmp(fsp->f_fstypename, MOUNT_MSDOS, MFSNAMELEN) ||
- !strncmp(fsp->f_fstypename, MOUNT_ADOSFS, MFSNAMELEN) ||
- !strncmp(fsp->f_fstypename, MOUNT_NULL, MFSNAMELEN) ||
- !strncmp(fsp->f_fstypename, MOUNT_UMAP, MFSNAMELEN) ||
- !strncmp(fsp->f_fstypename, MOUNT_UNION, MFSNAMELEN) ||
- !strncmp(fsp->f_fstypename, MOUNT_CD9660, MFSNAMELEN) ||
- !strncmp(fsp->f_fstypename, MOUNT_NTFS, MFSNAMELEN)) {
- bzero((char *) &targs, sizeof(targs));
- targs.ua.fspec = NULL;
- targs.ua.export.ex_flags = MNT_DELEXPORT;
- if (mount(fsp->f_fstypename, fsp->f_mntonname,
- fsp->f_flags | MNT_UPDATE, &targs) == -1)
- syslog(LOG_ERR, "Can't delete exports for %s",
- fsp->f_mntonname);
- }
- fsp++;
- }
/*
* Read in the exports file and build the list, calling
--- 823,831 ----
grphead = NULL;
/*
! * save off the current export lists for later
*/
num = getmntinfo(&fsp, MNT_NOWAIT);
/*
* Read in the exports file and build the list, calling
*************** nextline:
*** 1035,1040 ****
--- 1003,1061 ----
free(line);
}
(void)fclose(exp_file);
+
+ /*
+ * Ok, remove any filesystems that existed before that should
+ * not be there anymore.
+ */
+ /*
+ * XXX: Should know how to handle all local exportable file systems
+ * instead of just MOUNT_FFS.
+ */
+ for (i = 0; i < num; i++, fsp++) {
+ union {
+ struct ufs_args ua;
+ struct iso_args ia;
+ struct mfs_args ma;
+ struct msdosfs_args da;
+ struct adosfs_args aa;
+ } targs;
+
+ if (debug)
+ (void)fprintf(stderr,
+ "seeing if we want to delete %s.\n",
+ fsp->f_mntonname);
+ /*
+ * If we can find it in our internal list, we do not
+ * want to delete it from the kernel.
+ */
+ if (ex_search(&fsp->f_fsid))
+ continue;
+
+ if (!strncmp(fsp->f_fstypename, MOUNT_MFS, MFSNAMELEN) ||
+ !strncmp(fsp->f_fstypename, MOUNT_FFS, MFSNAMELEN) ||
+ !strncmp(fsp->f_fstypename, MOUNT_EXT2FS, MFSNAMELEN) ||
+ !strncmp(fsp->f_fstypename, MOUNT_MSDOS, MFSNAMELEN) ||
+ !strncmp(fsp->f_fstypename, MOUNT_ADOSFS, MFSNAMELEN) ||
+ !strncmp(fsp->f_fstypename, MOUNT_NULL, MFSNAMELEN) ||
+ !strncmp(fsp->f_fstypename, MOUNT_UMAP, MFSNAMELEN) ||
+ !strncmp(fsp->f_fstypename, MOUNT_UNION, MFSNAMELEN) ||
+ !strncmp(fsp->f_fstypename, MOUNT_CD9660, MFSNAMELEN) ||
+ !strncmp(fsp->f_fstypename, MOUNT_NTFS, MFSNAMELEN)) {
+ if (debug)
+ (void)fprintf(stderr,
+ "Deleting export for mount %s.\n",
+ fsp->f_mntonname);
+
+ bzero((char *) &targs, sizeof(targs));
+ targs.ua.fspec = NULL;
+ targs.ua.export.ex_flags = MNT_DELEXPORT;
+ if (mount(fsp->f_fstypename, fsp->f_mntonname,
+ fsp->f_flags | MNT_UPDATE, &targs) == -1)
+ syslog(LOG_ERR, "Can't delete exports for %s",
+ fsp->f_mntonname);
+ }
+ }
}
/*
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback
State-Changed-By: sommerfeld
State-Changed-When: Sun Nov 14 06:38:10 PST 1999
State-Changed-Why:
fix from PR applied to -current; pullup request for -release also sent in.
Responsible-Changed-From-To: bin-bug-people->sommerfeld
Responsible-Changed-By: sommerfeld
Responsible-Changed-When: Sun Nov 14 06:38:10 PST 1999
Responsible-Changed-Why:
i committed the fix..
State-Changed-From-To: feedback->open
State-Changed-By: mrg
State-Changed-When: Sun Dec 5 05:12:25 PST 1999
State-Changed-Why:
this is now fixed
State-Changed-From-To: open->closed
State-Changed-By: erh
State-Changed-When: Mon Feb 28 17:09:49 PST 2000
State-Changed-Why:
if it's fixed it should be closed.
State-Changed-From-To: closed->open
State-Changed-By: erh
State-Changed-When: Tue Feb 29 15:28:29 PST 2000
State-Changed-Why:
patch was backed out. might not be fixed anymore. reopen for further study.
Responsible-Changed-From-To: sommerfeld->bin-bug-people
Responsible-Changed-By: sommerfeld
Responsible-Changed-When: Mon Jul 3 05:54:24 PDT 2000
Responsible-Changed-Why:
fix was backed out. "not my problem."
State-Changed-From-To: open->closed
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Thu, 29 Jul 2010 02:29:54 +0000
State-Changed-Why:
ah, all this time this has been a duplicate of PR#5844. no need for
two PRs for the same understood issue.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.