]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: reject sessionless messages
authorXiao Guodong <xiaogd@inspur.com>
Mon, 12 Aug 2019 07:09:57 +0000 (15:09 +0800)
committerXiao Guodong <xiaogd@inspur.com>
Tue, 20 Aug 2019 01:30:30 +0000 (09:30 +0800)
mds should reject sessionless messages.

Fixes: https://tracker.ceph.com/issues/41329
Signed-off-by: Xiao Guodong <xiaogd@inspur.com>
src/mds/Server.cc

index 92ad6e8a5c9de2e6cf3e195e6abee4bc44dc27a0..f54cd46a6439ccc6a677c906f75df5f210471a0d 100644 (file)
@@ -442,6 +442,9 @@ void Server::handle_client_session(const cref_t<MClientSession> &m)
 
   if (!session) {
     dout(0) << " ignoring sessionless msg " << *m << dendl;
+    auto reply = make_message<MClientSession>(CEPH_SESSION_REJECT);
+    reply->metadata["error_string"] = "sessionless";
+    mds->send_message(reply, m->get_connection());
     return;
   }
 
@@ -1230,8 +1233,13 @@ void Server::handle_client_reconnect(const cref_t<MClientReconnect> &m)
          << (m->has_more() ? " (more)" : "") << dendl;
   client_t from = m->get_source().num();
   Session *session = mds->get_session(m);
-  if (!session)
+  if (!session) {
+    dout(0) << " ignoring sessionless msg " << *m << dendl;
+    auto reply = make_message<MClientSession>(CEPH_SESSION_REJECT);
+    reply->metadata["error_string"] = "sessionless";
+    mds->send_message(reply, m->get_connection());
     return;
+  }
 
   if (!mds->is_reconnect() && mds->get_want_state() == CEPH_MDS_STATE_RECONNECT) {
     dout(10) << " we're almost in reconnect state (mdsmap delivery race?); waiting" << dendl;