diff options
author | jhb <jhb@FreeBSD.org> | 2001-09-13 22:33:37 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-09-13 22:33:37 +0000 |
commit | 82bc2ba4e0e5e627bb8f4a33df86823fae16b6cf (patch) | |
tree | 3ea9c98e18153099e9d7e1d8b55c3615bd2cc150 /sys/kern/kern_lock.c | |
parent | 32d08d421501590328d8097bd5a2ce21899b3277 (diff) | |
download | FreeBSD-src-82bc2ba4e0e5e627bb8f4a33df86823fae16b6cf.zip FreeBSD-src-82bc2ba4e0e5e627bb8f4a33df86823fae16b6cf.tar.gz |
Fix locking on td_flags for TDF_DEADLKTREAT. If the comments in the code
are true that curthread can change during this function, then this flag
needs to become a KSE flag, not a thread flag.
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r-- | sys/kern/kern_lock.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 3f8373b..a2835c3 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -263,14 +263,10 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) */ if (lkp->lk_lockholder != pid) { lockflags = LK_HAVE_EXCL; - if (td) { - PROC_LOCK(td->td_proc); - if (!(td->td_flags & TDF_DEADLKTREAT)) { - lockflags |= LK_WANT_EXCL | - LK_WANT_UPGRADE; - } - PROC_UNLOCK(td->td_proc); - } + mtx_lock_spin(&sched_lock); + if (td != NULL && !(td->td_flags & TDF_DEADLKTREAT)) + lockflags |= LK_WANT_EXCL | LK_WANT_UPGRADE; + mtx_unlock_spin(&sched_lock); error = acquire(lkp, extflags, lockflags); if (error) break; |