]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix map sharing due to heartbeats
authorSage Weil <sage@newdream.net>
Wed, 25 May 2011 23:20:26 +0000 (16:20 -0700)
committerSage Weil <sage@newdream.net>
Tue, 31 May 2011 16:37:28 +0000 (09:37 -0700)
- share the map with the cluster addr
- use the new {note,get}_peer_epoch helpers to do it sanely
- don't share if we're booting; see 818fa33a661

Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/OSD.cc

index 2224e67d714658a127f879445eaa2ff6ef6e6f67..3bd6520a6df7b868e06a1c813d4262e39c5e0d26 100644 (file)
@@ -1488,7 +1488,7 @@ void OSD::update_heartbeat_peers()
 
     // share latest map with this peer so they know not to expect
     // heartbeats from us.  otherwise they may mark us down!
-    if (osdmap->is_up(p->first)) {
+    if (osdmap->is_up(p->first) && !is_booting()) {
       dout(10) << "update_heartbeat_peers: sharing map with old _to peer osd" << p->first << dendl;
       _share_map_outgoing(osdmap->get_cluster_inst(p->first));
     }
@@ -1512,7 +1512,7 @@ void OSD::update_heartbeat_peers()
       continue;
 
     // share latest map with this peer, just to be nice.
-    if (osdmap->is_up(p->first)) {
+    if (osdmap->is_up(p->first) && !is_booting()) {
       dout(10) << "update_heartbeat_peers: sharing map with old _from peer osd" << p->first << dendl;
       _share_map_outgoing(osdmap->get_cluster_inst(p->first));
     }
@@ -1531,7 +1531,7 @@ void OSD::update_heartbeat_peers()
   for (map<int, Connection*>::iterator p = down.begin(); p != down.end(); ++p) {
     Connection *con = p->second;
     heartbeat_messenger->mark_disposable(con);
-    if (!osdmap->is_up(p->first)) {
+    if (!osdmap->is_up(p->first) && !is_booting()) {
       dout(10) << "update_heartbeat_peers: telling old peer osd" << p->first
               << " " << old_con[p->first]->get_peer_addr()
               << " they are down" << dendl;
@@ -1616,9 +1616,6 @@ void OSD::handle_osd_ping(MOSDPing *m)
       if (locked) {
        dout(20) << "handle_osd_ping " << m->get_source_inst()
                 << " took stat " << m->peer_stat << dendl;
-       if (m->map_epoch && !is_booting())
-         _share_map_incoming(m->get_source_inst(), m->map_epoch,
-                             (Session*) m->get_connection()->get_priv());
        take_peer_stat(from, m->peer_stat);  // only with map_lock held!
       } else {
        dout(20) << "handle_osd_ping " << m->get_source_inst()
@@ -1626,6 +1623,8 @@ void OSD::handle_osd_ping(MOSDPing *m)
       }
 
       note_peer_epoch(from, m->map_epoch);
+      if (locked && !is_booting())
+       _share_map_outgoing(osdmap->get_cluster_inst(from));
       
       heartbeat_from_stamp[from] = g_clock.now();  // don't let _my_ lag interfere.
       
@@ -2482,6 +2481,8 @@ void OSD::_share_map_outgoing(const entity_inst_t& inst)
 
   int peer = inst.name.num();
 
+  assert(!is_booting());
+
   // send map?
   epoch_t pe = get_peer_epoch(peer);
   if (pe) {