core timer: don't hang when the clock goes back.

If the clock shifts back, don't hang in a loop of running
process_masterspan from the timer interrupt forever.

Fixes a regression of r9407.

(closes issue #19035)
Reported by: tzafrir

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

After talking with Tzafrir on IRC, I combined the check if your far ahead
with the check if you're behind and added a '\n' at the end of the
existing "detected time shift" message.  That is why this patch is
different than what is posted on issue #19035.

Acked-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9876 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Tzafrir Cohen 2011-04-04 16:24:26 +00:00 committed by Shaun Ruffell
parent c166c172dc
commit 1c42df4cd1

View File

@ -8971,15 +8971,15 @@ static void coretimer_func(unsigned long param)
/* /*
* If the system time has changed, it is possible for us to be * If the system time has changed, it is possible for us to be
* far behind. If we are more than MS_LIMIT milliseconds * far behind. If we are more than MS_LIMIT milliseconds
* behind, just reset our time base and continue so that we do * behind (or ahead in time), just reset our time base and
* not hang the system here. * continue so that we do not hang the system here.
* *
*/ */
difference = ms_since_start - msecs_processed(&core_timer); difference = ms_since_start - msecs_processed(&core_timer);
if (unlikely(difference > MS_LIMIT)) { if (unlikely((difference > MS_LIMIT) || (difference < 0))) {
if (printk_ratelimit()) { if (printk_ratelimit()) {
module_printk(KERN_INFO, module_printk(KERN_INFO,
"Detected time shift."); "Detected time shift.\n");
} }
atomic_set(&core_timer.count, 0); atomic_set(&core_timer.count, 0);
atomic_set(&core_timer.last_count, 0); atomic_set(&core_timer.last_count, 0);