ldout(cct, 10) << __func__ << " ping mon." << new_mon_id
<< " " << con->get_peer_addr() << dendl;
- pinger->mc.reset(new MonConnection(cct, con, 0, &auth_registry));
+ pinger->mc.reset(new MonConnection(cct, con, 0, &auth_registry, monc_lock));
pinger->mc->start(monmap.get_epoch(), entity_name);
con->send_message(new MPing);
void MonClient::_wipe_secrets_and_tickets()
{
+ ceph_assert(ceph_mutex_is_locked_by_me(monc_lock));
ldout(cct, 5) << " wiping rotating secrets and invalidating tickets" << dendl;
rotating_secrets->wipe();
auth->invalidate_all_tickets();
void MonClient::_add_conn(unsigned rank)
{
+ ceph_assert(ceph_mutex_is_locked_by_me(monc_lock));
auto peer = monmap.get_addrs(rank);
auto conn = messenger->connect_to_mon(peer);
- MonConnection mc(cct, conn, global_id, &auth_registry);
+ MonConnection mc(cct, conn, global_id, &auth_registry, monc_lock);
if (auth) {
mc.get_auth().reset(auth->clone());
}
}
r->target_session.reset(new MonConnection(cct, r->target_con, 0,
- &auth_registry));
+ &auth_registry, monc_lock));
r->target_session->start(monmap.get_epoch(), entity_name);
r->last_send_attempt = ceph_clock_now();
CryptoKey *session_key,
std::string *connection_secret)
{
+ std::lock_guard l(monc_lock);
if (con->get_peer_type() == CEPH_ENTITY_TYPE_MON) {
- std::lock_guard l(monc_lock);
if (con->is_anon()) {
for (auto& i : mon_commands) {
if (i.second->target_con == con) {
const std::vector<uint32_t>& allowed_methods,
const std::vector<uint32_t>& allowed_modes)
{
- auth_meta->allowed_methods = allowed_methods;
-
std::lock_guard l(monc_lock);
+ auth_meta->allowed_methods = allowed_methods;
if (con->get_peer_type() == CEPH_ENTITY_TYPE_MON) {
if (con->is_anon()) {
for (auto& i : mon_commands) {
const ceph::buffer::list& payload,
ceph::buffer::list *reply)
{
+ std::lock_guard l(monc_lock);
if (payload.length() == 0) {
// for some channels prior to nautilus (osd heartbeat), we
// tolerate the lack of an authorizer.
MonConnection::MonConnection(
CephContext *cct, ConnectionRef con, uint64_t global_id,
- AuthRegistry *ar)
- : cct(cct), con(con), global_id(global_id), auth_registry(ar)
+ AuthRegistry *ar, ceph::mutex& m)
+ : cct(cct), con(con), global_id(global_id), auth_registry(ar), monc_lock(m)
{}
MonConnection::~MonConnection()
uint32_t want_keys,
RotatingKeyRing* keyring)
{
+ ceph_assert(ceph_mutex_is_locked_by_me(monc_lock));
using ceph::encode;
// choose method
if (auth_method < 0) {
const ceph::buffer::list& bl,
ceph::buffer::list *reply)
{
+ ceph_assert(ceph_mutex_is_locked_by_me(monc_lock));
ldout(cct, 10) << __func__ << " payload " << bl.length() << dendl;
ldout(cct, 30) << __func__ << " got\n";
bl.hexdump(*_dout);
CryptoKey *session_key,
std::string *connection_secret)
{
+ ceph_assert(ceph_mutex_is_locked_by_me(monc_lock));
ldout(cct,10) << __func__ << " global_id " << new_global_id
<< " payload " << bl.length()
<< dendl;
const std::vector<uint32_t>& allowed_methods,
const std::vector<uint32_t>& allowed_modes)
{
+ ceph_assert(ceph_mutex_is_locked_by_me(monc_lock));
ldout(cct,10) << __func__ << " old_auth_method " << old_auth_method
<< " result " << cpp_strerror(result)
<< " allowed_methods " << allowed_methods << dendl;
uint32_t want_keys,
RotatingKeyRing* keyring)
{
+ ceph_assert(ceph_mutex_is_locked_by_me(monc_lock));
if (state == State::NEGOTIATING) {
int r = _negotiate(m, entity_name, want_keys, keyring);
if (r) {
RotatingKeyRing* keyring,
bool msgr2)
{
+ ceph_assert(ceph_mutex_is_locked_by_me(monc_lock));
ldout(cct, 10) << __func__ << " method " << method << dendl;
if (auth && auth->get_protocol() == (int)method) {
ldout(cct, 10) << __func__ << " already have auth, reseting" << dendl;
int MonConnection::authenticate(MAuthReply *m)
{
+ ceph_assert(ceph_mutex_is_locked_by_me(monc_lock));
ceph_assert(auth);
if (!m->global_id) {
ldout(cct, 1) << "peer sent an invalid global_id" << dendl;