Whamcloud - gitweb
LU-12349 llite: console message for disabled flock call
[fs/lustre-release.git] / libcfs / libcfs / tracefile.c
index 6e6a28f..81e9fb2 100644 (file)
@@ -358,9 +358,16 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
                         break;
         }
 
-       if (*(string_buf+needed-1) != '\n')
+       if (*(string_buf + needed - 1) != '\n') {
                printk(KERN_INFO "format at %s:%d:%s doesn't end in "
                       "newline\n", file, msgdata->msg_line, msgdata->msg_fn);
+       } else if (mask & D_TTY) {
+               /* TTY needs '\r\n' to move carriage to leftmost position */
+               if (needed < 2 || *(string_buf + needed - 2) != '\r')
+                       printk(KERN_INFO "format at %s:%d:%s doesn't end in "
+                              "'\\r\\n'\n", file, msgdata->msg_line,
+                              msgdata->msg_fn);
+       }
 
         header.ph_len = known_size + needed;
        debug_buf = (char *)page_address(tage->page) + tage->used;
@@ -397,7 +404,7 @@ console:
        if (cdls != NULL) {
                if (libcfs_console_ratelimit &&
                    cdls->cdls_next != 0 &&     /* not first time ever */
-                   time_after(jiffies, cdls->cdls_next)) {
+                   time_before(jiffies, cdls->cdls_next)) {
                        /* skipping a console message */
                        cdls->cdls_count++;
                        if (tcd != NULL)
@@ -461,8 +468,9 @@ console:
                                   cdls->cdls_count,
                                   (cdls->cdls_count > 1) ? "s" : "");
 
-                cfs_print_to_console(&header, mask,
-                                     string_buf, needed, file, msgdata->msg_fn);
+               /* Do not allow print this to TTY */
+               cfs_print_to_console(&header, mask & ~D_TTY, string_buf,
+                                    needed, file, msgdata->msg_fn);
 
                put_cpu();
                 cdls->cdls_count = 0;
@@ -833,13 +841,16 @@ int cfs_trace_daemon_command(char *str)
                 cfs_tracefile_write_lock();
                 memset(cfs_tracefile, 0, sizeof(cfs_tracefile));
 
-        } else if (strncmp(str, "size=", 5) == 0) {
-                cfs_tracefile_size = simple_strtoul(str + 5, NULL, 0);
-                if (cfs_tracefile_size < 10 || cfs_tracefile_size > 20480)
-                        cfs_tracefile_size = CFS_TRACEFILE_SIZE;
-                else
-                        cfs_tracefile_size <<= 20;
+       } else if (strncmp(str, "size=", 5) == 0) {
+               unsigned long tmp;
 
+               rc = kstrtoul(str + 5, 10, &tmp);
+               if (!rc) {
+                       if (tmp < 10 || tmp > 20480)
+                               cfs_tracefile_size = CFS_TRACEFILE_SIZE;
+                       else
+                               cfs_tracefile_size = tmp << 20;
+               }
         } else if (strlen(str) >= sizeof(cfs_tracefile)) {
                 rc = -ENAMETOOLONG;
         } else if (str[0] != '/') {