]> 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)
committersinguliere <singuliere@autistici.org>
Fri, 19 Mar 2021 18:12:47 +0000 (19:12 +0100)
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>
(cherry picked from commit f55ddd9437b2c7cf8f8d28b30d5f27f3bdc0c5e0)

src/client/Client.cc

index 0695ea2400fffd2cee84aab84584056ef7ff3dc3..34e071fd268ac0c80d9c49354f95e1473c8eb0b1 100644 (file)
@@ -341,6 +341,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();