From 0ec21a5a8ab9aed8b728c98fb8cb9628bb4672a2 Mon Sep 17 00:00:00 2001 From: Mingxin Liu Date: Mon, 16 Jan 2017 11:54:34 +0800 Subject: [PATCH] OSDMonitor: calculate failure time only when osd reported failed Signed-off-by: Mingxin Liu --- src/mon/OSDMonitor.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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 " -- 2.47.3