When a cct is destroyed, tell lockdep so that it can shut down if it needed
it.
Signed-off-by: Sage Weil <sage@inktank.com>
#include "common/debug.h"
#include "common/HeartbeatMap.h"
#include "common/errno.h"
+#include "common/lockdep.h"
#include "log/Log.h"
#include <iostream>
CephContext::~CephContext()
{
+ if (_conf->lockdep) {
+ lockdep_unregister_ceph_context(this);
+ }
+
join_service_thread();
_admin_socket->unregister_command("perfcounters_dump");
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);
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);