diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 2d2af7c4906..cb7c104e5d2 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -570,15 +570,17 @@ void Paxos::handle_lease(MMonPaxos *lease) lease->put(); return; } - - if (lease->sent_timestamp > g_clock.now() + g_conf.mon_clock_drift_allowed) { + utime_t allowed_time; + allowed_time.set_from_double(g_clock.now() + g_conf.mon_clock_drift_allowed); + if (lease->sent_timestamp > allowed_time) { utime_t warn_diff = g_clock.now() - last_clock_drift_warn; if ((last_clock_drift_warn == utime_t()) || - (warn_diff > + (warn_diff > pow(g_conf.mon_clock_drift_warn_backoff, clock_drift_warned))) { stringstream ss; ss << "lease_expire from mon" << lease->get_source().num() << " was sent from future time " << lease->sent_timestamp + << " with expected time <=" << allowed_time << ", clocks not synchronized" << std::endl; mon->get_logclient()->log(LOG_WARN, ss); @@ -648,10 +650,13 @@ void Paxos::handle_lease_ack(MMonPaxos *ack) << " dup (lagging!), ignoring" << dendl; } - if (ack->sent_timestamp > g_clock.now() + g_conf.mon_clock_drift_allowed) { + utime_t allowed_time; + allowed_time.set_from_double(g_clock.now() + g_conf.mon_clock_drift_allowed); + if (ack->sent_timestamp > allowed_time) { stringstream ss; ss << "lease_ack from mon" << from << " was sent from future time " << ack->sent_timestamp + << " with allowed time <=" << allowed_time << ", clocks not synchronized." << std::endl; mon->get_logclient()->log(LOG_WARN, ss); }