From 4037c1462730c120af00bd0e95b08fe0669e0271 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Tue, 18 Sep 2018 12:45:49 +0800 Subject: [PATCH] LU-11373 libcfs: fix wrong check in libcfs_debug_vmsg2() 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 Signed-off-by: Wang Shilong Change-Id: Idb2ecfe5ddadc72d8931e6623b171b9c773ebbe5 Reviewed-on: https://review.whamcloud.com/33154 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons --- libcfs/libcfs/tracefile.c | 2 +- lustre/tests/sanity.sh | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/libcfs/libcfs/tracefile.c b/libcfs/libcfs/tracefile.c index 54e0fab..f9d96d1 100644 --- a/libcfs/libcfs/tracefile.c +++ b/libcfs/libcfs/tracefile.c @@ -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) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 51206c2..2ddbef3 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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 } -- 1.8.3.1