]> git.openfabrics.org - ~shefty/librdmacm.git/commit
rsockets: Handle race between rshutdown and rpoll
authorSean Hefty <sean.hefty@intel.com>
Fri, 16 Aug 2013 22:15:12 +0000 (15:15 -0700)
committerSean Hefty <sean.hefty@intel.com>
Wed, 30 Oct 2013 15:46:34 +0000 (08:46 -0700)
commit86520b86ffb45d3caf6e5bd94271f99deef0a5f9
tree75b04ca01637eeac4f5b673a12c87917a9126271
parent6152fb2ea9f4e331c63c00810ee4b920e6f1af2d
rsockets: Handle race between rshutdown and rpoll

Multi-threaded applications which call rpoll and rshutdown
simultaneously can hang.  Ceph developers reported an issue
with the rsocket implementation.  Ceph calls rpoll in
one thread, and while that thread is blocked in rpoll,
a second thread may cann rshutdown on the socket.  In
normal sockets, this results in the poll call unblocking
(since a call to read on the socket will no longer block).
however, rsockets does not free the thread blocked on the
rpoll call.

To fix this, we add some additional state checking to
protect against threads calling rpoll and rshutdown
simultaneously.  We also have the rshutdown call
transition the QP into an error state.  This causes all
posted receives to complete as flushed, which results
in unblocking the thread in rpoll (to process the flushed
receives).

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
src/cma.c
src/cma.h
src/rsocket.c