DragonFly bugs List (threaded) for 2007-07
DragonFly BSD
DragonFly bugs List (threaded) for 2007-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: [issue713] shutdown freeze and forced unmounts


From: YONETANI Tomokazu <qhwt+dfly@xxxxxxxxxx>
Date: Wed, 11 Jul 2007 13:54:03 +0900

On Tue, Jul 10, 2007 at 07:18:26PM -0400, Peter Avalos wrote:
> Indeed, only kernel threads and init, sh, and ps, but a reboot still freezes
> after "Uptime: xxxx"

. .. which means it's stuck at somewhere at the bottom of boot()
in kern_shutdown.c:
        /*
         * Ok, now do things that assume all filesystem activity has
         * been completed.
         */
        EVENTHANDLER_INVOKE(shutdown_post_sync, howto);
        crit_enter();
        if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold)
                dumpsys();

        /* Now that we're going to really halt the system... */
        EVENTHANDLER_INVOKE(shutdown_final, howto);

        for(;;) ;       /* safety against shutdown_reset not working */
        /* NOTREACHED */

At first I thought it's in cpu_reset(), but since you didn't see
"Rebooting...", it's stuck in one of event handlers for shutdown_post_sync
and not managed to shutdown_reset().  Please try attached patch to
find which handler is the culprit.  Note that you may have to rebuild
modules too, since this patches makes some incompatible changes to
EVENTHANDLER_* APIs.

Cheers.
Index: sys/eventhandler.h
===================================================================
RCS file: /home/source/dragonfly/cvs/src/sys/sys/eventhandler.h,v
retrieving revision 1.7
diff -u -p -r1.7 eventhandler.h
--- sys/eventhandler.h	21 May 2006 03:43:47 -0000	1.7
+++ sys/eventhandler.h	11 Jul 2007 04:31:07 -0000
@@ -43,6 +43,7 @@ struct eventhandler_entry 
     TAILQ_ENTRY(eventhandler_entry)	ee_link;
     int					ee_priority;
     void				*ee_arg;
+    const char				*ee_name;
 };
 
 struct eventhandler_list 
@@ -55,6 +56,7 @@ struct eventhandler_list 
 };
 
 typedef struct eventhandler_entry	*eventhandler_tag;
+extern int eventhandler_show_invoked_funcs;
 
 /* 
  * Fast handler lists require the eventhandler list be present
@@ -85,13 +87,15 @@ do {									\
     struct eventhandler_entry *_ep = TAILQ_FIRST(&(_el->el_entries));	\
 									\
     while (_ep != NULL) {						\
+	if (eventhandler_show_invoked_funcs)				\
+		kprintf("FAST_INVOKE(" #name ") %s\n", _ep->ee_name);	\
 	((struct eventhandler_entry_ ## name *)_ep)->eh_func(_ep->ee_arg , ## args); \
 	_ep = TAILQ_NEXT(_ep, ee_link);					\
     }									\
 } while (0)
 
 #define EVENTHANDLER_FAST_REGISTER(name, func, arg, priority) \
-    eventhandler_register(Xeventhandler_list_ ## name, #name, func, arg, priority)
+    eventhandler_register(Xeventhandler_list_ ## name, #name, #func, func, arg, priority)
 
 #define EVENTHANDLER_FAST_DEREGISTER(name, tag) \
     eventhandler_deregister(Xeventhandler_list ## name, tag)
@@ -121,13 +125,15 @@ do {									\
 	for (_ep = TAILQ_FIRST(&(_el->el_entries));			\
 	     _ep != NULL;						\
 	     _ep = TAILQ_NEXT(_ep, ee_link)) {				\
+	if (eventhandler_show_invoked_funcs)				\
+		kprintf("INVOKE(" #name ") %s\n", _ep->ee_name);	\
 	    ((struct eventhandler_entry_ ## name *)_ep)->eh_func(_ep->ee_arg , ## args); \
 	}								\
     }									\
 } while (0)
 
 #define EVENTHANDLER_REGISTER(name, func, arg, priority) \
-    eventhandler_register(NULL, #name, func, arg, priority)
+    eventhandler_register(NULL, #name, #func, func, arg, priority)
 
 #define EVENTHANDLER_DEREGISTER(name, tag) 		\
 do {							\
@@ -141,6 +147,7 @@ do {							\
 #ifdef _KERNEL
 extern eventhandler_tag	eventhandler_register(struct eventhandler_list *list, 
 					      char *name,
+					      const char *fname,
 					      void *func, 
 					      void *arg, 
 					      int priority);
Index: kern/subr_eventhandler.c
===================================================================
RCS file: /home/source/dragonfly/cvs/src/sys/kern/subr_eventhandler.c,v
retrieving revision 1.5
diff -u -p -r1.5 subr_eventhandler.c
--- kern/subr_eventhandler.c	5 Sep 2006 03:48:12 -0000	1.5
+++ kern/subr_eventhandler.c	11 Jul 2007 04:13:07 -0000
@@ -35,6 +35,8 @@
 
 MALLOC_DEFINE(M_EVENTHANDLER, "eventhandler", "Event handler records");
 
+int eventhandler_show_invoked_funcs = 0;
+
 /* List of 'slow' lists */
 static TAILQ_HEAD(, eventhandler_list)	eventhandler_lists;
 static int				eventhandler_lists_initted = 0;
@@ -50,8 +52,8 @@ struct eventhandler_entry_generic 
  * if all priorities are identical.
  */
 eventhandler_tag
-eventhandler_register(struct eventhandler_list *list, char *name, 
-		      void *func, void *arg, int priority)
+eventhandler_register(struct eventhandler_list *list, char *name,
+		      const char *funcname, void *func, void *arg, int priority)
 {
     struct eventhandler_entry_generic	*eg;
     struct eventhandler_entry		*ep;
@@ -88,6 +90,7 @@ eventhandler_register(struct eventhandle
     eg->func = func;
     eg->ee.ee_arg = arg;
     eg->ee.ee_priority = priority;
+    eg->ee.ee_name = funcname;
     
     /* sort it into the list */
     for (ep = TAILQ_FIRST(&list->el_entries);


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]