Commit b7d0254c authored by Ryan Haasken's avatar Ryan Haasken Committed by Greg Kroah-Hartman

staging/lustre: 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: default avatarRyan Haasken <haasken@cray.com>
Reviewed-on: http://review.whamcloud.com/9503
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4711Reviewed-by: default avatarChris Horn <hornc@cray.com>
Reviewed-by: default avatarAnn Koehler <amk@cray.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent beaa2647
......@@ -416,13 +416,13 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment