The fix committed in r250951 replaced the reported panic with a deadlock... gold

star for me. EVENTHANDLER_DEREGISTER() attempts to acquire the lock which is
held by the event handler framework while executing event handler functions,
leading to deadlock.

Move EVENTHANDLER_DEREGISTER() to alq_load_handler() and thus deregister the ALQ
shutdown_pre_sync handler at module unload time, which takes care of the
originally reported panic and fixes the deadlock introduced in r250951.

Reported by:	Luiz Otavio O Souza
MFC after:	3 days
X-MFC with:	250951
This commit is contained in:
Lawrence Stewart 2013-06-17 09:49:07 +00:00
parent 25a2902c04
commit ec41a9a1bd

View File

@ -229,8 +229,6 @@ ald_shutdown(void *arg, int howto)
{
struct alq *alq;
EVENTHANDLER_DEREGISTER(shutdown_pre_sync, alq_eventhandler_tag);
ALD_LOCK();
/* Ensure no new queues can be created. */
@ -938,6 +936,8 @@ alq_load_handler(module_t mod, int what, void *arg)
if (LIST_FIRST(&ald_queues) == NULL) {
ald_shutingdown = 1;
ALD_UNLOCK();
EVENTHANDLER_DEREGISTER(shutdown_pre_sync,
alq_eventhandler_tag);
ald_shutdown(NULL, 0);
mtx_destroy(&ald_mtx);
} else {