From: John Spray Date: Wed, 20 Jan 2016 11:19:33 +0000 (+0000) Subject: mds: Fix lock ordering around asok registration X-Git-Tag: v10.0.4~137^2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9588efe2bb72c320c1567d5e69147bb01f2fb431;p=ceph.git mds: Fix lock ordering around asok registration Because we acquire mds_lock inside asok handlers, we must not hold mds_lock while registering our commands. Fixes: #14374 Signed-off-by: John Spray --- diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index d38db5b70249..b38b6c9a6cc4 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -226,6 +226,7 @@ void MDSDaemon::set_up_admin_socket() { int r; AdminSocket *admin_socket = g_ceph_context->get_admin_socket(); + assert(asok_hook == nullptr); asok_hook = new MDSSocketHook(this); r = admin_socket->register_command("status", "status", asok_hook, "high-level status of MDS"); @@ -472,6 +473,10 @@ int MDSDaemon::init(MDSMap::DaemonState wanted_state) sleep(10); } + // Set up admin socket before taking mds_lock, so that ordering + // is consistent (later we take mds_lock within asok callbacks) + set_up_admin_socket(); + mds_lock.Lock(); if (beacon.get_want_state() == MDSMap::STATE_DNE) { suicide(); // we could do something more graceful here @@ -520,7 +525,6 @@ int MDSDaemon::init(MDSMap::DaemonState wanted_state) // schedule tick reset_tick(); - set_up_admin_socket(); g_conf->add_observer(this); mds_lock.Unlock();