]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: always handle SESSION_REQUEST_RENEWCAPS messages 20553/head
authorYan, Zheng <zyan@redhat.com>
Fri, 23 Feb 2018 04:17:04 +0000 (12:17 +0800)
committerYan, Zheng <zyan@redhat.com>
Fri, 23 Feb 2018 04:17:46 +0000 (12:17 +0800)
Fixes: http://tracker.ceph.com/issues/23059
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/Server.cc

index 517fb293ccb2daf1406b9a65cf7b289e488603ff..1e5854a0b42103dac0acaa931247f49ccaf93e5c 100644 (file)
@@ -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<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;
@@ -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<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) {
@@ -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);