We need to hold mds_lock here.
Normally the con also holds a reference, but an ill-timed connection reset
could drop it.
Fixes: #5883
Backport: dumpling, cuttlefish
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit
a0929955cb84fb8cfdeb551d6863e4955b8e2a71)
void MDS::ms_handle_accept(Connection *con)
{
+ Mutex::Locker l(mds_lock);
Session *s = static_cast<Session *>(con->get_priv());
dout(10) << "ms_handle_accept " << con->get_peer_addr() << " con " << con << " session " << s << dendl;
if (s) {
- s->put();
if (s->connection != con) {
dout(10) << " session connection " << s->connection << " -> " << con << dendl;
s->connection = con;
s->preopen_out_queue.pop_front();
}
}
+ s->put();
}
}