diff options
-rw-r--r-- | sys/compat/common/vfs_syscalls_25.c | 11 | ||||
-rw-r--r-- | sys/compat/freebsd/freebsd_file.c | 11 | ||||
-rw-r--r-- | sys/compat/netbsd/netbsd_file.c | 11 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_vfsops.c | 6 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 21 | ||||
-rw-r--r-- | sys/kern/vfs_sync.c | 8 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 30 | ||||
-rw-r--r-- | sys/nfs/nfs_vfsops.c | 4 | ||||
-rw-r--r-- | sys/ntfs/ntfs_vfsops.c | 5 | ||||
-rw-r--r-- | sys/sys/mount.h | 3 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_vfsops.c | 5 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 6 | ||||
-rw-r--r-- | sys/ufs/mfs/mfs_vfsops.c | 6 |
13 files changed, 53 insertions, 74 deletions
diff --git a/sys/compat/common/vfs_syscalls_25.c b/sys/compat/common/vfs_syscalls_25.c index 333724e87e7..5f4d658ca67 100644 --- a/sys/compat/common/vfs_syscalls_25.c +++ b/sys/compat/common/vfs_syscalls_25.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls_25.c,v 1.8 2006/03/05 21:48:54 miod Exp $ */ +/* $OpenBSD: vfs_syscalls_25.c,v 1.9 2006/04/19 11:55:55 pedro Exp $ */ /* * Copyright (c) 1989, 1993 @@ -178,10 +178,10 @@ compat_25_sys_getfsstat(p, v, retval) maxcount = SCARG(uap, bufsize) / sizeof(struct ostatfs); sfsp = (caddr_t)SCARG(uap, buf); count = 0; - simple_lock(&mountlist_slock); + for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { + if (vfs_busy(mp, LK_NOWAIT, NULL)) { nmp = CIRCLEQ_NEXT(mp, mnt_list); continue; } @@ -194,7 +194,6 @@ compat_25_sys_getfsstat(p, v, retval) (flags == MNT_WAIT || flags == 0) && (error = VFS_STATFS(mp, sp, p))) { - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); continue; @@ -209,14 +208,14 @@ compat_25_sys_getfsstat(p, v, retval) sfsp += sizeof(osb); } count++; - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); } - simple_unlock(&mountlist_slock); + if (sfsp && count > maxcount) *retval = maxcount; else *retval = count; + return (0); } diff --git a/sys/compat/freebsd/freebsd_file.c b/sys/compat/freebsd/freebsd_file.c index f78a599f5e9..73c80db1954 100644 --- a/sys/compat/freebsd/freebsd_file.c +++ b/sys/compat/freebsd/freebsd_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: freebsd_file.c,v 1.21 2006/03/05 21:48:56 miod Exp $ */ +/* $OpenBSD: freebsd_file.c,v 1.22 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: freebsd_file.c,v 1.3 1996/05/03 17:03:09 christos Exp $ */ /* @@ -657,10 +657,10 @@ freebsd_sys_getfsstat(p, v, retval) maxcount = SCARG(uap, bufsize) / sizeof(struct freebsd_statfs); sfsp = (caddr_t)SCARG(uap, buf); count = 0; - simple_lock(&mountlist_slock); + for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { + if (vfs_busy(mp, LK_NOWAIT, NULL)) { nmp = CIRCLEQ_NEXT(mp, mnt_list); continue; } @@ -673,7 +673,6 @@ freebsd_sys_getfsstat(p, v, retval) (flags == MNT_WAIT || flags == 0) && (error = VFS_STATFS(mp, sp, p))) { - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); continue; @@ -689,15 +688,15 @@ freebsd_sys_getfsstat(p, v, retval) sfsp += sizeof(fsb); } count++; - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); } - simple_unlock(&mountlist_slock); + if (sfsp && count > maxcount) *retval = maxcount; else *retval = count; + return (0); } diff --git a/sys/compat/netbsd/netbsd_file.c b/sys/compat/netbsd/netbsd_file.c index 47e7e326f4f..7a935798b6a 100644 --- a/sys/compat/netbsd/netbsd_file.c +++ b/sys/compat/netbsd/netbsd_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netbsd_file.c,v 1.7 2006/03/05 21:48:56 miod Exp $ */ +/* $OpenBSD: netbsd_file.c,v 1.8 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: freebsd_file.c,v 1.3 1996/05/03 17:03:09 christos Exp $ */ /* @@ -631,10 +631,10 @@ netbsd_sys_getfsstat(p, v, retval) maxcount = SCARG(uap, bufsize) / sizeof(struct netbsd_statfs); sfsp = (caddr_t)SCARG(uap, buf); count = 0; - simple_lock(&mountlist_slock); + for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { + if (vfs_busy(mp, LK_NOWAIT, NULL)) { nmp = CIRCLEQ_NEXT(mp, mnt_list); continue; } @@ -647,7 +647,6 @@ netbsd_sys_getfsstat(p, v, retval) (flags == MNT_WAIT || flags == 0) && (error = VFS_STATFS(mp, sp, p))) { - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); continue; @@ -663,15 +662,15 @@ netbsd_sys_getfsstat(p, v, retval) sfsp += sizeof(fsb); } count++; - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); } - simple_unlock(&mountlist_slock); + if (sfsp && count > maxcount) *retval = maxcount; else *retval = count; + return (0); } diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index 20c0f381537..3883496b5c7 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/cd9660/cd9660_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_vfsops.c,v 1.38 2006/01/22 00:40:02 miod Exp $ */ +/* $OpenBSD: cd9660_vfsops.c,v 1.39 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: cd9660_vfsops.c,v 1.26 1997/06/13 15:38:58 pk Exp $ */ /*- @@ -112,12 +112,12 @@ cd9660_mountroot() free(mp, M_MOUNT); return (error); } - simple_lock(&mountlist_slock); + CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); - simple_unlock(&mountlist_slock); (void)cd9660_statfs(mp, &mp->mnt_stat, p); vfs_unbusy(mp); inittodr(0); + return (0); } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 55aeb0c6a4e..ffb178d5a3a 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.122 2006/01/09 12:43:16 pedro Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.123 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -92,7 +92,6 @@ struct freelst vnode_hold_list; /* list of vnodes referencing buffers */ struct freelst vnode_free_list; /* vnode free list */ struct mntlist mountlist; /* mounted filesystem list */ -struct simplelock mountlist_slock; static struct simplelock mntid_slock; struct simplelock mntvnode_slock; struct simplelock vnode_free_list_slock; @@ -136,7 +135,6 @@ vntblinit(void) TAILQ_INIT(&vnode_free_list); simple_lock_init(&vnode_free_list_slock); CIRCLEQ_INIT(&mountlist); - simple_lock_init(&mountlist_slock); /* * Initialize the filesystem syncer. */ @@ -264,15 +262,13 @@ vfs_getvfs(fsid_t *fsid) { struct mount *mp; - simple_lock(&mountlist_slock); CIRCLEQ_FOREACH(mp, &mountlist, mnt_list) { if (mp->mnt_stat.f_fsid.val[0] == fsid->val[0] && mp->mnt_stat.f_fsid.val[1] == fsid->val[1]) { - simple_unlock(&mountlist_slock); return (mp); } } - simple_unlock(&mountlist_slock); + return ((struct mount *)0); } @@ -1334,10 +1330,10 @@ printlockedvnodes(void) struct vnode *vp; printf("Locked vnodes\n"); - simple_lock(&mountlist_slock); + for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { + if (vfs_busy(mp, LK_NOWAIT, NULL)) { nmp = CIRCLEQ_NEXT(mp, mnt_list); continue; } @@ -1345,11 +1341,9 @@ printlockedvnodes(void) if (VOP_ISLOCKED(vp)) vprint((char *)0, vp); } - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); } - simple_unlock(&mountlist_slock); } #endif @@ -1415,10 +1409,9 @@ sysctl_vnode(char *where, size_t *sizep, struct proc *p) } ewhere = where + *sizep; - simple_lock(&mountlist_slock); for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { + if (vfs_busy(mp, LK_NOWAIT, NULL)) { nmp = CIRCLEQ_NEXT(mp, mnt_list); continue; } @@ -1459,14 +1452,12 @@ again: } simple_unlock(&mntvnode_slock); - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); } - simple_unlock(&mountlist_slock); - *sizep = bp - where; + return (0); } diff --git a/sys/kern/vfs_sync.c b/sys/kern/vfs_sync.c index 0d55326971f..89367839c17 100644 --- a/sys/kern/vfs_sync.c +++ b/sys/kern/vfs_sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_sync.c,v 1.37 2006/01/09 12:43:16 pedro Exp $ */ +/* $OpenBSD: vfs_sync.c,v 1.38 2006/04/19 11:55:55 pedro Exp $ */ /* * Portions of this code are: @@ -353,16 +353,14 @@ sync_fsync(void *v) * Walk the list of vnodes pushing all that are dirty and * not already on the sync list. */ - simple_lock(&mountlist_slock); - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock) == 0) { + if (vfs_busy(mp, LK_NOWAIT, NULL) == 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); - } else - simple_unlock(&mountlist_slock); + } return (0); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 93c5171593a..ce7965e8ac0 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.132 2006/03/26 17:47:10 mickey Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.133 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -297,9 +297,7 @@ update: cache_purge(vp); if (!error) { vfsp->vfc_refcount++; - simple_lock(&mountlist_slock); CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); - simple_unlock(&mountlist_slock); checkdirs(vp); VOP_UNLOCK(vp, 0, p); if ((mp->mnt_flag & MNT_RDONLY) == 0) @@ -434,24 +432,28 @@ dounmount(struct mount *mp, int flags, struct proc *p, struct vnode *olddp) (error = VFS_SYNC(mp, MNT_WAIT, p->p_ucred, p)) == 0) || (flags & MNT_FORCE)) error = VFS_UNMOUNT(mp, flags, p); - simple_lock(&mountlist_slock); + if (error && error != EIO && !(flags & MNT_DOOMED)) { if ((mp->mnt_flag & MNT_RDONLY) == 0 && hadsyncer) (void) vfs_allocate_syncvnode(mp); - lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK, - &mountlist_slock); + lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK, NULL); return (error); } + CIRCLEQ_REMOVE(&mountlist, mp, mnt_list); if ((coveredvp = mp->mnt_vnodecovered) != NULLVP) { coveredvp->v_mountedhere = NULL; vrele(coveredvp); } + mp->mnt_vfc->vfc_refcount--; + if (!LIST_EMPTY(&mp->mnt_vnodelist)) panic("unmount: dangling vnode"); - lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK, &mountlist_slock); + + lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK, NULL); free(mp, M_MOUNT); + return (0); } @@ -470,10 +472,9 @@ sys_sync(struct proc *p, void *v, register_t *retval) struct mount *mp, *nmp; int asyncflag; - simple_lock(&mountlist_slock); for (mp = CIRCLEQ_LAST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { + if (vfs_busy(mp, LK_NOWAIT, NULL)) { nmp = CIRCLEQ_PREV(mp, mnt_list); continue; } @@ -485,11 +486,9 @@ sys_sync(struct proc *p, void *v, register_t *retval) if (asyncflag) mp->mnt_flag |= MNT_ASYNC; } - simple_lock(&mountlist_slock); nmp = CIRCLEQ_PREV(mp, mnt_list); vfs_unbusy(mp); } - simple_unlock(&mountlist_slock); #ifdef DEBUG if (syncprt) @@ -627,10 +626,10 @@ sys_getfsstat(struct proc *p, void *v, register_t *retval) maxcount = SCARG(uap, bufsize) / sizeof(struct statfs); sfsp = SCARG(uap, buf); count = 0; - simple_lock(&mountlist_slock); + for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { + if (vfs_busy(mp, LK_NOWAIT, NULL)) { nmp = CIRCLEQ_NEXT(mp, mnt_list); continue; } @@ -643,7 +642,6 @@ sys_getfsstat(struct proc *p, void *v, register_t *retval) (flags == MNT_WAIT || flags == 0) && (error = VFS_STATFS(mp, sp, p))) { - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); continue; @@ -667,15 +665,15 @@ sys_getfsstat(struct proc *p, void *v, register_t *retval) sfsp++; } count++; - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); } - simple_unlock(&mountlist_slock); + if (sfsp && count > maxcount) *retval = maxcount; else *retval = count; + return (0); } diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 22f1d295f5d..f7fdb88b9e9 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vfsops.c,v 1.59 2005/12/27 18:31:12 miod Exp $ */ +/* $OpenBSD: nfs_vfsops.c,v 1.60 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */ /* @@ -279,9 +279,7 @@ nfs_mountroot() /* * Link it into the mount list. */ - simple_lock(&mountlist_slock); CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); - simple_unlock(&mountlist_slock); vfs_unbusy(mp); /* Get root attributes (for the time). */ diff --git a/sys/ntfs/ntfs_vfsops.c b/sys/ntfs/ntfs_vfsops.c index 230bb2b96ca..9d58b930290 100644 --- a/sys/ntfs/ntfs_vfsops.c +++ b/sys/ntfs/ntfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_vfsops.c,v 1.10 2005/10/10 15:55:07 pedro Exp $ */ +/* $OpenBSD: ntfs_vfsops.c,v 1.11 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: ntfs_vfsops.c,v 1.7 2003/04/24 07:50:19 christos Exp $ */ /*- @@ -220,11 +220,10 @@ ntfs_mountroot() return (error); } - simple_lock(&mountlist_slock); CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); - simple_unlock(&mountlist_slock); (void)ntfs_statfs(mp, &mp->mnt_stat, p); vfs_unbusy(mp); + return (0); } diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 550ff982584..7cd03afc674 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mount.h,v 1.68 2006/03/31 13:05:23 pedro Exp $ */ +/* $OpenBSD: mount.h,v 1.69 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */ /* @@ -577,7 +577,6 @@ int vfs_rootmountalloc(char *, char *, struct mount **); void vfs_unbusy(struct mount *); void vfs_unmountall(void); extern CIRCLEQ_HEAD(mntlist, mount) mountlist; -extern struct simplelock mountlist_slock; struct mount *getvfs(fsid_t *); /* return vfs given fsid */ /* process mount export info */ diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 0df80e52c43..5008b7531de 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vfsops.c,v 1.44 2005/12/14 22:03:01 pedro Exp $ */ +/* $OpenBSD: ext2fs_vfsops.c,v 1.45 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */ /* @@ -151,9 +151,8 @@ ext2fs_mountroot() vrele(rootvp); return (error); } - simple_lock(&mountlist_slock); + CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); - simple_unlock(&mountlist_slock); ump = VFSTOUFS(mp); fs = ump->um_e2fs; bzero(fs->e2fs_fsmnt, sizeof(fs->e2fs_fsmnt)); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 3784a2f2fad..72b1ad99415 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.91 2006/04/12 03:46:52 tedu Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.92 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -141,15 +141,15 @@ ffs_mountroot(void) vrele(rootvp); return (error); } - simple_lock(&mountlist_slock); + CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); - simple_unlock(&mountlist_slock); ump = VFSTOUFS(mp); fs = ump->um_fs; (void) copystr(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN - 1, 0); (void)ffs_statfs(mp, &mp->mnt_stat, p); vfs_unbusy(mp); inittodr(fs->fs_time); + return (0); } diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c index 25bbd584ead..6f4d3bbfc27 100644 --- a/sys/ufs/mfs/mfs_vfsops.c +++ b/sys/ufs/mfs/mfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfs_vfsops.c,v 1.30 2006/03/28 13:18:17 pedro Exp $ */ +/* $OpenBSD: mfs_vfsops.c,v 1.31 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: mfs_vfsops.c,v 1.10 1996/02/09 22:31:28 christos Exp $ */ /* @@ -118,15 +118,15 @@ mfs_mountroot(void) free(mfsp, M_MFSNODE); return (error); } - simple_lock(&mountlist_slock); + CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); - simple_unlock(&mountlist_slock); ump = VFSTOUFS(mp); fs = ump->um_fs; (void) copystr(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN - 1, 0); (void)ffs_statfs(mp, &mp->mnt_stat, p); vfs_unbusy(mp); inittodr((time_t)0); + return (0); } |