]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/async/ProtocolV2: assume peer has SERVER_NAUTILUS for encoding v2 frame
authorSage Weil <sage@redhat.com>
Thu, 14 Feb 2019 19:44:43 +0000 (13:44 -0600)
committerSage Weil <sage@redhat.com>
Thu, 14 Feb 2019 19:44:48 +0000 (13:44 -0600)
The v2 frames may contain entity_addr_t and entity_addrvec_t.  Those have
been understood since the MSG_ADDR2 feature, but with nautilus we've
additionally added the TYPE_ANY, and we encode TYPE_ANY addrs as
TYPE_LEGACY when the peer lacks SERVER_NAUTILUS.

For the purposes of the v2 protocol, we assume the peer understands
TYPE_ANY.

No other complex types are used in the v2 frame protocol, so this has no
effect on, e.g., what features we assume the peer has for the purposes
of encoding actual messages.

Signed-off-by: Sage Weil <sage@redhat.com>
src/msg/async/ProtocolV2.cc

index d6ecc44f7635fcbf4dc89a87a34292e35e9a527b..ce2ef6490b55636fcbc120a330b482af7ad249fc 100644 (file)
@@ -23,8 +23,23 @@ ostream &ProtocolV2::_conn_prefix(std::ostream *_dout) {
                 << ").";
 }
 
+// We require these features from any peer, period, in order to encode
+// a entity_addrvec_t.
 const uint64_t msgr2_required = CEPH_FEATUREMASK_MSG_ADDR2;
 
+// We additionally assume the peer has the below features *purely for
+// the purpose of encoding the frames themselves*.  The only complex
+// types in the frames are entity_addr_t and entity_addrvec_t, and we
+// specifically want the peer to understand the (new in nautilus)
+// TYPE_ANY.  We treat narrow this assumption to frames because we
+// expect there may be future clients (the kernel) that understand
+// msgr v2 and understand this encoding but don't necessarily have
+// everything else that SERVER_NAUTILUS implies.  Yes, a fresh feature
+// bit would be a cleaner approach, but those are scarce these days.
+const uint64_t msgr2_frame_assumed =
+                  msgr2_required |
+                  CEPH_FEATUREMASK_SERVER_NAUTILUS;
+
 using CtPtr = Ct<ProtocolV2> *;
 
 struct SHA256SignatureError : public std::exception {
@@ -210,7 +225,8 @@ public:
   }
 
   PayloadFrame(ProtocolV2 *protocol, const Args &... args)
-      : protocol(protocol), features(protocol->connection_features) {
+      : protocol(protocol),
+       features(protocol->connection_features | msgr2_frame_assumed) {
     (_encode_payload_each(args), ...);
   }