diff options
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r-- | sys/kern/kern_lock.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index d5987f5..5b02c5f 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); |