From 7a49f3da558c663d57928231ffb0c633d0b4e79c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 2 Apr 2014 16:46:30 -0700 Subject: [PATCH] lockdep: do not initialize if already started If we have already registered a cct for lockdep, do not accept another one. We already check that the cct matches when we shut down. This we will run for the life span of a single cct and no longer. Fixes: #7965 Signed-off-by: Sage Weil --- src/common/lockdep.cc | 7 +++++-- src/global/global_init.cc | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/lockdep.cc b/src/common/lockdep.cc index 5c2ee55abaad..e4376eaeda44 100644 --- a/src/common/lockdep.cc +++ b/src/common/lockdep.cc @@ -61,7 +61,10 @@ static BackTrace *follows[MAX_LOCKS][MAX_LOCKS]; // follows[a][b] means b void lockdep_register_ceph_context(CephContext *cct) { pthread_mutex_lock(&lockdep_mutex); - g_lockdep_ceph_ctx = cct; + if (g_lockdep_ceph_ctx == NULL) { + g_lockdep_ceph_ctx = cct; + lockdep_dout(0) << "lockdep start" << dendl; + } pthread_mutex_unlock(&lockdep_mutex); } @@ -69,6 +72,7 @@ void lockdep_unregister_ceph_context(CephContext *cct) { pthread_mutex_lock(&lockdep_mutex); if (cct == g_lockdep_ceph_ctx) { + lockdep_dout(0) << "lockdep stop" << dendl; // this cct is going away; shut it down! g_lockdep = false; g_lockdep_ceph_ctx = NULL; @@ -104,7 +108,6 @@ int lockdep_register(const char *name) int id; pthread_mutex_lock(&lockdep_mutex); - if (last_id == 0) for (int i=0; i *alt_def_args, } if (g_lockdep) { - dout(1) << "lockdep is enabled" << dendl; lockdep_register_ceph_context(g_ceph_context); } register_assert_context(g_ceph_context); -- 2.47.3