]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: use mono_clock for reconnect timeout
authorYan, Zheng <zyan@redhat.com>
Wed, 12 Dec 2018 11:49:40 +0000 (19:49 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 7 Jan 2019 08:44:52 +0000 (16:44 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 4982693fcfb722bc8256058f414ca9a0c7b397b0)

 Conflicts:
src/mds/Server.cc

src/mds/Server.cc
src/mds/Server.h

index caf27260053105febc5ec386265d8770f6e29353..161f29026184c57acb8d2e1fa2e4f413a3d85df8 100644 (file)
@@ -990,7 +990,7 @@ void Server::reconnect_clients(MDSInternalContext *reconnect_done_)
 
   // clients will get the mdsmap and discover we're reconnecting via the monitor.
   
-  reconnect_start = ceph_clock_now();
+  reconnect_start = clock::now();
   dout(1) << "reconnect_clients -- " << client_reconnect_gather.size() << " sessions" << dendl;
   mds->sessionmap.dump();
 }
@@ -1009,8 +1009,7 @@ void Server::handle_client_reconnect(MClientReconnect *m)
     return;
   }
 
-  utime_t delay = ceph_clock_now();
-  delay -= reconnect_start;
+  auto delay = std::chrono::duration<double>(clock::now() - reconnect_start).count();
   dout(10) << " reconnect_start " << reconnect_start << " delay " << delay << dendl;
 
   bool deny = false;
@@ -1234,9 +1233,8 @@ void Server::reconnect_tick()
     return;
   }
 
-  utime_t reconnect_end = reconnect_start;
-  reconnect_end += g_conf->mds_reconnect_timeout;
-  if (ceph_clock_now() >= reconnect_end &&
+  auto elapse = std::chrono::duration<double>(clock::now() - reconnect_start).count();
+  if (elapse >= g_conf->mds_reconnect_timeout &&
       !client_reconnect_gather.empty()) {
     dout(10) << "reconnect timed out" << dendl;
 
index ff906d4b09e149a4b0a640d3bbbc005382f888c0..3b2fb1fa3df721f4918a827b27906aaaa7a8776b 100644 (file)
@@ -89,7 +89,7 @@ private:
   int failed_reconnects;
   bool reconnect_evicting;  // true if I am waiting for evictions to complete
                             // before proceeding to reconnect_gather_finish
-  utime_t  reconnect_start;
+  time reconnect_start = time::min();
   set<client_t> client_reconnect_gather;  // clients i need a reconnect msg from.
 
   feature_bitset_t supported_features;