From 4963bbda200caae183404331e88b673867f386ff Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 21 Sep 2009 16:31:05 -0700 Subject: [PATCH] auth: fix deadlock --- src/mon/MonClient.cc | 17 +++++++++-------- src/osd/OSD.cc | 3 ++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 5068de98d815a..c2e74f63c9b6d 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -163,6 +163,8 @@ bool MonClient::ms_dispatch(Message *m) if (my_addr == entity_addr_t()) my_addr = messenger->get_myaddr(); + dout(0) << "dispatch type=" << m->get_type() << dendl; + switch (m->get_type()) { case CEPH_MSG_MON_MAP: handle_monmap((MMonMap*)m); @@ -385,7 +387,10 @@ int MonClient::start_auth_rotating(EntityName& name, double timeout) MAuthRotating *m = new MAuthRotating(); if (!m) return -ENOMEM; - send_mon_message(m); + + Mutex::Locker l(monc_lock); + + _send_mon_message(m); auth_timeout_event = new C_AuthRotatingTimeout(this, timeout); if (!auth_timeout_event) @@ -396,14 +401,14 @@ int MonClient::start_auth_rotating(EntityName& name, double timeout) auth_cond.Wait(monc_lock); dout(0) << "MonClient::start_auth_rotating wait ended" << dendl; - timer.cancel_event(auth_timeout_event); - auth_timeout_event = NULL; - if (auth_got_timeout) { dout(0) << "MonClient::start_auth_rotating got timeout" << dendl; return -ETIMEDOUT; } + timer.cancel_event(auth_timeout_event); + auth_timeout_event = NULL; + return 0; } @@ -416,10 +421,6 @@ void MonClient::handle_auth_rotating_response(MAuthRotating *m) auth_cond.Signal(); - timer.cancel_event(auth_timeout_event); - auth_timeout_event = NULL; - - dout(0) << "MonClient::handle_auth_rotating_response got_response status=" << m->status << " length=" << m->response_bl.length() << dendl; } diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 935d0d2df400e..65ee6b92aa741 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -442,13 +442,14 @@ int OSD::init() signal(SIGTERM, handle_signal); signal(SIGINT, handle_signal); - +#if 0 int ret = monc->start_auth_rotating(ename, KEY_ROTATE_TIME); if (ret < 0) { dout(0) << "could not start rotating keys, err=" << ret << dendl; return ret; } dout(0) << "started rotating keys" << dendl; +#endif return 0; } -- 2.39.5