]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: notify and stop the tick thread when destructing the Client
authorXiubo Li <xiubli@redhat.com>
Thu, 11 Mar 2021 10:11:03 +0000 (18:11 +0800)
committerXiubo Li <xiubli@redhat.com>
Thu, 11 Mar 2021 10:37:00 +0000 (18:37 +0800)
When the test is aborted and it won't get any chance to run the
Client::unmount() and Client::shutdown() functions, so the tick
thread may still running and will access the cct->_conf when it
is destructing, which will case crash.

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

index d7b3831567d0bdd94b8e9d167f2db47591085bbd..f667d2a3cdb186a92d9df6a0725bedaa4d4d708e 100644 (file)
@@ -347,6 +347,14 @@ Client::~Client()
 {
   ceph_assert(ceph_mutex_is_not_locked(client_lock));
 
+  // If the task is crashed or aborted and doesn't
+  // get any chance to run the umount and shutdow.
+  {
+    std::scoped_lock l{client_lock};
+    tick_thread_stopped = true;
+    upkeep_cond.notify_one();
+  }
+
   if (upkeeper.joinable())
     upkeeper.join();