]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "msg/async: msgr2: expected tags validation" 26849/head
authorRicardo Dias <rdias@suse.com>
Fri, 8 Mar 2019 12:56:49 +0000 (12:56 +0000)
committerRicardo Dias <rdias@suse.com>
Fri, 8 Mar 2019 14:40:35 +0000 (14:40 +0000)
This reverts commit e9ac3e0530b73ebb43db291d6562712b28c1e653.

Signed-off-by: Ricardo Dias <rdias@suse.com>
src/msg/async/ProtocolV2.cc
src/msg/async/ProtocolV2.h

index 593699aaddd13805c16d83378be9d6969b1c8698..5cefdd8bc48655aad4b4b676d2d070b5d8fa29c3 100644 (file)
@@ -54,9 +54,8 @@ void ProtocolV2::run_continuation(CtPtr continuation) {
 
 #define READB(L, B, C) read(CONTINUATION(C), L, B)
 
-#define TAG_MASK(T) (1 << ((uint64_t)(T)-1))
-
 #ifdef UNIT_TESTS_BUILT
+
 #define INTERCEPT(S) { \
 if(connection->interceptor) { \
   auto a = connection->interceptor->intercept(connection, (S)); \
@@ -88,7 +87,6 @@ ProtocolV2::ProtocolV2(AsyncConnection *connection)
       can_write(false),
       bannerExchangeCallback(nullptr),
       next_payload_len(0),
-      sent_tag(static_cast<Tag>(0)),
       next_tag(static_cast<Tag>(0)),
       keepalive(false) {
   temp_buffer = new char[4096];
@@ -229,7 +227,6 @@ void ProtocolV2::reset_recv_state() {
   connection->pendingReadLen.reset();
   connection->writeCallback.reset();
 
-  sent_tag = static_cast<Tag>(0);
   next_tag = static_cast<Tag>(0);
 
   reset_throttle();
@@ -510,8 +507,6 @@ ssize_t ProtocolV2::write_message(Message *m, bool more) {
   ldout(cct, 5) << __func__ << " sending message m=" << m
                 << " seq=" << m->get_seq() << " " << *m << dendl;
 
-  sent_tag = message.tag;
-
   m->trace.event("async writing message");
   ldout(cct, 20) << __func__ << " sending m=" << m << " seq=" << m->get_seq()
                  << " src=" << entity_name_t(messenger->get_myname())
@@ -627,7 +622,6 @@ void ProtocolV2::write_event() {
         s = in_seq;
         auto ack = AckFrame::Encode(session_stream_handlers, in_seq);
         connection->outcoming_bl.claim_append(ack.get_buffer());
-        sent_tag = ack.tag;
         ldout(cct, 10) << __func__ << " try send msg ack, acked " << left
                        << " messages" << dendl;
         ack_left -= left;
@@ -719,7 +713,6 @@ template <class F>
 CtPtr ProtocolV2::write(const std::string &desc,
                         CONTINUATION_PARAM(next, ProtocolV2),
                         F &frame) {
-  sent_tag = frame.tag;
   return write(desc, CONTINUATION(next), frame.get_buffer());
 }
 
@@ -936,65 +929,6 @@ CtPtr ProtocolV2::handle_hello(ceph::bufferlist &payload)
   return callback;
 }
 
-uint64_t ProtocolV2::expected_tags(Tag sent_tag, Tag received_tag) {
-  switch(sent_tag) {
-    case Tag::HELLO:
-      if (received_tag == Tag::HELLO) {
-        ceph_assert(state == AUTH_ACCEPTING);
-        return TAG_MASK(Tag::AUTH_REQUEST);
-      } else {
-        return TAG_MASK(Tag::HELLO);
-      }
-    case Tag::AUTH_REQUEST:
-    case Tag::AUTH_REQUEST_MORE:
-      return TAG_MASK(Tag::AUTH_REPLY_MORE) | TAG_MASK(Tag::AUTH_DONE) |
-             TAG_MASK(Tag::AUTH_BAD_METHOD);
-    case Tag::AUTH_BAD_METHOD:
-      return TAG_MASK(Tag::AUTH_REQUEST);
-    case Tag::AUTH_REPLY_MORE:
-      return TAG_MASK(Tag::AUTH_REQUEST_MORE);
-    case Tag::AUTH_DONE:
-      return TAG_MASK(Tag::CLIENT_IDENT) | TAG_MASK(Tag::SESSION_RECONNECT);
-    case Tag::CLIENT_IDENT:
-      if (state == READY) {
-        return TAG_MASK(Tag::MESSAGE) | TAG_MASK(Tag::KEEPALIVE2) |
-               TAG_MASK(Tag::KEEPALIVE2_ACK) | TAG_MASK(Tag::ACK);
-      } else {
-        ceph_assert(state == SESSION_CONNECTING);
-        return TAG_MASK(Tag::SERVER_IDENT) |
-               TAG_MASK(Tag::IDENT_MISSING_FEATURES) | TAG_MASK(Tag::WAIT);
-      }
-    case Tag::SESSION_RECONNECT:
-      if (state == READY) {
-        return TAG_MASK(Tag::MESSAGE) | TAG_MASK(Tag::KEEPALIVE2) |
-               TAG_MASK(Tag::KEEPALIVE2_ACK) | TAG_MASK(Tag::ACK);
-      } else {
-        ceph_assert(state == SESSION_RECONNECTING);
-        return TAG_MASK(Tag::SESSION_RECONNECT_OK) |
-               TAG_MASK(Tag::SESSION_RESET) | TAG_MASK(Tag::SESSION_RETRY) |
-               TAG_MASK(Tag::SESSION_RETRY_GLOBAL) | TAG_MASK(Tag::WAIT);
-      }
-    case Tag::SESSION_RESET:
-      return TAG_MASK(Tag::CLIENT_IDENT);
-    case Tag::SESSION_RETRY:
-    case Tag::SESSION_RETRY_GLOBAL:
-      return TAG_MASK(Tag::SESSION_RECONNECT);
-    case Tag::SERVER_IDENT:
-    case Tag::SESSION_RECONNECT_OK:
-    case Tag::KEEPALIVE2:
-    case Tag::KEEPALIVE2_ACK:
-    case Tag::ACK:
-    case Tag::MESSAGE:
-      ceph_assert(state == READY);
-      return TAG_MASK(Tag::MESSAGE) | TAG_MASK(Tag::KEEPALIVE2) |
-             TAG_MASK(Tag::KEEPALIVE2_ACK) | TAG_MASK(Tag::ACK);
-    case Tag::IDENT_MISSING_FEATURES:
-    case Tag::WAIT:
-      return 0;  // the peer should reset when receiving these tags
-  }
-  return 0;
-}
-
 CtPtr ProtocolV2::read_frame() {
   if (state == CLOSED) {
     return nullptr;
@@ -1060,17 +994,8 @@ CtPtr ProtocolV2::handle_read_frame_preamble_main(char *buffer, int r) {
       return _fault();
     }
 
-    Tag received_tag = next_tag;
     next_tag = static_cast<Tag>(main_preamble.tag);
 
-    uint64_t expected_tag_mask = expected_tags(sent_tag, received_tag);
-    if (!(TAG_MASK(next_tag) & expected_tag_mask)) {
-      lderr(cct) << __func__ << " received unexpected tag: expected=0x"
-                 << std::hex << expected_tag_mask << " got=0x"
-                 << TAG_MASK(next_tag) << std::dec << dendl;
-      return _fault();
-    }
-
     rx_segments_desc.clear();
     rx_segments_data.clear();
 
index 8e67c6d01aadacfc86b65ffe1ea1b4a141cde6d1..2d4c6d24354ce2252bd9aa5f384bd5daa2dfeb6e 100644 (file)
@@ -106,7 +106,6 @@ public:
                                  ceph::msgr::v2::MAX_NUM_SEGMENTS> rx_segments_data;
 private:
 
-  ceph::msgr::v2::Tag sent_tag;
   ceph::msgr::v2::Tag next_tag;
   utime_t backoff;  // backoff time
   utime_t recv_stamp;
@@ -126,9 +125,6 @@ private:
                         CONTINUATION_PARAM(next, ProtocolV2),
                         bufferlist &buffer);
 
-  uint64_t expected_tags(ceph::msgr::v2::Tag sent_tag,
-                         ceph::msgr::v2::Tag received_tag);
-
   void requeue_sent();
   uint64_t discard_requeued_up_to(uint64_t out_seq, uint64_t seq);
   void reset_recv_state();