]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: drop lock to unregister asok hooks 7581/head
authorJohn Spray <john.spray@redhat.com>
Tue, 9 Feb 2016 12:15:56 +0000 (12:15 +0000)
committerJohn Spray <john.spray@redhat.com>
Tue, 9 Feb 2016 12:19:14 +0000 (12:19 +0000)
unregister blocks until any running hook has
completed, and that running hook might
be one that takes the objecter lock, so you
can't hold it while unregistering.

Signed-off-by: John Spray <john.spray@redhat.com>
src/osdc/Objecter.cc

index 9ace054ca0c05e854f0a28a64f639773c55cc183..8a6f1e659e0c1e2a89b8c2d5d3ff7cc905db27b5 100644 (file)
@@ -466,13 +466,6 @@ void Objecter::shutdown()
     tick_event = 0;
   }
 
-  if (m_request_state_hook) {
-    AdminSocket* admin_socket = cct->get_admin_socket();
-    admin_socket->unregister_command("objecter_requests");
-    delete m_request_state_hook;
-    m_request_state_hook = NULL;
-  }
-
   if (logger) {
     cct->get_perfcounters_collection()->remove(logger);
     delete logger;
@@ -481,6 +474,16 @@ void Objecter::shutdown()
 
   // Let go of Objecter write lock so timer thread can shutdown
   wl.unlock();
+
+  // Outside of lock to avoid cycle WRT calls to RequestStateHook
+  // This is safe because we guarantee no concurrent calls to
+  // shutdown() with the ::initialized check at start.
+  if (m_request_state_hook) {
+    AdminSocket* admin_socket = cct->get_admin_socket();
+    admin_socket->unregister_command("objecter_requests");
+    delete m_request_state_hook;
+    m_request_state_hook = NULL;
+  }
 }
 
 void Objecter::_send_linger(LingerOp *info,