diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_lookup.c | 6 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 29 | ||||
-rw-r--r-- | sys/kern/vfs_sync.c | 6 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 30 |
4 files changed, 33 insertions, 38 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 04087a1ff75..756b532bceb 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_lookup.c,v 1.30 2005/11/08 15:43:44 pedro Exp $ */ +/* $OpenBSD: vfs_lookup.c,v 1.31 2005/11/30 10:35:07 pedro Exp $ */ /* $NetBSD: vfs_lookup.c,v 1.17 1996/02/09 19:00:59 christos Exp $ */ /* @@ -513,11 +513,11 @@ dirloop: */ while (dp->v_type == VDIR && (mp = dp->v_mountedhere) && (cnp->cn_flags & NOCROSSMOUNT) == 0) { - if (vfs_busy(mp, 0, 0, p)) + if (vfs_busy(mp, 0, NULL)) continue; VOP_UNLOCK(dp, 0, p); error = VFS_ROOT(mp, &tdp); - vfs_unbusy(mp, p); + vfs_unbusy(mp); if (error) { dpunlocked = 1; goto bad2; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 4c32a075a16..0416a45e382 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.120 2005/11/24 12:08:16 pedro Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.121 2005/11/30 10:35:07 pedro Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -154,8 +154,7 @@ vntblinit(void) * fail. */ int -vfs_busy(struct mount *mp, int flags, struct simplelock *interlkp, - struct proc *p) +vfs_busy(struct mount *mp, int flags, struct simplelock *interlkp) { int lkflags; @@ -183,12 +182,11 @@ vfs_busy(struct mount *mp, int flags, struct simplelock *interlkp, return (0); } - /* * Free a busy file system */ void -vfs_unbusy(struct mount *mp, struct proc *p) +vfs_unbusy(struct mount *mp) { lockmgr(&mp->mnt_lock, LK_RELEASE, NULL); } @@ -208,7 +206,6 @@ vfs_isbusy(struct mount *mp) int vfs_rootmountalloc(char *fstypename, char *devname, struct mount **mpp) { - struct proc *p = curproc; struct vfsconf *vfsp; struct mount *mp; @@ -220,7 +217,7 @@ vfs_rootmountalloc(char *fstypename, char *devname, struct mount **mpp) mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK); bzero((char *)mp, (u_long)sizeof(struct mount)); lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, 0); - (void)vfs_busy(mp, LK_NOWAIT, 0, p); + (void)vfs_busy(mp, LK_NOWAIT, NULL); LIST_INIT(&mp->mnt_vnodelist); mp->mnt_vfc = vfsp; mp->mnt_op = vfsp->vfc_vfsops; @@ -1167,7 +1164,7 @@ vgonel(struct vnode *vp, struct proc *p) */ mp = vp->v_specmountpoint; if (mp != NULL) { - if (!vfs_busy(mp, LK_EXCLUSIVE, NULL, p)) { + if (!vfs_busy(mp, LK_EXCLUSIVE, NULL)) { flags = MNT_FORCE | MNT_DOOMED; dounmount(mp, flags, p, NULL); } @@ -1325,7 +1322,6 @@ vprint(char *label, struct vnode *vp) void printlockedvnodes(void) { - struct proc *p = curproc; struct mount *mp, *nmp; struct vnode *vp; @@ -1333,7 +1329,7 @@ printlockedvnodes(void) simple_lock(&mountlist_slock); for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) { + if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { nmp = CIRCLEQ_NEXT(mp, mnt_list); continue; } @@ -1343,7 +1339,7 @@ printlockedvnodes(void) } simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); - vfs_unbusy(mp, p); + vfs_unbusy(mp); } simple_unlock(&mountlist_slock); @@ -1414,7 +1410,7 @@ sysctl_vnode(char *where, size_t *sizep, struct proc *p) simple_lock(&mountlist_slock); for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) { + if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { nmp = CIRCLEQ_NEXT(mp, mnt_list); continue; } @@ -1438,7 +1434,7 @@ again: if (bp + sizeof(struct e_vnode) > ewhere) { simple_unlock(&mntvnode_slock); *sizep = bp - where; - vfs_unbusy(mp, p); + vfs_unbusy(mp); return (ENOMEM); } if ((error = copyout(&vp, @@ -1447,7 +1443,7 @@ again: (error = copyout(vp, &((struct e_vnode *)bp)->vnode, sizeof(struct vnode)))) { - vfs_unbusy(mp, p); + vfs_unbusy(mp); return (error); } bp += sizeof(struct e_vnode); @@ -1457,7 +1453,7 @@ again: simple_unlock(&mntvnode_slock); simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); - vfs_unbusy(mp, p); + vfs_unbusy(mp); } simple_unlock(&mountlist_slock); @@ -1711,14 +1707,13 @@ vfs_unmountall(void) { struct mount *mp, *nmp; int allerror, error, again = 1; - struct proc *p = curproc; retry: allerror = 0; for (mp = CIRCLEQ_LAST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { nmp = CIRCLEQ_PREV(mp, mnt_list); - if ((vfs_busy(mp, LK_EXCLUSIVE|LK_NOWAIT, NULL, p)) != 0) + if ((vfs_busy(mp, LK_EXCLUSIVE|LK_NOWAIT, NULL)) != 0) continue; if ((error = dounmount(mp, MNT_FORCE, curproc, NULL)) != 0) { printf("unmount of %s failed with error %d\n", diff --git a/sys/kern/vfs_sync.c b/sys/kern/vfs_sync.c index 19b0389ee54..62a280afcaa 100644 --- a/sys/kern/vfs_sync.c +++ b/sys/kern/vfs_sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_sync.c,v 1.35 2005/11/06 13:07:48 pedro Exp $ */ +/* $OpenBSD: vfs_sync.c,v 1.36 2005/11/30 10:35:07 pedro Exp $ */ /* * Portions of this code are: @@ -352,13 +352,13 @@ sync_fsync(void *v) * not already on the sync list. */ simple_lock(&mountlist_slock); - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, ap->a_p) == 0) { + if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock) == 0) { asyncflag = mp->mnt_flag & MNT_ASYNC; mp->mnt_flag &= ~MNT_ASYNC; VFS_SYNC(mp, MNT_LAZY, ap->a_cred, ap->a_p); if (asyncflag) mp->mnt_flag |= MNT_ASYNC; - vfs_unbusy(mp, ap->a_p); + vfs_unbusy(mp); } else simple_unlock(&mountlist_slock); diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 1047dffb2a1..4543f713660 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.129 2005/11/27 12:37:58 pedro Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.130 2005/11/30 10:35:08 pedro Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -150,7 +150,7 @@ sys_mount(struct proc *p, void *v, register_t *retval) if (flag & MNT_NOEXEC) SCARG(uap, flags) |= MNT_NOEXEC; } - if ((error = vfs_busy(mp, LK_NOWAIT, 0, p)) != 0) { + if ((error = vfs_busy(mp, LK_NOWAIT, NULL)) != 0) { vput(vp); return (error); } @@ -238,7 +238,7 @@ sys_mount(struct proc *p, void *v, register_t *retval) bzero((char *)mp, (u_long)sizeof(struct mount)); lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, 0); /* This error never happens, but it makes auditing easier */ - if ((error = vfs_busy(mp, LK_NOWAIT, 0, p))) + if ((error = vfs_busy(mp, LK_NOWAIT, NULL))) return (error); mp->mnt_op = vfsp->vfc_vfsops; mp->mnt_vfc = vfsp; @@ -285,7 +285,7 @@ update: mp->mnt_syncer = NULL; } - vfs_unbusy(mp, p); + vfs_unbusy(mp); return (error); } @@ -304,13 +304,13 @@ update: VOP_UNLOCK(vp, 0, p); if ((mp->mnt_flag & MNT_RDONLY) == 0) error = vfs_allocate_syncvnode(mp); - vfs_unbusy(mp, p); + vfs_unbusy(mp); (void) VFS_STATFS(mp, &mp->mnt_stat, p); if ((error = VFS_START(mp, 0, p)) != 0) vrele(vp); } else { mp->mnt_vnodecovered->v_mountedhere = (struct mount *)0; - vfs_unbusy(mp, p); + vfs_unbusy(mp); free(mp, M_MOUNT); vput(vp); } @@ -407,7 +407,7 @@ sys_unmount(struct proc *p, void *v, register_t *retval) } vput(vp); - if (vfs_busy(mp, LK_EXCLUSIVE, NULL, p)) + if (vfs_busy(mp, LK_EXCLUSIVE, NULL)) return (EBUSY); return (dounmount(mp, SCARG(uap, flags), p, vp)); @@ -473,7 +473,7 @@ sys_sync(struct proc *p, void *v, register_t *retval) simple_lock(&mountlist_slock); for (mp = CIRCLEQ_LAST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) { + if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { nmp = CIRCLEQ_PREV(mp, mnt_list); continue; } @@ -487,7 +487,7 @@ sys_sync(struct proc *p, void *v, register_t *retval) } simple_lock(&mountlist_slock); nmp = CIRCLEQ_PREV(mp, mnt_list); - vfs_unbusy(mp, p); + vfs_unbusy(mp); } simple_unlock(&mountlist_slock); @@ -630,7 +630,7 @@ sys_getfsstat(struct proc *p, void *v, register_t *retval) simple_lock(&mountlist_slock); for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) { + if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { nmp = CIRCLEQ_NEXT(mp, mnt_list); continue; } @@ -645,7 +645,7 @@ sys_getfsstat(struct proc *p, void *v, register_t *retval) (error = VFS_STATFS(mp, sp, p))) { simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); - vfs_unbusy(mp, p); + vfs_unbusy(mp); continue; } @@ -661,7 +661,7 @@ sys_getfsstat(struct proc *p, void *v, register_t *retval) } error = copyout(sp, sfsp, sizeof(*sp)); if (error) { - vfs_unbusy(mp, p); + vfs_unbusy(mp); return (error); } sfsp++; @@ -669,7 +669,7 @@ sys_getfsstat(struct proc *p, void *v, register_t *retval) count++; simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); - vfs_unbusy(mp, p); + vfs_unbusy(mp); } simple_unlock(&mountlist_slock); if (sfsp && count > maxcount) @@ -707,10 +707,10 @@ sys_fchdir(struct proc *p, void *v, register_t *retval) error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p); while (!error && (mp = vp->v_mountedhere) != NULL) { - if (vfs_busy(mp, 0, 0, p)) + if (vfs_busy(mp, 0, NULL)) continue; error = VFS_ROOT(mp, &tdp); - vfs_unbusy(mp, p); + vfs_unbusy(mp); if (error) break; vput(vp); |