From 4a34965c562e09334c17643e14de2c2b58c1c596 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 13 Nov 2012 18:18:24 -0800 Subject: [PATCH] client: register admin socket commands without lock held Avoid a lock cycle. existing dependency Client::client_lock (11) -> AdminSocket::m_lock (16) at: ceph version 0.54-578-g7926ef5 (7926ef53935313501d4a7fe0e587f3e3b00b313c) 1: (Mutex::Lock(bool)+0x41) [0x831337] 2: (AdminSocket::register_command(std::string, AdminSocketHook*, std::string)+0x40) [0x873a32] 3: (Client::init()+0x454) [0x6f4c24] 4: (main()+0x637) [0x6ea399] 5: (__libc_start_main()+0xed) [0x7fd97bbca76d] 6: ./ceph-fuse() [0x6e9c59] -4> 2012-11-13 18:14:48.619714 7fd97b1a3700 0 new dependency AdminSocket::m_lock (16) -> Client::client_lock (11) creates a cycle at ceph version 0.54-578-g7926ef5 (7926ef53935313501d4a7fe0e587f3e3b00b313c) 1: (Mutex::Lock(bool)+0x41) [0x831337] 2: (Objecter::RequestStateHook::call(std::string, std::string, ceph::buffer::list&)+0x7a) [0x90627e] 3: (AdminSocket::do_accept()+0xb1b) [0x87318f] 4: (AdminSocket::entry()+0x2fa) [0x8725fe] 5: (Thread::_entry_func(void*)+0x23) [0x86b335] 6: (()+0x7e9a) [0x7fd97d279e9a] 7: (clone()+0x6d) [0x7fd97bc9ccbd] Signed-off-by: Sage Weil --- src/client/Client.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 079d3ee619360..5e38ef4096624 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -347,7 +347,11 @@ int Client::init() return r; } - objecter->init(); + client_lock.Unlock(); + objecter->init_unlocked(); + client_lock.Lock(); + + objecter->init_locked(); monclient->set_want_keys(CEPH_ENTITY_TYPE_MDS | CEPH_ENTITY_TYPE_OSD); monclient->sub_want("mdsmap", 0, 0); @@ -364,7 +368,7 @@ int Client::init() logger = plb.create_perf_counters(); cct->get_perfcounters_collection()->add(logger); - initialized = true; + client_lock.Unlock(); AdminSocket* admin_socket = cct->get_admin_socket(); int ret = admin_socket->register_command("mds_requests", @@ -389,6 +393,8 @@ int Client::init() << cpp_strerror(-ret) << dendl; } + client_lock.Lock(); + initialized = true; client_lock.Unlock(); return r; } @@ -414,8 +420,9 @@ void Client::shutdown() assert(initialized); initialized = false; timer.shutdown(); - objecter->shutdown(); + objecter->shutdown_locked(); client_lock.Unlock(); + objecter->shutdown_unlocked(); monclient->shutdown(); if (logger) { -- 2.39.5