diff options
author | ps <ps@FreeBSD.org> | 2004-11-29 22:58:32 +0000 |
---|---|---|
committer | ps <ps@FreeBSD.org> | 2004-11-29 22:58:32 +0000 |
commit | 93adaab3cd9310fea8f63f19b973776674b8cb85 (patch) | |
tree | db2cb80547272394e0409a7221ad0585cd900d81 /sys | |
parent | 5439b7e1cb0fafac78d3c29003737a2574670c30 (diff) | |
download | FreeBSD-src-93adaab3cd9310fea8f63f19b973776674b8cb85.zip FreeBSD-src-93adaab3cd9310fea8f63f19b973776674b8cb85.tar.gz |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_lock.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 39822ea..5d639b3 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; |