From 254676b63b559fa0117520edb5dcbfe067a76747 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 18 Feb 2015 14:53:04 -0800 Subject: [PATCH] osd,mon: explicitly specify OSD features in MOSDBoot We are using the connection features to populate the features field in the OSDMap, but this is the *intersection* of mon and osd features, not the osd features. Fix this by explicitly specifying the features in MOSDBoot. Fixes: #10911 Backport: giant, firefly Signed-off-by: Sage Weil (cherry picked from commit bee91548b07c6a28314dddc50fef8b6a2677e774) Conflicts: src/osd/OSD.cc Minor difference in the MOSDBoot constructor --- src/messages/MOSDBoot.h | 20 +++++++++++++++----- src/mon/Monitor.cc | 3 ++- src/mon/OSDMonitor.cc | 7 ++++++- src/osd/OSD.cc | 4 +++- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/messages/MOSDBoot.h b/src/messages/MOSDBoot.h index bfe7775768f96..e59b03cf14e73 100644 --- a/src/messages/MOSDBoot.h +++ b/src/messages/MOSDBoot.h @@ -22,7 +22,7 @@ class MOSDBoot : public PaxosServiceMessage { - static const int HEAD_VERSION = 5; + static const int HEAD_VERSION = 6; static const int COMPAT_VERSION = 2; public: @@ -31,21 +31,24 @@ class MOSDBoot : public PaxosServiceMessage { entity_addr_t cluster_addr; epoch_t boot_epoch; // last epoch this daemon was added to the map (if any) map metadata; ///< misc metadata about this osd + uint64_t osd_features; MOSDBoot() : PaxosServiceMessage(MSG_OSD_BOOT, 0, HEAD_VERSION, COMPAT_VERSION), - boot_epoch(0) + boot_epoch(0), osd_features(0) { } MOSDBoot(OSDSuperblock& s, epoch_t be, const entity_addr_t& hb_back_addr_ref, const entity_addr_t& hb_front_addr_ref, - const entity_addr_t& cluster_addr_ref) + const entity_addr_t& cluster_addr_ref, + uint64_t feat) : PaxosServiceMessage(MSG_OSD_BOOT, s.current_epoch, HEAD_VERSION, COMPAT_VERSION), sb(s), hb_back_addr(hb_back_addr_ref), hb_front_addr(hb_front_addr_ref), cluster_addr(cluster_addr_ref), - boot_epoch(be) + boot_epoch(be), + osd_features(feat) { } private: @@ -54,7 +57,9 @@ private: public: const char *get_type_name() const { return "osd_boot"; } void print(ostream& out) const { - out << "osd_boot(osd." << sb.whoami << " booted " << boot_epoch << " v" << version << ")"; + out << "osd_boot(osd." << sb.whoami << " booted " << boot_epoch + << " features " << osd_features + << " v" << version << ")"; } void encode_payload(uint64_t features) { @@ -65,6 +70,7 @@ public: ::encode(boot_epoch, payload); ::encode(hb_front_addr, payload); ::encode(metadata, payload); + ::encode(osd_features, payload); } void decode_payload() { bufferlist::iterator p = payload.begin(); @@ -79,6 +85,10 @@ public: ::decode(hb_front_addr, p); if (header.version >= 5) ::decode(metadata, p); + if (header.version >= 6) + ::decode(osd_features, p); + else + osd_features = 0; } }; diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 2240e4189fd85..c39faad23e276 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2577,7 +2577,8 @@ void Monitor::forward_request_leader(PaxosServiceMessage *req) routed_requests[rr->tid] = rr; session->routed_request_tids.insert(rr->tid); - dout(10) << "forward_request " << rr->tid << " request " << *req << dendl; + dout(10) << "forward_request " << rr->tid << " request " << *req + << " features " << rr->con_features << dendl; MForward *forward = new MForward(rr->tid, req, rr->con_features, diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 510b727903f3f..861fac8cd901d 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -1349,8 +1349,13 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m) xi.laggy_probability * (1.0 - g_conf->mon_osd_laggy_weight); dout(10) << " laggy, now xi " << xi << dendl; } + // set features shared by the osd - xi.features = m->get_connection()->get_features(); + if (m->osd_features) + xi.features = m->osd_features; + else + xi.features = m->get_connection()->get_features(); + pending_inc.new_xinfo[from] = xi; // wait diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index c0f4bdd0e8ebb..d2c0a341ab826 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3771,7 +3771,9 @@ void OSD::_send_boot() dout(10) << " assuming hb_front_addr ip matches client_addr" << dendl; } - MOSDBoot *mboot = new MOSDBoot(superblock, boot_epoch, hb_back_addr, hb_front_addr, cluster_addr); + MOSDBoot *mboot = new MOSDBoot(superblock, boot_epoch, + hb_back_addr, hb_front_addr, cluster_addr, + CEPH_FEATURES_ALL); dout(10) << " client_addr " << client_messenger->get_myaddr() << ", cluster_addr " << cluster_addr << ", hb_back_addr " << hb_back_addr -- 2.39.5