From 25951a9672ef53c3b8c59d38d6777f2c619f0f06 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 14 Feb 2019 13:44:43 -0600 Subject: [PATCH] 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 --- src/msg/async/ProtocolV2.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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), ...); } -- 2.39.5