summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2005-03-24 09:35:06 +0000
committerjeff <jeff@FreeBSD.org>2005-03-24 09:35:06 +0000
commit5fffa95033f39c1f0653176fa073db22bf0a0718 (patch)
tree6c7619b0a9ed309c42d2c89980c1afacbbde3d2b /sys/kern
parent56f1fc71890fea1c816625e7aec103c5369f7903 (diff)
downloadFreeBSD-src-5fffa95033f39c1f0653176fa073db22bf0a0718.zip
FreeBSD-src-5fffa95033f39c1f0653176fa073db22bf0a0718.tar.gz
- Complete the implementation of td_locks. Track the number of outstanding
lockmgr locks that this thread owns. This is complicated due to LK_KERNPROC and because lockmgr tolerates unlocking an unlocked lock. Sponsored by: Isilon Systes, Inc.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_lock.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index f0bed3f..c9c2314 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -269,6 +269,8 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line)
error = acquire(&lkp, extflags, lockflags);
if (error)
break;
+ if (td != NULL)
+ td->td_locks++;
sharelock(lkp, 1);
#if defined(DEBUG_LOCKS)
lkp->lk_slockholder = thr;
@@ -377,6 +379,8 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line)
if ((extflags & (LK_NOWAIT | LK_CANRECURSE)) == 0)
panic("lockmgr: locking against myself");
if ((extflags & LK_CANRECURSE) != 0) {
+ if (td != NULL)
+ td->td_locks++;
lkp->lk_exclusivecount++;
break;
}
@@ -411,6 +415,8 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line)
if (lkp->lk_exclusivecount != 0)
panic("lockmgr: non-zero exclusive count");
lkp->lk_exclusivecount = 1;
+ if (td != NULL)
+ td->td_locks++;
#if defined(DEBUG_LOCKS)
lkp->lk_filename = file;
lkp->lk_lineno = line;
@@ -419,6 +425,9 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line)
break;
case LK_RELEASE:
+ if (td != NULL && lkp->lk_lockholder != LK_KERNPROC &&
+ lkp->lk_exclusivecount + lkp->lk_sharecount != 0)
+ td->td_locks--;
if (lkp->lk_exclusivecount != 0) {
if (lkp->lk_lockholder != thr &&
lkp->lk_lockholder != LK_KERNPROC) {
@@ -455,6 +464,8 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line)
lkp->lk_flags |= LK_DRAINING | LK_HAVE_EXCL;
lkp->lk_lockholder = thr;
lkp->lk_exclusivecount = 1;
+ if (td != NULL)
+ td->td_locks++;
#if defined(DEBUG_LOCKS)
lkp->lk_filename = file;
lkp->lk_lineno = line;
OpenPOWER on IntegriCloud