Protect p_wmesg and p_wchan with sched_lock while checking for deadlocks
with other byte range file locks.
This commit is contained in:
parent
386deae89c
commit
8d2725181a
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user