* 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 <kchai@redhat.com>
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