diff --git a/lnet/libcfs/debug.c b/lnet/libcfs/debug.c index c1601d8ad8070f2f81edbfc72cbda0d6542b1d6d..b50ee4df897f79e9351b09781537ee5bf298282e 100644 --- a/lnet/libcfs/debug.c +++ b/lnet/libcfs/debug.c @@ -41,7 +41,7 @@ unsigned int libcfs_debug = (D_EMERG | D_ERROR | D_WARNING | D_CONSOLE | D_NETERROR | D_HA | D_CONFIG | D_IOCTL); EXPORT_SYMBOL(libcfs_debug); -unsigned int libcfs_printk; +unsigned int libcfs_printk = D_CANTMASK; EXPORT_SYMBOL(libcfs_printk); unsigned int libcfs_console_ratelimit = 0; @@ -698,10 +698,8 @@ libcfs_debug_vmsg2(cfs_debug_limit_state_t *cdls, /* toconsole == 0 - all messages to debug_file_fd * toconsole == 1 - warnings to console, all to debug_file_fd * toconsole > 1 - all debug to console */ - if ( ((mask & D_CANTMASK) && - (toconsole == 1)) || (toconsole > 1)) { + if (((mask & libcfs_printk) && toconsole == 1) || toconsole > 1) console = 1; - } #endif if ((!console) && (!debug_file_fd)) { diff --git a/lnet/libcfs/linux/linux-proc.c b/lnet/libcfs/linux/linux-proc.c index c317a5abf832e93a37291fba119d08f00a960ee1..3be3bee5334242aee4b5e735810b6ca884ee59b0 100644 --- a/lnet/libcfs/linux/linux-proc.c +++ b/lnet/libcfs/linux/linux-proc.c @@ -121,11 +121,12 @@ static int __proc_dobitmasks(void *data, int write, int rc; unsigned int *mask = data; int is_subsys = (mask == &libcfs_subsystem_debug) ? 1 : 0; + int is_printk = (mask == &libcfs_printk) ? 1 : 0; rc = trace_allocate_string_buffer(&tmpstr, tmpstrlen); if (rc < 0) return rc; - + if (!write) { libcfs_debug_mask2str(tmpstr, tmpstrlen, *mask, is_subsys); rc = strlen(tmpstr); @@ -140,8 +141,11 @@ static int __proc_dobitmasks(void *data, int write, rc = trace_copyin_string(tmpstr, tmpstrlen, buffer, nob); if (rc < 0) return rc; - + rc = libcfs_debug_str2mask(mask, tmpstr, is_subsys); + /* Always print LBUG/LASSERT to console, so keep this mask */ + if (is_printk) + *mask |= D_EMERG; } trace_free_string_buffer(tmpstr, tmpstrlen); diff --git a/lnet/libcfs/linux/linux-tracefile.c b/lnet/libcfs/linux/linux-tracefile.c index d238c52647c5de304199d04ed2c2b1a4b6df7575..59560278a5aad112ca440add917c7d633a514544 100644 --- a/lnet/libcfs/linux/linux-tracefile.c +++ b/lnet/libcfs/linux/linux-tracefile.c @@ -221,7 +221,7 @@ void print_to_console(struct ptldebug_header *hdr, int mask, const char *buf, } else if ((mask & D_WARNING) != 0) { prefix = "Lustre"; ptype = KERN_WARNING; - } else if ((mask & libcfs_printk) != 0 || (mask & D_CONSOLE)) { + } else if ((mask & (D_CONSOLE | libcfs_printk)) != 0) { prefix = "Lustre"; ptype = KERN_INFO; } diff --git a/lnet/libcfs/tracefile.c b/lnet/libcfs/tracefile.c index 3ca5ee8538d80e81bbefde1b1225622c8ad29fd2..a0b61ab3b2804a6fcdfd4acc54f6ec5e6e6a6800 100644 --- a/lnet/libcfs/tracefile.c +++ b/lnet/libcfs/tracefile.c @@ -343,7 +343,7 @@ int libcfs_debug_vmsg2(cfs_debug_limit_state_t *cdls, int subsys, int mask, __LASSERT (tage->used <= CFS_PAGE_SIZE); console: - if (!((mask & D_CANTMASK) != 0 || (mask & libcfs_printk) != 0)) { + if ((mask & libcfs_printk) == 0) { /* no console output requested */ if (tcd != NULL) trace_put_tcd(tcd); diff --git a/lnet/utils/portals.c b/lnet/utils/portals.c index 0f2c1ca7c2a8a5981aa7ba60c7cfadd987e4cd1c..1acddcdf4ef8ca6e777a5cb6df1830fb09fe21f7 100644 --- a/lnet/utils/portals.c +++ b/lnet/utils/portals.c @@ -53,7 +53,7 @@ #include "parser.h" unsigned int libcfs_debug; -unsigned int libcfs_printk; +unsigned int libcfs_printk = D_CANTMASK; static int g_net_set; static __u32 g_net;