]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: unlock mon before msgr shutdown
authorSage Weil <sage.weil@dreamhost.com>
Thu, 23 Feb 2012 04:49:04 +0000 (20:49 -0800)
committerSage Weil <sage@newdream.net>
Thu, 23 Feb 2012 19:15:05 +0000 (11:15 -0800)
The ceph_mon.cc main() will delete mon when the msgr dispatch thread
completes.  Make sure we unlock before we shut down the messenger, and
avoid touching this after messenger->shutdown().

Fixes: #2090
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/mon/Monitor.cc

index 5b3158456bb4cdc7b0e49c83e4f5f737d528e0da..3554798112f9ed01bfe374dbf3f3d0ba3fcf9fc6 100644 (file)
@@ -220,9 +220,7 @@ void Monitor::handle_signal(int signum)
 {
   assert(signum == SIGINT || signum == SIGTERM);
   derr << "*** Got Signal " << sys_siglist[signum] << " ***" << dendl;
-  lock.Lock();
   shutdown();
-  lock.Unlock();
 }
 
 void Monitor::init()
@@ -342,7 +340,8 @@ void Monitor::update_logger()
 void Monitor::shutdown()
 {
   dout(1) << "shutdown" << dendl;
-  
+  lock.Lock();
+
   state = STATE_SHUTDOWN;
 
   if (admin_hook) {
@@ -373,8 +372,10 @@ void Monitor::shutdown()
 
   timer.shutdown();
 
-  // die.
-  messenger->shutdown();
+  // unlock before msgr shutdown...
+  lock.Unlock();
+
+  messenger->shutdown();  // last thing!  ceph_mon.cc will delete mon.
 }
 
 void Monitor::bootstrap()