diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2005-03-24 09:35:06 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2005-03-24 09:35:06 +0000 |
commit | 92e251caf783027ec5bd254d727aab27e137301b (patch) | |
tree | 6c7619b0a9ed309c42d2c89980c1afacbbde3d2b | |
parent | a176ceb322674bbe20b1cbe14be5d14000df321c (diff) |
Notes
-rw-r--r-- | sys/kern/kern_lock.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index f0bed3f9d4a2..c9c23147b9f2 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; |