1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

- 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.
This commit is contained in:
Jeff Roberson 2005-03-24 09:35:06 +00:00
parent a176ceb322
commit 92e251caf7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=144060

View File

@ -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;