From: John Spray Date: Tue, 13 Oct 2015 13:44:21 +0000 (+0100) Subject: client: handle REJECT session messages from MDS X-Git-Tag: v10.0.3~48^2~4^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=607d07c685f38cc3b67ace4c257c9ba063b08e8b;p=ceph.git client: handle REJECT session messages from MDS So that we can go quiet and not hammer an MDS with session open messages if it keeps kicking us out. Signed-off-by: John Spray --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 0a6a97452b55..9d4caf9f9973 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1886,6 +1886,21 @@ MetaSession *Client::_open_mds_session(mds_rank_t mds) session->con = messenger->get_connection(session->inst); session->state = MetaSession::STATE_OPENING; mds_sessions[mds] = session; + + // Maybe skip sending a request to open if this MDS daemon + // has previously sent us a REJECT. + if (rejected_by_mds.count(mds)) { + if (rejected_by_mds[mds] == session->inst) { + ldout(cct, 4) << "_open_mds_session mds." << mds << " skipping " + "because we were rejected" << dendl; + return session; + } else { + ldout(cct, 4) << "_open_mds_session mds." << mds << " old inst " + "rejected us, trying with new inst" << dendl; + rejected_by_mds.erase(mds); + } + } + MClientSession *m = new MClientSession(CEPH_SESSION_REQUEST_OPEN); m->client_meta = metadata; session->con->send_message(m); @@ -1962,6 +1977,12 @@ void Client::handle_client_session(MClientSession *m) force_session_readonly(session); break; + case CEPH_SESSION_REJECT: + rejected_by_mds[session->mds_num] = session->inst; + _closed_mds_session(session); + + break; + default: assert(0); } diff --git a/src/client/Client.h b/src/client/Client.h index 8b317000bee5..5f364289992e 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -349,6 +349,12 @@ protected: bool mounted; bool unmounting; + // When an MDS has sent us a REJECT, remember that and don't + // contact it again. Remember which inst rejected us, so that + // when we talk to another inst with the same rank we can + // try again. + std::map rejected_by_mds; + int local_osd; epoch_t local_osd_epoch;