From: adilger Date: Mon, 17 Jan 2005 23:45:04 +0000 (+0000) Subject: Branch: b_cray X-Git-Tag: v1_7_100~1674 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a98a9571bfa8300fea19983a9a7c49e6af55565c Branch: b_cray Add CRAY_PORTALS-specific debugging hooks. --- diff --git a/lnet/libcfs/debug.c b/lnet/libcfs/debug.c index 85de4cf..6f2b894 100644 --- a/lnet/libcfs/debug.c +++ b/lnet/libcfs/debug.c @@ -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; } diff --git a/lnet/libcfs/tracefile.c b/lnet/libcfs/tracefile.c index 6018a3d..3bd2c01 100644 --- a/lnet/libcfs/tracefile.c +++ b/lnet/libcfs/tracefile.c @@ -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; diff --git a/lnet/utils/portals.c b/lnet/utils/portals.c index 9dc47da..70440e0 100644 --- a/lnet/utils/portals.c +++ b/lnet/utils/portals.c @@ -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;