Subject: Re: Transient MNT_* flags left in mp->mnt_flag ?
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 10/12/2003 17:48:58
In article <DF749B3F-FCD1-11D7-952F-000A957650EC@wasabisystems.com>,
Jason Thorpe <thorpej@wasabisystems.com> wrote:
>-=-=-=-=-=-
>
>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>

I think you are right. How about MNT_DELEXPORT? And MNT_WANTRDWR is
an internal flag. Should that be cleared? 

Also mount.h mentions MNT_MLOCK that does not exist and should probably
be removed.

Finally maybe all these flags belong in something like
#define MNT_COMMAND_FLAGS (MNT_UPDATE | MNT_RELOAD | MNT_FORCE | ...)

christos
>
>-=-=-=-=-=-
>
>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);
>
>-=-=-=-=-=-