From: Sage Weil Date: Wed, 11 Jul 2012 15:58:22 +0000 (-0700) Subject: lockdep: stop lockdep when its cct goes away X-Git-Tag: v0.50~87^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c5bcb04b9a33ab8f2bfbc6cf4e759105b32b21b1;p=ceph.git lockdep: stop lockdep when its cct goes away When a cct is destroyed, tell lockdep so that it can shut down if it needed it. Signed-off-by: Sage Weil --- diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index 84a0953cbd96..4134dd785ee8 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -22,6 +22,7 @@ #include "common/debug.h" #include "common/HeartbeatMap.h" #include "common/errno.h" +#include "common/lockdep.h" #include "log/Log.h" #include @@ -250,6 +251,10 @@ CephContext::CephContext(uint32_t module_type_) CephContext::~CephContext() { + if (_conf->lockdep) { + lockdep_unregister_ceph_context(this); + } + join_service_thread(); _admin_socket->unregister_command("perfcounters_dump"); diff --git a/src/common/lockdep.cc b/src/common/lockdep.cc index 1e0c45fa41ff..9dbe5f08bf47 100644 --- a/src/common/lockdep.cc +++ b/src/common/lockdep.cc @@ -64,6 +64,17 @@ void lockdep_register_ceph_context(CephContext *cct) pthread_mutex_unlock(&lockdep_mutex); } +void lockdep_unregister_ceph_context(CephContext *cct) +{ + pthread_mutex_lock(&lockdep_mutex); + if (cct == g_lockdep_ceph_ctx) { + // this cct is going away; shut it down! + g_lockdep = false; + g_lockdep_ceph_ctx = NULL; + } + pthread_mutex_unlock(&lockdep_mutex); +} + int lockdep_dump_locks() { pthread_mutex_lock(&lockdep_mutex); diff --git a/src/common/lockdep.h b/src/common/lockdep.h index 9debdb667710..1dcf05378ee9 100644 --- a/src/common/lockdep.h +++ b/src/common/lockdep.h @@ -20,6 +20,7 @@ class CephContext; extern int g_lockdep; extern void lockdep_register_ceph_context(CephContext *cct); +extern void lockdep_unregister_ceph_context(CephContext *cct); extern int lockdep_register(const char *n); extern int lockdep_will_lock(const char *n, int id); extern int lockdep_locked(const char *n, int id, bool force_backtrace=false);