]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: clean up old _from target cleanup; fix one case; share map
authorSage Weil <sage.weil@dreamhost.com>
Fri, 20 May 2011 18:29:05 +0000 (11:29 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Fri, 20 May 2011 18:29:05 +0000 (11:29 -0700)
Clean up the code to mirror the _to case.

Previously we would not mark down an old _from that is still a _to but with
a new address.  Now we do.

Share a map while we're at it, just to be nice!

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/osd/OSD.cc

index 58cb031b766be351affe4a5df410929dec8eab2e..468d68e0e533c73e8f02c1d397c4ad337f9cf770 100644 (file)
@@ -1495,16 +1495,25 @@ void OSD::update_heartbeat_peers()
   for (map<int,epoch_t>::iterator p = old_from.begin();
        p != old_from.end();
        p++) {
-    if (heartbeat_from.count(p->first) == 0 ||
-       heartbeat_inst[p->first] != old_inst[p->first]) {
-      if (heartbeat_to.count(p->first) == 0) {
-       dout(10) << "update_heartbeat_peers: marking down old _from peer " << old_inst[p->first] 
-                << " as of " << p->second << dendl;
-       heartbeat_messenger->mark_down(old_inst[p->first].addr);
-      } else {
-       dout(10) << "update_heartbeat_peers: old _from peer " << old_inst[p->first]
-                << " is still a _to peer, not marking down" << dendl;
-      }
+    assert(old_inst.count(p->first));
+    if (heartbeat_from.count(p->first) && heartbeat_inst[p->first] == old_inst[p->first])
+      continue;
+
+    // share latest map with this peer, just to be nice.
+    dout(10) << "update_heartbeat_peers: sharing map with old _from peer " << old_inst[p->first]
+            << dendl;
+    _share_map_outgoing(old_inst[p->first]);
+
+    if (heartbeat_to.count(p->first) && old_inst[p->first] == heartbeat_inst[p->first]) {
+      dout(10) << "update_heartbeat_peers: old _from peer " << old_inst[p->first]
+              << " is still a _to peer, not marking down" << dendl;
+    } else {
+      dout(10) << "update_heartbeat_peers: marking down old _from peer " << old_inst[p->first] 
+              << " as of " << p->second << dendl;
+      Connection *con = heartbeat_messenger->get_connection(old_inst[p->first]);
+      heartbeat_messenger->mark_disposable(con);
+      heartbeat_messenger->mark_down_on_empty(con);
+      con->put();
     }
   }