From: Sage Weil Date: Thu, 14 Feb 2019 19:44:43 +0000 (-0600) Subject: msg/async/ProtocolV2: assume peer has SERVER_NAUTILUS for encoding v2 frame X-Git-Tag: v14.1.0~86^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F26435%2Fhead;p=ceph.git msg/async/ProtocolV2: assume peer has SERVER_NAUTILUS for encoding v2 frame 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 --- diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index d6ecc44f763..ce2ef6490b5 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -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 *; 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), ...); }