summaryrefslogtreecommitdiffstats
path: root/src/tools/common.cc
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-11-23 16:02:41 +0100
committerSage Weil <sage.weil@dreamhost.com>2011-11-23 15:44:58 +0100
commitad13d0b73170b9e198e596051cff358cf9fcf8f4 (patch)
treefb7424d7913f8fded7b784e421fbd8bc676a6811 /src/tools/common.cc
parentobsync: tear out rgw (diff)
downloadceph-ad13d0b73170b9e198e596051cff358cf9fcf8f4.tar.xz
ceph-ad13d0b73170b9e198e596051cff358cf9fcf8f4.zip
ceph: fix shutdown race
Shut down MonClient before messenger, to avoid race with MonClient::tick() and MonClient::shutdown(). Fixes #0 __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136 #1 0x00007f44475e2849 in _L_lock_953 () from /lib/libpthread.so.0 #2 0x00007f44475e266b in __pthread_mutex_lock (mutex=0x14d8dc8) at pthread_mutex_lock.c:61 #3 0x00000000005ae090 in Mutex::Lock (this=0x14d8db8, no_lockdep=false) at ./common/Mutex.h:108 #4 0x000000000068440e in MonClient::shutdown (this=0x14d8c30) at mon/MonClient.cc:386 #5 0x00000000005b2653 in ceph_tool_common_shutdown (ctx=0x14d84c0) at tools/common.cc:661 #6 0x00000000005ada29 in main (argc=7, argv=0x7fff8a2394c8) at tools/ceph.cc:304 vs #0 0x00007f44475e8a0b in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42 #1 0x00000000005eff6b in reraise_fatal (signum=11) at global/signal_handler.cc:59 #2 0x00000000005f0165 in handle_fatal_signal (signum=11) at global/signal_handler.cc:106 #3 <signal handler called> #4 0x0000000000000000 in ?? () #5 0x000000000068661a in MonClient::tick (this=0x14d8c30) at mon/MonClient.cc:621 #6 0x0000000000689e3b in MonClient::C_Tick::finish(int) () #7 0x000000000061b3c5 in SafeTimer::timer_thread (this=0x14d8df8) at common/Timer.cc:102 #8 0x000000000061c6f0 in SafeTimerThread::entry() () #9 0x00000000005f1219 in Thread::_entry_func (arg=0x14e1a00) at common/Thread.cc:41 #10 0x00007f44475e0971 in start_thread (arg=<value optimized out>) at pthread_create.c:304 #11 0x00007f4445ead92d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #12 0x0000000000000000 in ?? () Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'src/tools/common.cc')
-rw-r--r--src/tools/common.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tools/common.cc b/src/tools/common.cc
index 64322cd4a1f..99dff5e05f8 100644
--- a/src/tools/common.cc
+++ b/src/tools/common.cc
@@ -652,14 +652,15 @@ int ceph_tool_messenger_shutdown()
int ceph_tool_common_shutdown(CephToolCtx *ctx)
{
+ ctx->lock.Lock();
+ ctx->mc.shutdown();
+ ctx->timer.shutdown();
+ ctx->lock.Unlock();
+
// wait for messenger to finish
messenger->wait();
messenger->destroy();
tok_end(tok);
- ctx->lock.Lock();
- ctx->mc.shutdown();
- ctx->timer.shutdown();
- ctx->lock.Unlock();
return 0;
}