diff options
author | julian <julian@FreeBSD.org> | 2003-02-01 12:17:09 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2003-02-01 12:17:09 +0000 |
commit | e8efa7328e487806fb77d3ec54bf5fa5f8b017ed (patch) | |
tree | 5ab8f2c0a0aaeb3da3779201a31e710dee48d388 /sys/kern/kern_lock.c | |
parent | 1c5753d03f1205c6e2831f320c4007946a4b050f (diff) | |
download | FreeBSD-src-e8efa7328e487806fb77d3ec54bf5fa5f8b017ed.zip FreeBSD-src-e8efa7328e487806fb77d3ec54bf5fa5f8b017ed.tar.gz |
Reversion of commit by Davidxu plus fixes since applied.
I'm not convinced there is anything major wrong with the patch but
them's the rules..
I am using my "David's mentor" hat to revert this as he's
offline for a while.
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r-- | sys/kern/kern_lock.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 9000bc9..d96547b 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -219,7 +219,7 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) #endif { int error; - struct thread *thr; + pid_t pid; int extflags, lockflags; CTR5(KTR_LOCKMGR, @@ -228,9 +228,9 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) error = 0; if (td == NULL) - thr = LK_KERNPROC; + pid = LK_KERNPROC; else - thr = td; + pid = td->td_proc->p_pid; mtx_lock(lkp->lk_interlock); if (flags & LK_INTERLOCK) { @@ -257,7 +257,7 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) * lock requests or upgrade requests ( but not the exclusive * lock itself ). */ - if (lkp->lk_lockholder != thr) { + if (lkp->lk_lockholder != pid) { lockflags = LK_HAVE_EXCL; mtx_lock_spin(&sched_lock); if (td != NULL && !(td->td_flags & TDF_DEADLKTREAT)) @@ -268,7 +268,7 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) break; sharelock(lkp, 1); #if defined(DEBUG_LOCKS) - lkp->lk_slockholder = thr; + lkp->lk_slockholder = pid; lkp->lk_sfilename = file; lkp->lk_slineno = line; lkp->lk_slockername = name; @@ -283,14 +283,14 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) /* FALLTHROUGH downgrade */ case LK_DOWNGRADE: - KASSERT(lkp->lk_lockholder == thr && lkp->lk_exclusivecount != 0, + KASSERT(lkp->lk_lockholder == pid && lkp->lk_exclusivecount != 0, ("lockmgr: not holding exclusive lock " - "(owner thread (%p) != thread (%p), exlcnt (%d) != 0", - lkp->lk_lockholder, thr, lkp->lk_exclusivecount)); + "(owner pid (%d) != pid (%d), exlcnt (%d) != 0", + lkp->lk_lockholder, pid, lkp->lk_exclusivecount)); sharelock(lkp, lkp->lk_exclusivecount); lkp->lk_exclusivecount = 0; lkp->lk_flags &= ~LK_HAVE_EXCL; - lkp->lk_lockholder = (struct thread *)LK_NOPROC; + lkp->lk_lockholder = LK_NOPROC; if (lkp->lk_waitcount) wakeup((void *)lkp); break; @@ -317,7 +317,7 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) * after the upgrade). If we return an error, the file * will always be unlocked. */ - if ((lkp->lk_lockholder == thr) || (lkp->lk_sharecount <= 0)) + if ((lkp->lk_lockholder == pid) || (lkp->lk_sharecount <= 0)) panic("lockmgr: upgrade exclusive lock"); shareunlock(lkp, 1); /* @@ -342,7 +342,7 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) if (error) break; lkp->lk_flags |= LK_HAVE_EXCL; - lkp->lk_lockholder = thr; + lkp->lk_lockholder = pid; if (lkp->lk_exclusivecount != 0) panic("lockmgr: non-zero exclusive count"); lkp->lk_exclusivecount = 1; @@ -364,7 +364,7 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) /* FALLTHROUGH exclusive request */ case LK_EXCLUSIVE: - if (lkp->lk_lockholder == thr && thr != LK_KERNPROC) { + if (lkp->lk_lockholder == pid && pid != LK_KERNPROC) { /* * Recursive lock. */ @@ -398,7 +398,7 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) if (error) break; lkp->lk_flags |= LK_HAVE_EXCL; - lkp->lk_lockholder = thr; + lkp->lk_lockholder = pid; if (lkp->lk_exclusivecount != 0) panic("lockmgr: non-zero exclusive count"); lkp->lk_exclusivecount = 1; @@ -411,10 +411,10 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) case LK_RELEASE: if (lkp->lk_exclusivecount != 0) { - if (lkp->lk_lockholder != thr && + if (lkp->lk_lockholder != pid && lkp->lk_lockholder != LK_KERNPROC) { - panic("lockmgr: thread %p, not %s %p unlocking", - thr, "exclusive lock holder", + panic("lockmgr: pid %d, not %s %d unlocking", + pid, "exclusive lock holder", lkp->lk_lockholder); } if (lkp->lk_exclusivecount == 1) { @@ -437,14 +437,14 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) * check for holding a shared lock, but at least we can * check for an exclusive one. */ - if (lkp->lk_lockholder == thr) + if (lkp->lk_lockholder == pid) panic("lockmgr: draining against myself"); error = acquiredrain(lkp, extflags); if (error) break; lkp->lk_flags |= LK_DRAINING | LK_HAVE_EXCL; - lkp->lk_lockholder = thr; + lkp->lk_lockholder = pid; lkp->lk_exclusivecount = 1; #if defined(DEBUG_LOCKS) lkp->lk_filename = file; @@ -589,7 +589,7 @@ lockstatus(lkp, td) mtx_lock(lkp->lk_interlock); if (lkp->lk_exclusivecount != 0) { - if (td == NULL || lkp->lk_lockholder == td) + if (td == NULL || lkp->lk_lockholder == td->td_proc->p_pid) lock_type = LK_EXCLUSIVE; else lock_type = LK_EXCLOTHER; @@ -627,7 +627,7 @@ lockmgr_printinfo(lkp) printf(" lock type %s: SHARED (count %d)", lkp->lk_wmesg, lkp->lk_sharecount); else if (lkp->lk_flags & LK_HAVE_EXCL) - printf(" lock type %s: EXCL (count %d) by thread %p", + printf(" lock type %s: EXCL (count %d) by pid %d", lkp->lk_wmesg, lkp->lk_exclusivecount, lkp->lk_lockholder); if (lkp->lk_waitcount > 0) printf(" with %d pending", lkp->lk_waitcount); |