client: Don't keep sending SESSION_REQUEST_OPEN

This fixes a bug where the client keeps resending session open requests
to the target mds because the waiting_for_session.count check was
incorrectly using the passed in mds number instead of the target.

Also output the mds the message is coming from for debugging.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
This commit is contained in:
Sam Lang 2012-10-05 10:51:00 -05:00
parent 2d6953a44c
commit a53a4a21a0

View File

@ -1012,14 +1012,13 @@ out:
void Client::connect_mds_targets(int mds) void Client::connect_mds_targets(int mds)
{ {
//this function shouldn't be called unless we lost a connection
ldout(cct, 10) << "connect_mds_targets for mds." << mds << dendl; ldout(cct, 10) << "connect_mds_targets for mds." << mds << dendl;
assert(mds_sessions.count(mds)); assert(mds_sessions.count(mds));
const MDSMap::mds_info_t& info = mdsmap->get_mds_info(mds); const MDSMap::mds_info_t& info = mdsmap->get_mds_info(mds);
for (set<int>::const_iterator q = info.export_targets.begin(); for (set<int>::const_iterator q = info.export_targets.begin();
q != info.export_targets.end(); q != info.export_targets.end();
q++) { q++) {
if (mds_sessions.count(*q) == 0 && waiting_for_session.count(mds) == 0) { if (mds_sessions.count(*q) == 0 && waiting_for_session.count(*q) == 0) {
ldout(cct, 10) << "check_mds_sessions opening mds." << mds ldout(cct, 10) << "check_mds_sessions opening mds." << mds
<< " export target mds." << *q << dendl; << " export target mds." << *q << dendl;
messenger->send_message(new MClientSession(CEPH_SESSION_REQUEST_OPEN), messenger->send_message(new MClientSession(CEPH_SESSION_REQUEST_OPEN),
@ -1254,8 +1253,8 @@ void Client::_closed_mds_session(int mds, MetaSession *s)
void Client::handle_client_session(MClientSession *m) void Client::handle_client_session(MClientSession *m)
{ {
ldout(cct, 10) << "handle_client_session " << *m << dendl;
int from = m->get_source().num(); int from = m->get_source().num();
ldout(cct, 10) << "handle_client_session " << *m << " from mds." << from << dendl;
MetaSession *mds_session = NULL; MetaSession *mds_session = NULL;
if (mds_sessions.count(from)) if (mds_sessions.count(from))
mds_session = mds_sessions[from]; mds_session = mds_sessions[from];