]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMonitor: calculate failure time only when osd reported failed 12938/head
authorMingxin Liu <mingxin@xsky.com>
Mon, 16 Jan 2017 03:54:34 +0000 (11:54 +0800)
committerMingxin Liu <mingxin@xsky.com>
Wed, 18 Jan 2017 11:16:19 +0000 (19:16 +0800)
Signed-off-by: Mingxin Liu <mingxin@xsky.com>
src/mon/OSDMonitor.cc

index aa27215ed1c83b2b0cb1ec4def0916beaf1d5872..9ae2cf18c14cad69abf4314da078cb103c4129cb 100644 (file)
@@ -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 "