The wakeup() line from the rev. 1.319 is wrong and reintroduces
a panic race on module unload. The wakeup() is internal to kproc_exit/kthread_exit. The correct fix is to fix the msleep() in detach to sleep on fdc->fdc_thread instead of &fdc->fdc_thread. Noted and reviewed by: jhb Pointy hat to: kib MFC after: 1 week
This commit is contained in:
parent
8032f44d5f
commit
508466854a
@ -1205,7 +1205,6 @@ fdc_thread(void *arg)
|
||||
mtx_lock(&fdc->fdc_mtx);
|
||||
}
|
||||
fdc->flags &= ~(FDC_KTHREAD_EXIT | FDC_KTHREAD_ALIVE);
|
||||
wakeup(&fdc->fdc_thread);
|
||||
mtx_unlock(&fdc->fdc_mtx);
|
||||
|
||||
kproc_exit(0);
|
||||
@ -1721,7 +1720,7 @@ fdc_detach(device_t dev)
|
||||
fdc->flags |= FDC_KTHREAD_EXIT;
|
||||
wakeup(&fdc->head);
|
||||
while ((fdc->flags & FDC_KTHREAD_ALIVE) != 0)
|
||||
msleep(&fdc->fdc_thread, &fdc->fdc_mtx, PRIBIO, "fdcdet", 0);
|
||||
msleep(fdc->fdc_thread, &fdc->fdc_mtx, PRIBIO, "fdcdet", 0);
|
||||
mtx_unlock(&fdc->fdc_mtx);
|
||||
|
||||
/* reset controller, turn motor off */
|
||||
|
Loading…
Reference in New Issue
Block a user