epoch(9): fix potential deadlock
Don't acquire a waiting thread's lock while holding our own Approved by: sbruno
This commit is contained in:
parent
4ffa3682bf
commit
32052b0186
@ -407,9 +407,13 @@ epoch_block_handler(struct ck_epoch *global __unused, ck_epoch_record_t *cr,
|
||||
* restore on exit from epoch_wait().
|
||||
*/
|
||||
if (!TD_IS_INHIBITED(tdwait) && tdwait->td_priority > td->td_priority) {
|
||||
critical_enter();
|
||||
thread_unlock(td);
|
||||
thread_lock(tdwait);
|
||||
sched_prio(tdwait, td->td_priority);
|
||||
thread_unlock(tdwait);
|
||||
thread_lock(td);
|
||||
critical_exit();
|
||||
}
|
||||
if (TD_IS_INHIBITED(tdwait) && TD_ON_LOCK(tdwait) &&
|
||||
((ts = tdwait->td_blocked) != NULL)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user