mon: unlock mon before msgr shutdown

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>
This commit is contained in:
Sage Weil 2012-02-22 20:49:04 -08:00 committed by Sage Weil
parent d1fe2f8fd7
commit 62a113aaa7

View 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()