Whamcloud - gitweb
Branch: b_cray
authoradilger <adilger>
Mon, 17 Jan 2005 23:45:04 +0000 (23:45 +0000)
committeradilger <adilger>
Mon, 17 Jan 2005 23:45:04 +0000 (23:45 +0000)
Add CRAY_PORTALS-specific debugging hooks.

lnet/libcfs/debug.c
lnet/libcfs/tracefile.c
lnet/utils/portals.c

index 85de4cf..6f2b894 100644 (file)
@@ -81,7 +81,6 @@ static DECLARE_WAIT_QUEUE_HEAD(debug_ctlwq);
 
 char debug_file_path[1024] = "/tmp/lustre-log";
 static char debug_file_name[1024];
-static int handled_panic; /* to avoid recursive calls to notifiers */
 char portals_upcall[1024] = "/usr/lib/lustre/portals_upcall";
 
 void portals_debug_dumplog_internal(void *arg)
@@ -132,9 +131,12 @@ void portals_debug_dumplog(void)
         set_current_state(TASK_RUNNING);
 }
 
+#ifdef PORTALS_DUMP_ON_PANIC
 static int panic_dumplog(struct notifier_block *self, unsigned long unused1,
                          void *unused2)
 {
+        static int handled_panic; /* to avoid recursive calls to notifiers */
+
         if (handled_panic)
                 return 0;
         else
@@ -156,17 +158,34 @@ static struct notifier_block lustre_panic_notifier = {
         next :              NULL,
         priority :          10000
 };
+#endif
+
+#ifdef CRAY_PORTALS
+extern void *lus_portals_debug;
+#endif
 
 int portals_debug_init(unsigned long bufsize)
 {
+#ifdef CRAY_PORTALS
+        lus_portals_debug = &portals_debug_msg;
+#endif
+#ifdef PORTALS_DUMP_ON_PANIC
+        /* This is currently disabled because it spews far too much to the
+         * console on the rare cases it is ever triggered. */
         notifier_chain_register(&panic_notifier_list, &lustre_panic_notifier);
+#endif
         return tracefile_init();
 }
 
 int portals_debug_cleanup(void)
 {
         tracefile_exit();
+#ifdef PORTALS_DUMP_ON_PANIC
         notifier_chain_unregister(&panic_notifier_list, &lustre_panic_notifier);
+#endif
+#ifdef CRAY_PORTALS
+        lus_portals_debug = NULL;
+#endif
         return 0;
 }
 
index 6018a3d..3bd2c01 100644 (file)
@@ -207,6 +207,10 @@ void portals_debug_msg(int subsys, int mask, char *file, const char *fn,
         unsigned long flags;
         struct timeval tv;
 
+#ifdef CRAY_PORTALS
+        if (mask == D_PORTALS && !(portal_debug & D_PORTALS))
+                return;
+#endif
         if (strchr(file, '/'))
                 file = strrchr(file, '/') + 1;
 
index 9dc47da..70440e0 100644 (file)
@@ -238,8 +238,8 @@ ptl_gethostbyname(char * hname) {
                                 hname);
                         break;
                 default:
-                        fprintf(stderr, "gethostbyname error: %s\n",
-                                strerror(errno));
+                        fprintf(stderr, "gethostbyname error for %s: %s\n",
+                                hname, strerror(h_errno));
                         break;
                 }
                 return NULL;