From shutdown() we set STATE_SHUTDOWN and then call remove_all_sessions().
ms_handle_accept() is the only caller of add_session, so verifying that
we aren't shutting down (while under the session_map_lock) is sufficient
to prevent any new sessions from being added.
Fixes: https://tracker.ceph.com/issues/39150
Signed-off-by: Sage Weil <sage@newdream.net>
dout(10) << __func__ << " con " << con << " session " << s
<< " already on list" << dendl;
} else {
+ std::lock_guard l(session_map_lock);
+ if (state == STATE_SHUTDOWN) {
+ dout(10) << __func__ << " ignoring new con " << con << " (shutdown)" << dendl;
+ con->mark_down();
+ return;
+ }
dout(10) << __func__ << " con " << con << " session " << s
<< " registering session for "
<< con->get_peer_addrs() << dendl;
s->_ident(entity_name_t(con->get_peer_type(), con->get_peer_id()),
con->get_peer_addrs());
- std::lock_guard l(session_map_lock);
session_map.add_session(s);
}
}