]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
lockdep: do not initialize if already started
authorSage Weil <sage@inktank.com>
Wed, 2 Apr 2014 23:46:30 +0000 (16:46 -0700)
committerSage Weil <sage@inktank.com>
Wed, 2 Apr 2014 23:46:30 +0000 (16:46 -0700)
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 <sage@inktank.com>
src/common/lockdep.cc
src/global/global_init.cc

index 5c2ee55abaad60d7d5dcc1f6ce7d1efc0ab1425e..e4376eaeda449a90eb51f4954da33549415e477b 100644 (file)
@@ -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<MAX_LOCKS; i++)
       for (int j=0; j<MAX_LOCKS; j++)
index 861abfcbefbad03289bb6b5beb13f53b096c3e5e..7b203433b552d15dbfa696b632982bf998fe79a9 100644 (file)
@@ -139,7 +139,6 @@ void global_init(std::vector < const char * > *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);