Subject: Re: Transient MNT_* flags left in mp->mnt_flag ?
To: Christos Zoulas <christos@zoulas.com>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 10/13/2003 10:04:25
--Apple-Mail-3--289363876
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
On Sunday, October 12, 2003, at 10:48 AM, Christos Zoulas wrote:
> I think you are right. How about MNT_DELEXPORT? And MNT_WANTRDWR is
> an internal flag. Should that be cleared?
MNT_DELEXPORT is never set in mp->mnt_flags -- it's only in the export
arguments (the mount flags are a real mess :-/).
MNT_WANTRDWR should be cleared, yes, because it indicates a transient
condition: a transition from read-only to read-write is wanted. Note
it is already cleared in the existing MNT_UPDATE case.
> Also mount.h mentions MNT_MLOCK that does not exist and should probably
> be removed.
Yah, I deleted that comment.
> Finally maybe all these flags belong in something like
> #define MNT_COMMAND_FLAGS (MNT_UPDATE | MNT_RELOAD | MNT_FORCE | ...)
I'm not sure. I'd like to see the outcome of Darrin's mount flags
discussion before doing this. In the mean time, I restructured the
code very slightly to make it more obvious as to what is being
set/cleared in various places.
Updated patch attached.
-- Jason R. Thorpe <thorpej@wasabisystems.com>
--Apple-Mail-3--289363876
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 -u -r1.194 vfs_syscalls.c
--- vfs_syscalls.c 13 Sep 2003 08:32:14 -0000 1.194
+++ vfs_syscalls.c 13 Oct 2003 17:01:27 -0000
@@ -179,7 +179,7 @@
SCARG(uap, flags) != MNT_GETARGS &&
SCARG(uap, flags) !=
(mp->mnt_flag | MNT_RDONLY |
- MNT_RELOAD | MNT_FORCE | MNT_UPDATE)) {
+ MNT_RELOAD | MNT_FORCE | MNT_UPDATE)) {
vput(vp);
return (EPERM);
}
@@ -323,8 +323,8 @@
if (error || (mp->mnt_flag & MNT_GETARGS))
mp->mnt_flag = flag;
mp->mnt_flag &=~
- (MNT_UPDATE | MNT_RELOAD | MNT_FORCE | MNT_WANTRDWR |
- MNT_GETARGS);
+ (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_GETARGS |
+ MNT_WANTRDWR);
if ((mp->mnt_flag & (MNT_RDONLY | MNT_ASYNC)) == 0) {
if (mp->mnt_syncer == NULL)
error = vfs_allocate_syncvnode(mp);
@@ -342,6 +342,9 @@
*/
cache_purge(vp);
if (!error) {
+ mp->mnt_flag &=~
+ (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_GETARGS |
+ MNT_WANTRDWR);
vp->v_mountedhere = mp;
simple_lock(&mountlist_slock);
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
--Apple-Mail-3--289363876--