From: Sage Weil Date: Wed, 5 Dec 2018 22:24:38 +0000 (-0600) Subject: osd/OSDMap: fix is_blacklisted() check to assume type ANY X-Git-Tag: v14.1.0~484^2~65 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=55a9c7522fb58b7f476cca4daa2577177488ef2d;p=ceph.git osd/OSDMap: fix is_blacklisted() check to assume type ANY Note that this still does a copy of the addr struct (as it did before). This could be more efficient... Signed-off-by: Sage Weil --- diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 43755cf61eb7..660d0fbfe816 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -1195,21 +1195,31 @@ void OSDMap::set_epoch(epoch_t e) pool.second.last_change = e; } -bool OSDMap::is_blacklisted(const entity_addr_t& a) const +bool OSDMap::is_blacklisted(const entity_addr_t& orig) const { - if (blacklist.empty()) + if (blacklist.empty()) { return false; + } + + // all blacklist entries are type ANY for nautilus+ + // FIXME: avoid this copy! + entity_addr_t a = orig; + if (require_osd_release < CEPH_RELEASE_NAUTILUS) { + a.set_type(entity_addr_t::TYPE_LEGACY); + } else { + a.set_type(entity_addr_t::TYPE_ANY); + } // this specific instance? - if (blacklist.count(a)) + if (blacklist.count(a)) { return true; + } // is entire ip blacklisted? if (a.is_ip()) { - entity_addr_t b = a; - b.set_port(0); - b.set_nonce(0); - if (blacklist.count(b)) { + a.set_port(0); + a.set_nonce(0); + if (blacklist.count(a)) { return true; } } @@ -1223,18 +1233,8 @@ bool OSDMap::is_blacklisted(const entity_addrvec_t& av) const return false; for (auto& a : av.v) { - // this specific instance? - if (blacklist.count(a)) + if (is_blacklisted(a)) { return true; - - // is entire ip blacklisted? - if (a.is_ip()) { - entity_addr_t b = a; - b.set_port(0); - b.set_nonce(0); - if (blacklist.count(b)) { - return true; - } } }