Subject: Re: kern/29898: mount(2) can corrupt filesystem
To: None <yamt@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 04/06/2005 13:33:01
The following reply was made to PR kern/29898; it has been noted by GNATS.

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: kern/29898: mount(2) can corrupt filesystem
Date: Wed, 6 Apr 2005 09:32:07 -0400

 On Apr 6,  4:30am, yamt@mwd.biglobe.ne.jp (yamt@mwd.biglobe.ne.jp) wrote:
 -- Subject: kern/29898: mount(2) can corrupt filesystem
 
 | 	restructure mount related code so that the caller of
 | 	VFS_MOUNT doesn't need to alter mnt_flag/iflag.
 | 	maybe by adding more arguments to VFS_MOUNT to describe the operation.
 
 Isn't is as simple as doing:
 
 Index: vfs_syscalls.c
 ===================================================================
 RCS file: /cvsroot/src/sys/kern/vfs_syscalls.c,v
 retrieving revision 1.217
 diff -u -u -r1.217 vfs_syscalls.c
 --- vfs_syscalls.c	26 Feb 2005 21:34:56 -0000	1.217
 +++ vfs_syscalls.c	6 Apr 2005 13:30:55 -0000
 @@ -216,7 +216,11 @@
  			vput(vp);
  			return (EPERM);
  		}
 -		goto update;
 +		if (SCARGS(uap, flags) & MNT_GETARGS)
 +			goto getargs;
 +		else
 +			goto update;
 +
  	} else {
  		if (securelevel >= 2) {
  			vput(vp);
 @@ -328,6 +332,7 @@
  	    MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP |
  	    MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP |
  	    MNT_IGNORE);
 + getargs:
  	/*
  	 * Mount the filesystem.
  	 */