From: Ryan Haasken Date: Wed, 5 Mar 2014 15:23:07 +0000 (-0600) Subject: LU-4711 libcfs: Always clamp cdls_delay between min and max X-Git-Tag: 2.5.59~111 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=54420e975ac13d2ad8dab8ad869222a668d67b1d;hp=5cd7c3f2ab53a07cf98aef83685dafddb13077ed;p=fs%2Flustre-release.git LU-4711 libcfs: Always clamp cdls_delay between min and max In libcfs_debug_vmsg2, cdls_delay is only clamped between the minimum and the maximum when it is increased by multiplying by the backoff factor. It is not clamped when it is decreased by dividing by the backoff factor. This allows it to achieve values less than the minimum, which allows a console message to be printed that should have been skipped. This patch moves the clamping outside of the else statement, ensuring that cdls_delay is always between the min and the max after the first time through libcfs_debug_vmsg2. Signed-off-by: Ryan Haasken Change-Id: I5e587292b73b4c61ef306908fa10d324da5ce069 Reviewed-on: http://review.whamcloud.com/9503 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Chris Horn Reviewed-by: Ann Koehler Reviewed-by: Andreas Dilger --- diff --git a/libcfs/libcfs/tracefile.c b/libcfs/libcfs/tracefile.c index 0f65ae7..e24f66b 100644 --- a/libcfs/libcfs/tracefile.c +++ b/libcfs/libcfs/tracefile.c @@ -418,13 +418,13 @@ console: cdls->cdls_delay /= libcfs_console_backoff * 4; } else { cdls->cdls_delay *= libcfs_console_backoff; - - if (cdls->cdls_delay < libcfs_console_min_delay) - cdls->cdls_delay = libcfs_console_min_delay; - else if (cdls->cdls_delay > libcfs_console_max_delay) - cdls->cdls_delay = libcfs_console_max_delay; } + if (cdls->cdls_delay < libcfs_console_min_delay) + cdls->cdls_delay = libcfs_console_min_delay; + else if (cdls->cdls_delay > libcfs_console_max_delay) + cdls->cdls_delay = libcfs_console_max_delay; + /* ensure cdls_next is never zero after it's been seen */ cdls->cdls_next = (cfs_time_current() + cdls->cdls_delay) | 1; }