Subject: Transient MNT_* flags left in mp->mnt_flag ?
To: None <tech-kern@netbsd.org>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 10/12/2003 09:33:55
--Apple-Mail-3--377593722
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

Hi folks...

 From my reading of sys_mount(), it appears as if transient "action" 
flags can be left lingering in the mount structure.  For example, it 
seems like if you mount a file system with "mount -f ..." (sets the 
MNT_FORCE flag), and then later do a "mount -u ..." (MNT_UPDATE), you 
can end up with FORCECLOSE being set in ffs_mount(), even though that 
may not be what you want.

Attached is a patch that should fix this problem.  But I'd like an 
extra set of eyes or two to look over this to make sure I'm not missing 
something.

         -- Jason R. Thorpe <thorpej@wasabisystems.com>

--Apple-Mail-3--377593722
Content-Disposition: attachment;
	filename=mnt-patch.txt
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	x-unix-mode=0644;
	name="mnt-patch.txt"

Index: vfs_syscalls.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_syscalls.c,v
retrieving revision 1.194
diff -c -r1.194 vfs_syscalls.c
*** vfs_syscalls.c	13 Sep 2003 08:32:14 -0000	1.194
--- vfs_syscalls.c	12 Oct 2003 16:27:27 -0000
***************
*** 342,347 ****
--- 342,350 ----
  	 */
  	cache_purge(vp);
  	if (!error) {
+ 		mp->mnt_flag &=~
+ 		    (MNT_UPDATE | MNT_RELOAD | MNT_FORCE | MNT_WANTRDWR |
+ 		     MNT_GETARGS);
  		vp->v_mountedhere = mp;
  		simple_lock(&mountlist_slock);
  		CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);

--Apple-Mail-3--377593722--