]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: avoid clearing connection_state on pipe replacement
authorSage Weil <sage@newdream.net>
Tue, 17 May 2011 17:10:45 +0000 (10:10 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Wed, 18 May 2011 00:27:56 +0000 (17:27 -0700)
read_message and write_message both dereference connection-state, so avoid
clearing it when replacing a pipe.

read_message still uses it to find rx_buffers in ways that may interfere
when two Pipes reference the connection, but currently that is only used
for lossy pipes.  We could still take pipe_lock in that case, but it is
only an optimization (we copy the data if the buffers don't get used
directly) and probably not worth bothering with.

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

index e9fcbba86319b0738e012a06caa4f00bc4314f94..d680a63b880ea926294e15c32ce3992639f20ef4 100644 (file)
@@ -881,8 +881,9 @@ int SimpleMessenger::Pipe::accept()
                                     should let the daemon handle it itself.
     Otherwise, take over other Connection so we don't lose older messages */
     existing->connection_state->reset_pipe(this);
-    existing->connection_state->put();
-    existing->connection_state = NULL;
+
+    // do not clear existing->connection_state, since read_message and write_message both
+    // dereference it without pipe_lock.
 
     // steal queue and out_seq
     existing->requeue_sent();