From: Mingxin Liu Date: Mon, 16 Jan 2017 03:54:34 +0000 (+0800) Subject: OSDMonitor: calculate failure time only when osd reported failed X-Git-Tag: v12.0.0~117^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F12938%2Fhead;p=ceph.git OSDMonitor: calculate failure time only when osd reported failed Signed-off-by: Mingxin Liu --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index aa27215ed1c8..9ae2cf18c14c 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -1759,13 +1759,12 @@ bool OSDMonitor::prepare_failure(MonOpRequestRef op) assert(osdmap.is_up(target_osd)); assert(osdmap.get_addr(target_osd) == m->get_target().addr); - // calculate failure time - utime_t now = ceph_clock_now(); - utime_t failed_since = - m->get_recv_stamp() - - utime_t(m->failed_for ? m->failed_for : g_conf->osd_heartbeat_grace, 0); - if (m->if_osd_failed()) { + // calculate failure time + utime_t now = ceph_clock_now(); + utime_t failed_since = + m->get_recv_stamp() - utime_t(m->failed_for, 0); + // add a report if (m->is_immediate()) { mon->clog->debug() << m->get_target() << " reported immediately failed by "