}
// active?
- if (!mds->is_active()) {
- if (m->get_type() == CEPH_MSG_CLIENT_REQUEST &&
- (mds->is_reconnect() || mds->get_want_state() == CEPH_MDS_STATE_RECONNECT)) {
- MClientRequest *req = static_cast<MClientRequest*>(m);
+ // handle_slave_request()/handle_client_session() will wait if necessary
+ if (m->get_type() == CEPH_MSG_CLIENT_REQUEST && !mds->is_active()) {
+ MClientRequest *req = static_cast<MClientRequest*>(m);
+ if (mds->is_reconnect() || mds->get_want_state() == CEPH_MDS_STATE_RECONNECT) {
Session *session = mds->get_session(req);
if (!session || session->is_closed()) {
dout(5) << "session is closed, dropping " << req->get_reqid() << dendl;
}
bool wait_for_active = true;
- if (m->get_type() == MSG_MDS_SLAVE_REQUEST) {
- // handle_slave_request() will wait if necessary
- wait_for_active = false;
- } else if (mds->is_stopping()) {
- if (m->get_source().is_mds() ||
- m->get_type() == CEPH_MSG_CLIENT_SESSION)
+ if (mds->is_stopping()) {
+ if (m->get_source().is_mds())
wait_for_active = false;
} else if (mds->is_clientreplay()) {
- // session open requests need to be handled during replay,
- // close requests need to be delayed
- if ((m->get_type() == CEPH_MSG_CLIENT_SESSION &&
- (static_cast<MClientSession*>(m))->get_op() != CEPH_SESSION_REQUEST_CLOSE)) {
+ if (req->is_queued_for_replay()) {
wait_for_active = false;
- } else if (m->get_type() == CEPH_MSG_CLIENT_REQUEST) {
- MClientRequest *req = static_cast<MClientRequest*>(m);
- if (req->is_queued_for_replay()) {
- wait_for_active = false;
- }
}
}
if (wait_for_active) {
return;
}
+ if (m->get_op() == CEPH_SESSION_REQUEST_RENEWCAPS) {
+ // always handle renewcaps (state >= MDSMap::STATE_RECONNECT)
+ } else if (m->get_op() == CEPH_SESSION_REQUEST_CLOSE) {
+ // close requests need to be handled when mds is active
+ if (mds->get_state() < MDSMap::STATE_ACTIVE) {
+ mds->wait_for_active(new C_MDS_RetryMessage(mds, m));
+ return;
+ }
+ } else {
+ if (mds->get_state() < MDSMap::STATE_CLIENTREPLAY) {
+ mds->wait_for_replay(new C_MDS_RetryMessage(mds, m));
+ return;
+ }
+ }
+
if (logger)
logger->inc(l_mdss_handle_client_session);