mirror of
https://github.com/ceph/ceph
synced 2025-01-03 17:42:36 +00:00
mds: funnel mds->client messages through single Session* helper
Simplify callers where possible.
This commit is contained in:
parent
29a42efe2e
commit
6d770abebd
@ -4044,7 +4044,7 @@ void MDCache::send_snaps(map<client_t,MClientSnap*>& splits)
|
||||
<< " split " << p->second->head.split
|
||||
<< " inos " << p->second->split_inos
|
||||
<< dendl;
|
||||
mds->send_message_client_counted(p->second, session->connection);
|
||||
mds->send_message_client_counted(p->second, session);
|
||||
} else {
|
||||
dout(10) << " no session for client" << p->first << dendl;
|
||||
p->second->put();
|
||||
@ -4135,7 +4135,7 @@ void MDCache::do_cap_import(Session *session, CInode *in, Capability *cap)
|
||||
cap->get_mseq());
|
||||
in->encode_cap_message(reap, cap);
|
||||
realm->build_snap_trace(reap->snapbl);
|
||||
mds->send_message_client_counted(reap, session->inst);
|
||||
mds->send_message_client_counted(reap, session);
|
||||
} else {
|
||||
dout(10) << "do_cap_import missing past snap parents, delaying " << session->inst.name << " mseq "
|
||||
<< cap->get_mseq() << " on " << *in << dendl;
|
||||
@ -4254,7 +4254,7 @@ void MDCache::finish_snaprealm_reconnect(client_t client, SnapRealm *realm, snap
|
||||
if (session) {
|
||||
MClientSnap *snap = new MClientSnap(CEPH_SNAP_OP_UPDATE);
|
||||
realm->build_snap_trace(snap->bl);
|
||||
mds->send_message_client_counted(snap, session->connection);
|
||||
mds->send_message_client_counted(snap, session);
|
||||
} else {
|
||||
dout(10) << " ...or not, no session for this client!" << dendl;
|
||||
}
|
||||
|
@ -368,28 +368,34 @@ void MDS::forward_message_mds(Message *m, int mds)
|
||||
void MDS::send_message_client_counted(Message *m, client_t client)
|
||||
{
|
||||
if (sessionmap.have_session(entity_name_t::CLIENT(client.v))) {
|
||||
version_t seq = sessionmap.inc_push_seq(client);
|
||||
dout(10) << "send_message_client_counted client" << client << " seq " << seq << " " << *m << dendl;
|
||||
messenger->send_message(m, sessionmap.get_session(entity_name_t::CLIENT(client.v))->inst);
|
||||
send_message_client_counted(m, sessionmap.get_session(entity_name_t::CLIENT(client.v)));
|
||||
} else {
|
||||
dout(10) << "send_message_client_counted no session for client" << client << " " << *m << dendl;
|
||||
}
|
||||
}
|
||||
|
||||
void MDS::send_message_client_counted(Message *m, entity_inst_t clientinst)
|
||||
void MDS::send_message_client_counted(Message *m, Connection *connection)
|
||||
{
|
||||
version_t seq = sessionmap.inc_push_seq(clientinst.name.num());
|
||||
dout(10) << "send_message_client_counted " << clientinst.name << " seq " << seq << " " << *m << dendl;
|
||||
messenger->send_message(m, clientinst);
|
||||
Session *session = (Session *)m->get_connection()->get_priv();
|
||||
if (session) {
|
||||
session->put(); // do not carry ref
|
||||
send_message_client_counted(m, session);
|
||||
} else {
|
||||
dout(10) << "send_message_client_counted has no session for " << m->get_source_inst() << dendl;
|
||||
// another Connection took over the Session
|
||||
}
|
||||
}
|
||||
|
||||
void MDS::send_message_client_counted(Message *m, Connection *con)
|
||||
void MDS::send_message_client_counted(Message *m, Session *session)
|
||||
{
|
||||
Session *session = (Session *)con->get_priv();
|
||||
version_t seq = session->inc_push_seq();
|
||||
dout(10) << "send_message_client_counted " << session->inst.name << " seq "
|
||||
<< seq << " " << *m << dendl;
|
||||
messenger->send_message(m, con);
|
||||
if (session->connection) {
|
||||
messenger->send_message(m, session->connection);
|
||||
} else {
|
||||
messenger->send_message(m, session->inst);
|
||||
}
|
||||
}
|
||||
|
||||
int MDS::init()
|
||||
|
@ -333,8 +333,8 @@ class MDS : public Dispatcher {
|
||||
void forward_message_mds(Message *req, int mds);
|
||||
|
||||
void send_message_client_counted(Message *m, client_t client);
|
||||
void send_message_client_counted(Message *m, entity_inst_t clientinst);
|
||||
void send_message_client_counted(Message *m, Connection *con);
|
||||
void send_message_client_counted(Message *m, Session *session);
|
||||
void send_message_client_counted(Message *m, Connection *connection);
|
||||
void send_message(Message *m, Connection *c);
|
||||
|
||||
// start up, shutdown
|
||||
|
@ -164,7 +164,8 @@ Session *Server::get_session(Message *m)
|
||||
{
|
||||
Session *session = (Session *)m->get_connection()->get_priv();
|
||||
if (session) {
|
||||
dout(20) << "get_session have " << session << " " << session->inst << " state " << session->get_state_name() << dendl;
|
||||
dout(20) << "get_session have " << session << " " << session->inst
|
||||
<< " state " << session->get_state_name() << dendl;
|
||||
session->put(); // not carry ref
|
||||
} else {
|
||||
dout(20) << "get_session dne for " << m->get_source_inst() << dendl;
|
||||
@ -612,7 +613,7 @@ void Server::handle_client_reconnect(MClientReconnect *m)
|
||||
fake_inode.ino = p->first;
|
||||
MClientCaps *stale = new MClientCaps(CEPH_CAP_OP_EXPORT, p->first, 0, 0, 0);
|
||||
//stale->head.migrate_seq = 0; // FIXME ******
|
||||
mds->send_message_client_counted(stale, m->get_connection());
|
||||
mds->send_message_client_counted(stale, session);
|
||||
|
||||
// add to cap export list.
|
||||
mdcache->rejoin_export_caps(p->first, from, p->second);
|
||||
|
Loading…
Reference in New Issue
Block a user