From 81343f1df4b55d6069a4e81b858f3bf1aea1cea9 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 3 Jul 2013 15:37:05 -0700 Subject: [PATCH] osd: clear hb_front if it was previously non-NULL and is now NULL If we have a real addr for hb_front for a given osd and then a new map has the osd coming up without an hb_front, we need to clear the addr field. Also, improve the debug output in add_heartbeat_peer() so we can tell if we have no connection or a connection to a blank addr. Signed-off-by: Sage Weil Reviewed-by: David Zafman --- src/osd/OSD.cc | 13 +++++++++---- src/osd/OSDMap.cc | 3 +++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index bab345324d025..5209ec36bf499 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2518,11 +2518,16 @@ void OSD::_add_heartbeat_peer(int p) if (cons.second) { hi->con_front = cons.second.get(); hi->con_front->set_priv(s->get()); + dout(10) << "_add_heartbeat_peer: new peer osd." << p + << " " << hi->con_back->get_peer_addr() + << " " << hi->con_front->get_peer_addr() + << dendl; + } else { + hi->con_front.reset(NULL); + dout(10) << "_add_heartbeat_peer: new peer osd." << p + << " " << hi->con_back->get_peer_addr() + << dendl; } - dout(10) << "_add_heartbeat_peer: new peer osd." << p - << " " << hi->con_back->get_peer_addr() - << " " << (hi->con_front ? hi->con_front->get_peer_addr() : entity_addr_t()) - << dendl; } else { hi = &i->second; } diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 711997782a8e1..00bf8e6806b58 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -904,6 +904,9 @@ int OSDMap::apply_incremental(const Incremental &inc) 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)); + else + osd_addrs->hb_front_addr[i->first].reset(); + osd_info[i->first].up_from = epoch; } for (map::const_iterator i = inc.new_up_cluster.begin(); -- 2.39.5