]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: defer cancelling the timer event
authorXiubo Li <xiubli@redhat.com>
Tue, 11 Aug 2020 02:03:11 +0000 (10:03 +0800)
committerXiubo Li <xiubli@redhat.com>
Mon, 31 Aug 2020 01:12:14 +0000 (21:12 -0400)
If there has to much data need to flush or the osd couldn't handle
writting the data to disk and response on time, the client will be
blacklisted by mds.

Let's just defer cancelling the timer event just before closing
the mds sessions.

Fixes: https://tracker.ceph.com/issues/46905
Signed-off-by: Xiubo Li <xiubli@redhat.com>
src/client/Client.cc
src/client/Client.h

index a2c7dcc1ddba1a7ffcf0d2af81a228799c84658f..2a96ea71eef831fa1007bdd1a78c1e88b56a2d5b 100755 (executable)
@@ -6217,6 +6217,7 @@ void Client::_unmount(bool abort)
   deleg_timeout = 0;
 
   if (abort) {
+    mount_aborted = true;
     // Abort all mds sessions
     _abort_mds_sessions(-ENOTCONN);
 
@@ -6234,13 +6235,6 @@ void Client::_unmount(bool abort)
     return mds_requests.empty();
   });
 
-  {
-    std::scoped_lock l(timer_lock);
-    if (tick_event)
-      timer.cancel_event(tick_event);
-    tick_event = 0;
-  }
-
   cwd.reset();
 
   // clean up any unclosed files
@@ -6327,6 +6321,13 @@ void Client::_unmount(bool abort)
     traceout.close();
   }
 
+  {
+    std::scoped_lock l(timer_lock);
+    if (tick_event)
+      timer.cancel_event(tick_event);
+    tick_event = 0;
+  }
+
   _close_sessions();
 
   mref_writer.update_state(CLIENT_UNMOUNTED);
@@ -6401,7 +6402,7 @@ void Client::tick()
     }
   }
 
-  if (mdsmap->get_epoch()) {
+  if (!mount_aborted && mdsmap->get_epoch()) {
     // renew caps?
     utime_t el = now - last_cap_renew;
     if (el > mdsmap->get_session_timeout() / 3.0)
@@ -6415,13 +6416,15 @@ void Client::tick()
   while (!p.end()) {
     Inode *in = *p;
     ++p;
-    if (in->hold_caps_until > now)
+    if (!mount_aborted && in->hold_caps_until > now)
       break;
     delayed_list.pop_front();
-    check_caps(in, CHECK_CAPS_NODELAY);
+    if (!mount_aborted)
+      check_caps(in, CHECK_CAPS_NODELAY);
   }
 
-  collect_and_send_metrics();
+  if (!mount_aborted)
+    collect_and_send_metrics();
 
   trim_cache(true);
 
index b1d9ba9f969c17558385b73cc6f34433f802c02d..c1b4f57c1a4590d529c1c2ff876f7aa538c26dcb 100644 (file)
@@ -1367,6 +1367,7 @@ private:
   ceph::unordered_set<dir_result_t*> opened_dirs;
   uint64_t fd_gen = 1;
 
+  bool   mount_aborted = false;
   bool   blocklisted = false;
 
   ceph::unordered_map<vinodeno_t, Inode*> inode_map;