svn commit: r251838 - head/sys/kern

Lawrence Stewart lstewart at FreeBSD.org
Mon Jun 17 09:49:08 UTC 2013


Author: lstewart
Date: Mon Jun 17 09:49:07 2013
New Revision: 251838
URL: http://svnweb.freebsd.org/changeset/base/251838

Log:
  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

Modified:
  head/sys/kern/kern_alq.c

Modified: head/sys/kern/kern_alq.c
==============================================================================
--- head/sys/kern/kern_alq.c	Mon Jun 17 08:57:09 2013	(r251837)
+++ head/sys/kern/kern_alq.c	Mon Jun 17 09:49:07 2013	(r251838)
@@ -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,
 		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 {


More information about the svn-src-head mailing list