aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPaul Saab <ps@FreeBSD.org>2004-11-29 22:58:32 +0000
committerPaul Saab <ps@FreeBSD.org>2004-11-29 22:58:32 +0000
commitd8b8e875a258eb8051e3c61a91cd963dbdb0a8bb (patch)
treedb2cb80547272394e0409a7221ad0585cd900d81 /sys
parent020931b0b6347a00a890db3b76975e8552c2c3b5 (diff)
downloadsrc-d8b8e875a258eb8051e3c61a91cd963dbdb0a8bb.tar.gz
src-d8b8e875a258eb8051e3c61a91cd963dbdb0a8bb.zip
When upgrading the shared lock to an exclusive lock, if we discover
that the exclusive lock is already held, then we call panic. Don't clobber internal lock state before panic'ing. This change improves debugging if this case were to happen. Submitted by: Mohan Srinivasan mohans at yahoo-inc dot com Reviewed by: rwatson
Notes
Notes: svn path=/head/; revision=138203
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_lock.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 39822ea3f158..5d639b38a441 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -340,11 +340,10 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line)
wakeup((void *)lkp);
break;
}
-
- lkp->lk_flags |= LK_HAVE_EXCL;
- lkp->lk_lockholder = thr;
if (lkp->lk_exclusivecount != 0)
panic("lockmgr: non-zero exclusive count");
+ lkp->lk_flags |= LK_HAVE_EXCL;
+ lkp->lk_lockholder = thr;
lkp->lk_exclusivecount = 1;
#if defined(DEBUG_LOCKS)
lkp->lk_filename = file;