From: Sage Weil Date: Wed, 3 Jul 2013 22:36:39 +0000 (-0700) Subject: osd/OSDMap: handle case where some new osds have hb_front and others don't X-Git-Tag: v0.66~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e8b42a6998653bde488502097eaa0a2fb834d964;p=ceph.git osd/OSDMap: handle case where some new osds have hb_front and others don't Do not assume that because at least one OSD has an hb_front addr that they all do, or else we will end up assigning garbage here and later thinking it is a addr (or, more precisely, != entity_addr_t()). Fixes: #5460 Signed-off-by: Sage Weil Reviewed-by: David Zafman --- diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 00bf8e6806b5..24f93e37cc65 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -901,9 +901,9 @@ int OSDMap::apply_incremental(const Incremental &inc) else osd_addrs->hb_back_addr[i->first].reset( new entity_addr_t(inc.new_hb_back_up.find(i->first)->second)); - if (!inc.new_hb_front_up.empty()) - osd_addrs->hb_front_addr[i->first].reset( - new entity_addr_t(inc.new_hb_front_up.find(i->first)->second)); + map::const_iterator j = inc.new_hb_front_up.find(i->first); + if (j != inc.new_hb_front_up.end()) + osd_addrs->hb_front_addr[i->first].reset(new entity_addr_t(j->second)); else osd_addrs->hb_front_addr[i->first].reset();