]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: handle case where some new osds have hb_front and others don't
authorSage Weil <sage@inktank.com>
Wed, 3 Jul 2013 22:36:39 +0000 (15:36 -0700)
committerSage Weil <sage@inktank.com>
Wed, 3 Jul 2013 22:37:16 +0000 (15:37 -0700)
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 <sage@inktank.com>
Reviewed-by: David Zafman <david.zafman@inktank.com>
src/osd/OSDMap.cc

index 00bf8e6806b587339b5ac68d9b3a56d3e58f4082..24f93e37cc6548b90169ec25ba89ecd0bc00d4e9 100644 (file)
@@ -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<int32_t,entity_addr_t>::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();