[2/5] 3.10.y: timekeeping: Fix lost updates to tai adjustment

Message ID 1392066713-5025-3-git-send-email-john.stultz@linaro.org
State New
Headers show

Commit Message

John Stultz Feb. 10, 2014, 9:11 p.m.
This is a 3.10-stable backport of f55c07607a38f84b5c7e6066ee1cfe433fa5643c

Since 48cdc135d4840 (Implement a shadow timekeeper), we have to
call timekeeping_update() after any adjustment to the timekeeping
structure in order to make sure that any adjustments to the structure

Unfortunately, the updates to the tai offset via adjtimex do not
trigger this update, causing adjustments to the tai offset to be
made and then over-written by the previous value at the next
update_wall_time() call.

This patch resovles the issue by calling timekeeping_update()
right after setting the tai offset.

Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: stable <stable@vger.kernel.org> #3.10+
Signed-off-by: John Stultz <john.stultz@linaro.org>
 kernel/time/timekeeping.c | 2 ++
 1 file changed, 2 insertions(+)


diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 1c5b0fc..88c2b8b 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -605,6 +605,7 @@  void timekeeping_set_tai_offset(s32 tai_offset)
 	raw_spin_lock_irqsave(&timekeeper_lock, flags);
 	__timekeeping_set_tai_offset(tk, tai_offset);
+	timekeeping_update(tk, false, true);
 	raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
@@ -1677,6 +1678,7 @@  int do_adjtimex(struct timex *txc)
 	if (tai != orig_tai) {
 		__timekeeping_set_tai_offset(tk, tai);
+		timekeeping_update(tk, false, true);