]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
SimpleMessenger: Pipe: do not block on takeover while holding global lock
authorGreg Farnum <gfarnum@redhat.com>
Tue, 28 Oct 2014 23:45:43 +0000 (16:45 -0700)
committerSage Weil <sage@redhat.com>
Mon, 12 Jan 2015 19:17:06 +0000 (11:17 -0800)
commit1dbe8f5a6f7bf2b7c86d24f27d569d71e0076ee9
treec830144b0a137b804e7b3fac4a7b5c3a845c7237
parent16c023d8fa5575d4dd138aeee4d4fd9b8f32c0f6
SimpleMessenger: Pipe: do not block on takeover while holding global lock

We previously were able to cause deadlocks:
1) Existing pipe is fast_dispatching
2) Replacement incoming pipe is accepted
  *) blocks on stop_and_wait() of existing Pipe
3) External things are blocked on SimpleMessenger::lock() while
  blocking completion of the fast dispatch.

To resolve this, if we detect that an existing Pipe we want to take over is
in the process of fast dispatching, we unlock our locks and wait on it to
finish. Then we go back to the lookup step and retry.

The effect of this should be safe:
1) We are not making any changes to the existing Pipe in new ways
2) We have not registered the new Pipe anywhere
3) We have not sent back any replies based on Messenger state to
   the remote endpoint.

Backport: giant
Fixes: #9921
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
(cherry picked from commit 2d6980570af2226fdee0edfcfe5a8e7f60fae615)
src/msg/Pipe.cc
src/msg/Pipe.h