summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2001-02-09 16:27:41 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2001-02-09 16:27:41 +0000
commit635962afdf2bb45fc63c88d1b956dda0f5cb7a05 (patch)
tree5adb7cd2dbb7d969e79ef3588ebf5873ed2b0f37
parent929604ec9bf17bb48ce26175cf474fc972ffa502 (diff)
Notes
-rw-r--r--sys/kern/kern_lock.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index d5987f518c7f..5b02c5fe914a 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -224,7 +224,7 @@ debuglockmgr(lkp, flags, interlkp, p, name, file, line)
{
int error;
pid_t pid;
- int extflags;
+ int extflags, lockflags;
CTR5(KTR_LOCKMGR,
"lockmgr(): lkp == %p (lk_wmesg == \"%s\"), flags == 0x%x, "
@@ -255,20 +255,16 @@ debuglockmgr(lkp, flags, interlkp, p, name, file, line)
* lock itself ).
*/
if (lkp->lk_lockholder != pid) {
- if (p && (p->p_flag & P_DEADLKTREAT)) {
- error = acquire(
- lkp,
- extflags,
- LK_HAVE_EXCL
- );
- } else {
- error = acquire(
- lkp,
- extflags,
- LK_HAVE_EXCL | LK_WANT_EXCL |
- LK_WANT_UPGRADE
- );
+ lockflags = LK_HAVE_EXCL;
+ if (p) {
+ PROC_LOCK(p);
+ if (!p->p_flag & P_DEADLKTREAT) {
+ lockflags |= LK_WANT_EXCL |
+ LK_WANT_UPGRADE;
+ }
+ PROC_UNLOCK(p);
}
+ error = acquire(lkp, extflags, lockflags);
if (error)
break;
sharelock(lkp, 1);