[-mm PATCH 6/11] Time: generic timekeeping infrastructure - fix ntp_synced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Call ntp_synced() is frequently enough. This fixes a potential bug where 
when ntp_synced is called, it isn't close enough to the second boundery 
(which is tested inside ntp_synced()). Without this its possible that since 
we only called it once a second, it would never sync the persistent clock.

Signed-off-by: John Stultz <[email protected]>

 kernel/time/timeofday.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Index: mm-merge/kernel/time/timeofday.c
===================================================================
--- mm-merge.orig/kernel/time/timeofday.c
+++ mm-merge/kernel/time/timeofday.c
@@ -534,7 +534,7 @@ static void timeofday_periodic_hook(unsi
 	/* advance the ntp state machine by ns interval: */
 	ntp_advance(delta_nsec);
 
-	/* only call ntp_leapsecond and ntp_sync once a sec:  */
+	/* only call ntp_leapsecond once a sec:  */
 	second_check += delta_nsec;
 	if (second_check >= NSEC_PER_SEC) {
 		/* do ntp leap second processing: */
@@ -545,11 +545,11 @@ static void timeofday_periodic_hook(unsi
 			wall_time_ts.tv_sec += leapsecond;
 			monotonic_time_offset_ts.tv_sec += leapsecond;
 		}
-		/* sync the persistent clock: */
-		if (ntp_synced())
-			sync_persistent_clock(wall_time_ts);
 		second_check -= NSEC_PER_SEC;
 	}
+	/* sync the persistent clock: */
+	if (ntp_synced())
+		sync_persistent_clock(wall_time_ts);
 
 	/* if necessary, switch clocksources: */
 	next = get_next_clocksource();
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux