From 4943899005267250f42909e2a91a8a54e9479da4 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Wed, 29 Nov 2017 18:44:30 +0800 Subject: [PATCH] mds: handle client session messages when mds is stopping handle session messages except CEPH_SESSION_REQUEST_OPEN. The problem I found is that mds ignores CEPH_SESSION_REQUEST_RENEWCAPS, which causes client sessions to become stale. Locker::revoke_stale_caps() increases client caps' sequence number. This causes clients to warn about caps' sequence number mismatch when handle caps import/export message. mds should handle CEPH_SESSION_FLUSHMSG_ACK message too. Because one step of exporting subtree is flushing session messages. Fixes: http://tracker.ceph.com/issues/22460 Signed-off-by: "Yan, Zheng" (cherry picked from commit 559fdcaec28c8459c5d801efc3842e604324f91f) --- src/mds/Server.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 38c44523e95c9..fccce17fea094 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -200,8 +200,7 @@ void Server::dispatch(Message *m) } // active? - if (!mds->is_active() && - !(mds->is_stopping() && m->get_source().is_mds())) { + 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); @@ -238,6 +237,10 @@ void Server::dispatch(Message *m) 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) + wait_for_active = false; } else if (mds->is_clientreplay()) { // session open requests need to be handled during replay, // close requests need to be delayed @@ -350,6 +353,12 @@ void Server::handle_client_session(MClientSession *m) assert(session->is_closed() || session->is_closing()); + if (mds->is_stopping()) { + dout(10) << "mds is stopping, dropping open req" << dendl; + m->put(); + return; + } + blacklisted = mds->objecter->with_osdmap( [session](const OSDMap &osd_map) -> bool { return osd_map.is_blacklisted(session->info.inst.addr); @@ -458,7 +467,8 @@ void Server::handle_client_session(MClientSession *m) break; case CEPH_SESSION_REQUEST_FLUSH_MDLOG: - mdlog->flush(); + if (mds->is_active()) + mdlog->flush(); break; default: -- 2.39.5