]> git.apps.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:40:49 +0000 (16:40 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 4982693fcfb722bc8256058f414ca9a0c7b397b0)

 Conflicts:
src/mds/Server.cc
src/mds/Server.h

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

index 3669f538780f7cf1e362e0740c1fa9a002d5603e..88a163df946fb891f5a83baf382acf2dcef999f1 100644 (file)
@@ -941,7 +941,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();
 }
@@ -960,8 +960,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;
@@ -1081,9 +1080,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 97402c2fb9fa91516d4a0d8bdc6fea005b948273..e369eb2bfffe655a61c185ce441b77cf0672fee4 100644 (file)
@@ -89,6 +89,8 @@ private:
   int failed_reconnects;
   bool reconnect_evicting;  // true if I am waiting for evictions to complete
                             // before proceeding to reconnect_gather_finish
+  time reconnect_start = time::min();
+  set<client_t> client_reconnect_gather;  // clients i need a reconnect msg from.
 
   double cap_revoke_eviction_timeout = 0;
 
@@ -114,8 +116,6 @@ public:
   void handle_osd_map();
 
   // -- sessions and recovery --
-  utime_t  reconnect_start;
-  set<client_t> client_reconnect_gather;  // clients i need a reconnect msg from.
   bool waiting_for_reconnect(client_t c) const;
   void dump_reconnect_status(Formatter *f) const;