From 543547827c9cee2626952fa645ec8b05ab9c1366 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Fri, 23 Feb 2018 12:17:04 +0800 Subject: [PATCH] mds: always handle SESSION_REQUEST_RENEWCAPS messages Fixes: http://tracker.ceph.com/issues/23059 Signed-off-by: "Yan, Zheng" --- src/mds/Server.cc | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 517fb293ccb2d..1e5854a0b4210 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -200,10 +200,10 @@ void Server::dispatch(Message *m) } // 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(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(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; @@ -234,24 +234,12 @@ void Server::dispatch(Message *m) } 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(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(m); - if (req->is_queued_for_replay()) { - wait_for_active = false; - } } } if (wait_for_active) { @@ -320,6 +308,21 @@ void Server::handle_client_session(MClientSession *m) 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); -- 2.39.5