diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-04-22 18:57:57 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-04-22 18:57:57 +0000 |
commit | 961c4b82ff4dfa739bd7c885867ca095929055da (patch) | |
tree | 213beebfba873bba1cba54da273bf3f703583b57 /sys/miscfs | |
parent | e5abd463790071b702d2b8b46dfdf7c6dbb76765 (diff) |
this rwlock conversion breaks procfs (in linux compat), as found out
by Antoine Jacoutot. back out for oga to look at when he gets back in
touch with earth.
Diffstat (limited to 'sys/miscfs')
-rw-r--r-- | sys/miscfs/procfs/procfs_subr.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/miscfs/procfs/procfs_subr.c b/sys/miscfs/procfs/procfs_subr.c index 2acb3f4e704..9e3cec1802d 100644 --- a/sys/miscfs/procfs/procfs_subr.c +++ b/sys/miscfs/procfs/procfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_subr.c,v 1.29 2009/04/02 18:43:08 oga Exp $ */ +/* $OpenBSD: procfs_subr.c,v 1.30 2009/04/22 18:57:56 deraadt Exp $ */ /* $NetBSD: procfs_subr.c,v 1.15 1996/02/12 15:01:42 christos Exp $ */ /* @@ -40,7 +40,6 @@ #include <sys/systm.h> #include <sys/time.h> #include <sys/kernel.h> -#include <sys/rwlock.h> #include <sys/proc.h> #include <sys/vnode.h> #include <sys/malloc.h> @@ -50,12 +49,13 @@ #include <miscfs/procfs/procfs.h> static TAILQ_HEAD(, pfsnode) pfshead; -struct rwlock pfs_vlock = RWLOCK_INITIALIZER("procfsl"); +struct lock pfs_vlock; /*ARGSUSED*/ int procfs_init(struct vfsconf *vfsp) { + lockinit(&pfs_vlock, PVFS, "procfsl", 0, 0); TAILQ_INIT(&pfshead); return (0); } @@ -97,7 +97,9 @@ procfs_allocvp(struct mount *mp, struct vnode **vpp, pid_t pid, pfstype pfs_type /* * Lock the vp list, getnewvnode can sleep. */ - rw_enter_write(&pfs_vlock); + error = lockmgr(&pfs_vlock, LK_EXCLUSIVE, NULL); + if (error) + return (error); loop: TAILQ_FOREACH(pfs, &pfshead, list) { vp = PFSTOV(pfs); @@ -173,7 +175,7 @@ loop: TAILQ_INSERT_TAIL(&pfshead, pfs, list); uvm_vnp_setsize(vp, 0); out: - rw_exit_write(&pfs_vlock); + lockmgr(&pfs_vlock, LK_RELEASE, NULL); return (error); } |