summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_lockf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c
index 86855ea34836..6c96c9c0a485 100644
--- a/sys/kern/kern_lockf.c
+++ b/sys/kern/kern_lockf.c
@@ -234,6 +234,7 @@ lf_setlock(lock)
/* The block is waiting on something */
wproc = (struct proc *)block->lf_id;
+ mtx_lock_spin(&sched_lock);
while (wproc->p_wchan &&
(wproc->p_wmesg == lockstr) &&
(i++ < maxlockdepth)) {
@@ -244,10 +245,12 @@ lf_setlock(lock)
break;
wproc = (struct proc *)waitblock->lf_id;
if (wproc == (struct proc *)lock->lf_id) {
+ mtx_unlock_spin(&sched_lock);
free(lock, M_LOCKF);
return (EDEADLK);
}
}
+ mtx_unlock_spin(&sched_lock);
}
/*
* For flock type locks, we must first remove