From: Xiubo Li Date: Thu, 11 Mar 2021 10:11:03 +0000 (+0800) Subject: client: notify and stop the tick thread when destructing the Client X-Git-Tag: v17.1.0~2593^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f55ddd9437b2c7cf8f8d28b30d5f27f3bdc0c5e0;p=ceph.git client: notify and stop the tick thread when destructing the Client 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 --- diff --git a/src/client/Client.cc b/src/client/Client.cc index d7b3831567d..f667d2a3cdb 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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();