summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2004-08-27 01:41:28 +0000
committerkan <kan@FreeBSD.org>2004-08-27 01:41:28 +0000
commita060608a2d89ef672b86092efdee8181dde4b5f0 (patch)
treea69bdacb74e4776123dd43959b1951de65ae2083 /sys/kern/kern_lock.c
parent1268768c3d35a9843a04b6a4552558138597fc4f (diff)
downloadFreeBSD-src-a060608a2d89ef672b86092efdee8181dde4b5f0.zip
FreeBSD-src-a060608a2d89ef672b86092efdee8181dde4b5f0.tar.gz
Reintroduce slightly modified patch from kern/69964. Check for
LK_HAVE_EXL in both acquire invocations. MFC after: 5 days
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index c819ba1..39822ea 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -335,8 +335,12 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line)
error = acquire(&lkp, extflags, LK_SHARE_NONZERO);
lkp->lk_flags &= ~LK_WANT_UPGRADE;
- if (error)
- break;
+ if (error) {
+ if ((lkp->lk_flags & ( LK_WANT_EXCL | LK_WAIT_NONZERO)) == (LK_WANT_EXCL | LK_WAIT_NONZERO))
+ wakeup((void *)lkp);
+ break;
+ }
+
lkp->lk_flags |= LK_HAVE_EXCL;
lkp->lk_lockholder = thr;
if (lkp->lk_exclusivecount != 0)
@@ -389,10 +393,13 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line)
/*
* Wait for shared locks and upgrades to finish.
*/
- error = acquire(&lkp, extflags, LK_WANT_UPGRADE | LK_SHARE_NONZERO);
+ error = acquire(&lkp, extflags, LK_HAVE_EXCL | LK_WANT_UPGRADE | LK_SHARE_NONZERO);
lkp->lk_flags &= ~LK_WANT_EXCL;
- if (error)
+ if (error) {
+ if (lkp->lk_flags & LK_WAIT_NONZERO)
+ wakeup((void *)lkp);
break;
+ }
lkp->lk_flags |= LK_HAVE_EXCL;
lkp->lk_lockholder = thr;
if (lkp->lk_exclusivecount != 0)
OpenPOWER on IntegriCloud