summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_alq.c
diff options
context:
space:
mode:
authorlstewart <lstewart@FreeBSD.org>2013-06-17 09:49:07 +0000
committerlstewart <lstewart@FreeBSD.org>2013-06-17 09:49:07 +0000
commit4f358ad954443ab3df8ac3ddda5deb7fba336584 (patch)
tree5dea88510b2e37a46af34894f51d5fb71274d4ff /sys/kern/kern_alq.c
parent95ba85598a3f78e22697c60c43da43d596b594e9 (diff)
downloadFreeBSD-src-4f358ad954443ab3df8ac3ddda5deb7fba336584.zip
FreeBSD-src-4f358ad954443ab3df8ac3ddda5deb7fba336584.tar.gz
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
Diffstat (limited to 'sys/kern/kern_alq.c')
-rw-r--r--sys/kern/kern_alq.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_alq.c b/sys/kern/kern_alq.c
index daf4e46..1e6fcf7 100644
--- a/sys/kern/kern_alq.c
+++ b/sys/kern/kern_alq.c
@@ -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 {
OpenPOWER on IntegriCloud