NetBSD Problem Report #444

From gnats  Mon Aug 29 20:11:20 1994
Received: from excalibur.entropic.com (root@excalibur.entropic.com [192.86.164.105]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id UAA01379 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Mon, 29 Aug 1994 20:10:52 -0700
Message-Id: <199408300311.XAA00650@excalibur.entropic.com>
Date: Mon, 29 Aug 1994 23:11:51 -0400
From: Ken Hornstein <kenh@excalibur.entropic.com>
Reply-To: kenh@entropic.com
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: mount will re-mount filesystems already mounted
X-Send-Pr-Version: 3.2

>Number:         444
>Category:       bin
>Synopsis:       mount will re-mount filesystems already mounted
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 29 20:20:03 +0000 1994
>Closed-Date:    Wed Jul 12 05:24:43 +0000 1995
>Last-Modified:  Sat Aug 19 09:56:01 +0000 1995
>Originator:     Ken Hornstein
>Release:        
>Organization:
"	"
>Environment:

System: NetBSD excalibur 1.0_BETA NetBSD 1.0_BETA (EXCALIBUR) #0: Mon Aug 22 02:11:47 EDT 1994 kenh@excalibur:/usr/src/sys/arch/i386/compile/EXCALIBUR i386


>Description:
Mount will re-mount filesystems when using the "-a" option that are already
mounted.  This is mildly annoying when trying to make a dataless configuration.

>How-To-Repeat:
Put a NFS filesystem in your fstab.  Run "mount -a" twice.

>Fix:

The following patch does an okay job of fixing this problem.

*** mount.c.old	Mon Aug 29 22:26:01 1994
--- mount.c	Mon Aug 29 23:05:45 1994
***************
*** 71,76 ****
--- 71,77 ----
  			int, const char *, const char *));
  void	prmount __P((struct statfs *));
  void	usage __P((void));
+ int	alreadymounted __P((const char *, const char *, const char *));

  /* From mount_ufs.c. */
  int	mount_ufs __P((int, char * const *));
***************
*** 167,172 ****
--- 168,176 ----
  					continue;
  				if (hasopt(fs->fs_mntops, "noauto"))
  					continue;
+ 				if (alreadymounted(fs->fs_spec, fs->fs_file,
+ 				    fs->fs_vfstype))
+ 					continue;
  				if (mountfs(fs->fs_vfstype, fs->fs_spec,
  				    fs->fs_file, init_flags, options,
  				    fs->fs_mntops))
***************
*** 527,530 ****
--- 531,555 ----
  		"[-adfruvw] [-t ufs | external_type]",
  		"[-dfruvw] special | node");
  	exit(1);
+ }
+ 
+ int alreadymounted(fs_spec, fs_file, fs_vfstype)
+ 	const char *fs_spec, *fs_file, *fs_vfstype;
+ {
+ 	struct statfs *mntbuf;
+ 	int i, mntsize;
+ 
+ 	mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
+ 
+ 	for(i = 0; i < mntsize; i++)
+ 		if (strcmp(mntbuf[i].f_mntfromname, fs_spec) == 0 &&
+ 		    strcmp(mntbuf[i].f_mntonname, fs_file) == 0 &&
+ 		    strcmp(mntbuf[i].f_fstypename, fs_vfstype) == 0)
+ 			return(1);
+ 		else if (strncmp(mntbuf[i].f_mntfromname, "mfs:", 4) == 0 &&
+ 			 strcmp(mntbuf[i].f_mntonname, fs_file) == 0 &&
+ 			 strcmp(mntbuf[i].f_fstypename, "mfs") == 0)
+ 			return(1);
+ 
+ 	return(0);
  }
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: cgd 
State-Changed-When: Thu Jun 29 06:08:21 EDT 1995 
State-Changed-Why:  
i've decided how to fix it. 


Responsible-Changed-From-To: gnats-admin->cgd 
Responsible-Changed-By: cgd 
Responsible-Changed-When: Thu Jun 29 06:08:21 EDT 1995 
Responsible-Changed-Why:  
i've claimed it. 
State-Changed-From-To: analyzed->closed 
State-Changed-By: cgd 
State-Changed-When: Wed Jul 12 01:24:43 EDT 1995 
State-Changed-Why:  
fixed, though differently.  there are too many 'strange' cases to allow 
comparison of f_mntfromname. 
Responsible-Changed-From-To: cgd->bin-bug-people 
Responsible-Changed-By: cgd 
Responsible-Changed-When: Sat Aug 19 05:55:37 EDT 1995 
Responsible-Changed-Why:  
remove my name from Responsible line, so future greps for it will fail. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.