vfs_syscalls.c (30994) | vfs_syscalls.c (31132) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 |
39 * $Id: vfs_syscalls.c,v 1.79 1997/10/28 10:29:55 bde Exp $ | 39 * $Id: vfs_syscalls.c,v 1.80 1997/11/06 19:29:30 phk Exp $ |
40 */ 41 42/* 43 * XXX - The following is required because of some magic done 44 * in getdirentries() below which is only done if the translucent 45 * filesystem `UNION' is compiled into the kernel. This is broken, 46 * but I don't have time to study the code deeply enough to understand 47 * what's going on and determine an appropriate fix. -GAW --- 57 unchanged lines hidden (view full) --- 105 syscallarg(char *) path; 106 syscallarg(int) flags; 107 syscallarg(caddr_t) data; 108 } */ *uap; 109{ 110 struct vnode *vp; 111 struct mount *mp; 112 struct vfsconf *vfsp; | 40 */ 41 42/* 43 * XXX - The following is required because of some magic done 44 * in getdirentries() below which is only done if the translucent 45 * filesystem `UNION' is compiled into the kernel. This is broken, 46 * but I don't have time to study the code deeply enough to understand 47 * what's going on and determine an appropriate fix. -GAW --- 57 unchanged lines hidden (view full) --- 105 syscallarg(char *) path; 106 syscallarg(int) flags; 107 syscallarg(caddr_t) data; 108 } */ *uap; 109{ 110 struct vnode *vp; 111 struct mount *mp; 112 struct vfsconf *vfsp; |
113 int error, flag = 0; | 113 int error, flag = 0, flag2 = 0; |
114 struct vattr va; 115 u_long fstypenum; 116 struct nameidata nd; 117 char fstypename[MFSNAMELEN]; 118 119 if (usermount == 0 && (error = suser(p->p_ucred, &p->p_acflag))) 120 return (error); 121 --- 7 unchanged lines hidden (view full) --- 129 vp = nd.ni_vp; 130 if (SCARG(uap, flags) & MNT_UPDATE) { 131 if ((vp->v_flag & VROOT) == 0) { 132 vput(vp); 133 return (EINVAL); 134 } 135 mp = vp->v_mount; 136 flag = mp->mnt_flag; | 114 struct vattr va; 115 u_long fstypenum; 116 struct nameidata nd; 117 char fstypename[MFSNAMELEN]; 118 119 if (usermount == 0 && (error = suser(p->p_ucred, &p->p_acflag))) 120 return (error); 121 --- 7 unchanged lines hidden (view full) --- 129 vp = nd.ni_vp; 130 if (SCARG(uap, flags) & MNT_UPDATE) { 131 if ((vp->v_flag & VROOT) == 0) { 132 vput(vp); 133 return (EINVAL); 134 } 135 mp = vp->v_mount; 136 flag = mp->mnt_flag; |
137 flag2 = mp->mnt_kern_flag; |
|
137 /* 138 * We only allow the filesystem to be reloaded if it 139 * is currently mounted read-only. 140 */ 141 if ((SCARG(uap, flags) & MNT_RELOAD) && 142 ((mp->mnt_flag & MNT_RDONLY) == 0)) { 143 vput(vp); 144 return (EOPNOTSUPP); /* Needs translation */ --- 107 unchanged lines hidden (view full) --- 252 mp->mnt_stat.f_owner = p->p_ucred->cr_uid; 253update: 254 /* 255 * Set the mount level flags. 256 */ 257 if (SCARG(uap, flags) & MNT_RDONLY) 258 mp->mnt_flag |= MNT_RDONLY; 259 else if (mp->mnt_flag & MNT_RDONLY) | 138 /* 139 * We only allow the filesystem to be reloaded if it 140 * is currently mounted read-only. 141 */ 142 if ((SCARG(uap, flags) & MNT_RELOAD) && 143 ((mp->mnt_flag & MNT_RDONLY) == 0)) { 144 vput(vp); 145 return (EOPNOTSUPP); /* Needs translation */ --- 107 unchanged lines hidden (view full) --- 253 mp->mnt_stat.f_owner = p->p_ucred->cr_uid; 254update: 255 /* 256 * Set the mount level flags. 257 */ 258 if (SCARG(uap, flags) & MNT_RDONLY) 259 mp->mnt_flag |= MNT_RDONLY; 260 else if (mp->mnt_flag & MNT_RDONLY) |
260 mp->mnt_flag |= MNT_WANTRDWR; | 261 mp->mnt_kern_flag |= MNTK_WANTRDWR; |
261 mp->mnt_flag &=~ (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | 262 MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME | 263 MNT_NOCLUSTERR | MNT_NOCLUSTERW); 264 mp->mnt_flag |= SCARG(uap, flags) & (MNT_NOSUID | MNT_NOEXEC | 265 MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE | 266 MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW); 267 /* 268 * Mount the filesystem. 269 */ 270 error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p); 271 if (mp->mnt_flag & MNT_UPDATE) { 272 vrele(vp); | 262 mp->mnt_flag &=~ (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | 263 MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME | 264 MNT_NOCLUSTERR | MNT_NOCLUSTERW); 265 mp->mnt_flag |= SCARG(uap, flags) & (MNT_NOSUID | MNT_NOEXEC | 266 MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE | 267 MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW); 268 /* 269 * Mount the filesystem. 270 */ 271 error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p); 272 if (mp->mnt_flag & MNT_UPDATE) { 273 vrele(vp); |
273 if (mp->mnt_flag & MNT_WANTRDWR) | 274 if (mp->mnt_kern_flag & MNTK_WANTRDWR) |
274 mp->mnt_flag &= ~MNT_RDONLY; | 275 mp->mnt_flag &= ~MNT_RDONLY; |
275 mp->mnt_flag &=~ 276 (MNT_UPDATE | MNT_RELOAD | MNT_FORCE | MNT_WANTRDWR); | 276 mp->mnt_flag &=~ (MNT_UPDATE | MNT_RELOAD | MNT_FORCE); 277 mp->mnt_kern_flag &=~ (MNTK_WANTRDWR); |
277 if (error) 278 mp->mnt_flag = flag; | 278 if (error) 279 mp->mnt_flag = flag; |
280 mp->mnt_kern_flag = flag2; |
|
279 vfs_unbusy(mp, p); 280 return (error); 281 } 282 /* 283 * Put the new filesystem on the mount list after root. 284 */ 285 cache_purge(vp); 286 if (!error) { --- 123 unchanged lines hidden (view full) --- 410 register struct mount *mp; 411 int flags; 412 struct proc *p; 413{ 414 struct vnode *coveredvp; 415 int error; 416 417 simple_lock(&mountlist_slock); | 281 vfs_unbusy(mp, p); 282 return (error); 283 } 284 /* 285 * Put the new filesystem on the mount list after root. 286 */ 287 cache_purge(vp); 288 if (!error) { --- 123 unchanged lines hidden (view full) --- 412 register struct mount *mp; 413 int flags; 414 struct proc *p; 415{ 416 struct vnode *coveredvp; 417 int error; 418 419 simple_lock(&mountlist_slock); |
418 mp->mnt_flag |= MNT_UNMOUNT; | 420 mp->mnt_kern_flag |= MNTK_UNMOUNT; |
419 lockmgr(&mp->mnt_lock, LK_DRAIN | LK_INTERLOCK, &mountlist_slock, p); 420 421 if (mp->mnt_flag & MNT_EXPUBLIC) 422 vfs_setpublicfs(NULL, NULL, NULL); 423 424 mp->mnt_flag &=~ MNT_ASYNC; 425 vfs_msync(mp, MNT_NOWAIT); 426 vnode_pager_umount(mp); /* release cached vnodes */ 427 cache_purgevfs(mp); /* remove cache entries for this file sys */ 428 if (((mp->mnt_flag & MNT_RDONLY) || 429 (error = VFS_SYNC(mp, MNT_WAIT, p->p_ucred, p)) == 0) || 430 (flags & MNT_FORCE)) 431 error = VFS_UNMOUNT(mp, flags, p); 432 simple_lock(&mountlist_slock); 433 if (error) { | 421 lockmgr(&mp->mnt_lock, LK_DRAIN | LK_INTERLOCK, &mountlist_slock, p); 422 423 if (mp->mnt_flag & MNT_EXPUBLIC) 424 vfs_setpublicfs(NULL, NULL, NULL); 425 426 mp->mnt_flag &=~ MNT_ASYNC; 427 vfs_msync(mp, MNT_NOWAIT); 428 vnode_pager_umount(mp); /* release cached vnodes */ 429 cache_purgevfs(mp); /* remove cache entries for this file sys */ 430 if (((mp->mnt_flag & MNT_RDONLY) || 431 (error = VFS_SYNC(mp, MNT_WAIT, p->p_ucred, p)) == 0) || 432 (flags & MNT_FORCE)) 433 error = VFS_UNMOUNT(mp, flags, p); 434 simple_lock(&mountlist_slock); 435 if (error) { |
434 mp->mnt_flag &= ~MNT_UNMOUNT; | 436 mp->mnt_kern_flag &= ~MNTK_UNMOUNT; |
435 lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK | LK_REENABLE, 436 &mountlist_slock, p); 437 return (error); 438 } 439 CIRCLEQ_REMOVE(&mountlist, mp, mnt_list); 440 if ((coveredvp = mp->mnt_vnodecovered) != NULLVP) { 441 coveredvp->v_mountedhere = (struct mount *)0; 442 vrele(coveredvp); 443 } 444 mp->mnt_vfc->vfc_refcount--; 445 if (mp->mnt_vnodelist.lh_first != NULL) 446 panic("unmount: dangling vnode"); 447 lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK, &mountlist_slock, p); | 437 lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK | LK_REENABLE, 438 &mountlist_slock, p); 439 return (error); 440 } 441 CIRCLEQ_REMOVE(&mountlist, mp, mnt_list); 442 if ((coveredvp = mp->mnt_vnodecovered) != NULLVP) { 443 coveredvp->v_mountedhere = (struct mount *)0; 444 vrele(coveredvp); 445 } 446 mp->mnt_vfc->vfc_refcount--; 447 if (mp->mnt_vnodelist.lh_first != NULL) 448 panic("unmount: dangling vnode"); 449 lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK, &mountlist_slock, p); |
448 if (mp->mnt_flag & MNT_MWAIT) | 450 if (mp->mnt_kern_flag & MNTK_MWAIT) |
449 wakeup((caddr_t)mp); 450 free((caddr_t)mp, M_MOUNT); 451 return (0); 452} 453 454/* 455 * Sync each mounted filesystem. 456 */ --- 2365 unchanged lines hidden --- | 451 wakeup((caddr_t)mp); 452 free((caddr_t)mp, M_MOUNT); 453 return (0); 454} 455 456/* 457 * Sync each mounted filesystem. 458 */ --- 2365 unchanged lines hidden --- |