]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
Pipe: wait for Pipes to finish running, instead of just stop()ing them
authorGreg Farnum <greg@inktank.com>
Mon, 5 May 2014 04:58:04 +0000 (21:58 -0700)
committerGreg Farnum <greg@inktank.com>
Tue, 6 May 2014 18:39:34 +0000 (11:39 -0700)
commit2d5d3097c3998add1061ce253104154d72879237
treebf38d6c400e1157ed1566886dabe9ad20f7ac3a5
parent4bf20afcf84b5778f4d0ce32135480a60827d061
Pipe: wait for Pipes to finish running, instead of just stop()ing them

Add a stop_and_wait() function that, in addition to closing the Pipe and killing
its socket, waits for any fast_dispatch call which is in-progress. Use this in
several parts of the Pipe and SimpleMessenger code where appropriate.

This fixes several races with fast_dispatch and other avenues; here are two:
1) It could be that we grab the lock while the existing pipe is fast_dispatching
and then proceed to dispatch messages ourself, beating it. Instead, wait for
the other pipe. Add a "reader_dispatching" member which tells bus this is
happening, and when re-locking, signal the cond if we're shutting down.

2) It could be that a normally-dispatched Message in the OSD triggers a
mark_down() on the Connection and then clears out the Session
(Connection::priv) pointer, causing a racing fast_dispatch()'ed function to
assert out in the OSD because it requires a valid Session.

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