From: Kefu Chai Date: Tue, 28 Feb 2017 06:38:14 +0000 (+0000) Subject: mon/MonClient: do not assert on auth in build_authorizer() X-Git-Tag: v12.0.1~224^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F13685%2Fhead;p=ceph.git mon/MonClient: do not assert on auth in build_authorizer() * there is chance that some connections is still trying to authorize itself after the MonClient is shut down. do not assert in this case, but it is a sign of bug, or bad shutdown sequence, so print a message to dout(). * do not use active_con->get_auth() as an alternative to `this->auth` if it is not available. because we promote the authorized conn in pending_cons as the active_con, and std::swap(active_conn->auth, this->auth) with the monc_lock. so there is no point to return active_con->get_auth(), as it's always null. Signed-off-by: Kefu Chai --- diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 644a0e48812b..c685996a8e64 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -1136,11 +1136,13 @@ void MonClient::handle_get_version_reply(MMonGetVersionReply* m) AuthAuthorizer* MonClient::build_authorizer(int service_id) const { Mutex::Locker l(monc_lock); - assert(auth || active_con->get_auth()); - if (auth) + if (auth) { return auth->build_authorizer(service_id); - else - return active_con->get_auth()->build_authorizer(service_id); + } else { + ldout(cct, 0) << __func__ << " for " << ceph_entity_type_name(service_id) + << ", but no auth is available now" << dendl; + return nullptr; + } } #define dout_subsys ceph_subsys_monc