Whamcloud - gitweb
LU-11373 libcfs: fix wrong check in libcfs_debug_vmsg2() 54/33154/5
authorWang Shilong <wshilong@ddn.com>
Tue, 18 Sep 2018 04:45:49 +0000 (12:45 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 1 Oct 2018 14:00:59 +0000 (14:00 +0000)
Logic here is we skip output if time is before @cdls_next
reach and increase @cdls_count. however we did it in the
opposite way:

1)libcfs_debug_vmsg2() is called for a long time, that means
current check succeed, we skip print messages and return, we
will skip all messages later too..

2)libcfs_debug_vmsg2() is called frequently, current check
fail every time, message will be bumped out always. the
worst case is we never skip any messages.

Also fix test case to cover this later which is from Andreas:

The test_60a() llog test is being run on the MGS, while the
check in test_60b() to confirm that CDEBUG_LIMIT() works properly
is being run on the client.  There has been a breakage in
CDEBUG_LIMIT() that this test failed to catch, now we need to
track it down.

Change test_60b to dump the dmesg logs on the MGS.

Fixes: fdb5d3d50
Test-parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: Idb2ecfe5ddadc72d8931e6623b171b9c773ebbe5
Reviewed-on: https://review.whamcloud.com/33154
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
libcfs/libcfs/tracefile.c
lustre/tests/sanity.sh

index 54e0fab..f9d96d1 100644 (file)
@@ -397,7 +397,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)
index 51206c2..2ddbef3 100755 (executable)
@@ -6281,18 +6281,19 @@ test_60b() { # bug 6411
        [ $PARALLEL == "yes" ] && skip "skip parallel run"
 
        dmesg > $DIR/$tfile
-       LLOG_COUNT=$(dmesg | awk "/$TEST60_HEAD/ { marker = 1; from_marker = 0; }
-                               /llog.test/ {
-                                       if (marker)
-                                               from_marker++
-                                       from_begin++
-                               }
-                               END {
-                                       if (marker)
-                                               print from_marker
-                                       else
-                                               print from_begin
-                               }")
+       LLOG_COUNT=$(do_facet mgs dmesg |
+                    awk "/$TEST60_HEAD/ { marker = 1; from_marker = 0; }
+                         /llog_[a-z]*.c:[0-9]/ {
+                               if (marker)
+                                       from_marker++
+                               from_begin++
+                         }
+                         END {
+                               if (marker)
+                                       print from_marker
+                               else
+                                       print from_begin
+                         }")
        [[ $LLOG_COUNT -gt 100 ]] &&
                error "CDEBUG_LIMIT not limiting messages ($LLOG_COUNT)" || true
 }