]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: clear_pipe+queue reset when replacing lossy connections 375/head
authorSage Weil <sage@inktank.com>
Mon, 24 Jun 2013 01:09:55 +0000 (18:09 -0700)
committerSage Weil <sage@inktank.com>
Mon, 24 Jun 2013 01:09:55 +0000 (18:09 -0700)
We already handle the lossless replacement and lossy fault paths, but
not the lossy replacement.  This fixes an assert(!cleared) in the
reaper.  Adjust comments appropriately.

Signed-off-by: Sage Weil <sage@inktank.com>
src/msg/Pipe.cc
src/msg/SimpleMessenger.cc

index e425bc1bb2d743e210d568c8264d6f9726891ce5..b581e3673325ddc60e55710153caa9cc4fbcae34 100644 (file)
@@ -555,7 +555,12 @@ int Pipe::accept()
   existing->unregister_pipe();
   replaced = true;
 
-  if (!existing->policy.lossy) {
+  if (existing->policy.lossy) {
+    // disconnect from the Connection
+    assert(existing->connection_state);
+    if (existing->connection_state->clear_pipe(existing))
+      msgr->dispatch_queue.queue_reset(existing->connection_state.get());
+  } else {
     // queue a reset on the old connection
     msgr->dispatch_queue.queue_reset(connection_state.get());
 
@@ -565,7 +570,7 @@ int Pipe::accept()
     connection_state = existing->connection_state;
 
     // make existing Connection reference us
-    existing->connection_state->reset_pipe(this);
+    connection_state->reset_pipe(this);
 
     // flush/queue any existing delayed messages
     if (existing->delay_thread)
index 0b0fa662ebaeb512b453d2df06f9d439ec52cb37..48e37d87098404547638e43475ec38744653bb3e 100644 (file)
@@ -223,7 +223,9 @@ void SimpleMessenger::reaper()
     p->pipe_lock.Lock();
     p->discard_out_queue();
     if (p->connection_state) {
-      // mark_down, mark_down_all, or fault() should have done this, but make sure!
+      // mark_down, mark_down_all, or fault() should have done this,
+      // or accept() may have switch the Connection to a different
+      // Pipe... but make sure!
       bool cleared = p->connection_state->clear_pipe(p);
       assert(!cleared);
     }