]> git.openfabrics.org - ~shefty/librdmacm.git/commit
rs-preload: Handle recursive socket() calls
authorSean Hefty <sean.hefty@intel.com>
Fri, 25 May 2012 19:42:12 +0000 (12:42 -0700)
committerSean Hefty <sean.hefty@intel.com>
Mon, 28 May 2012 00:01:28 +0000 (17:01 -0700)
commitb65c54063459dcfedd74529aaa8571b77698acea
tree58250b2d5c48e4f1b80bdbd9218d63f4a7520782
parent26364b2d9b24f936e0be3db913965825118a0201
rs-preload: Handle recursive socket() calls

When ACM support is enabled in the librdmacm, it will attempt to
establish a socket connection to the ACM daemon.  When the rsocket
preload library is in use, this can result in a recursive call
to socket() that results in the library hanging.  The resulting
call stack is:

socket() -> rsocket() -> rdma_create_id() -> ucma_init() ->
socket() -> rsocket() -> rdma_create_id() -> ucma_init()

The second call to ucma_init() hangs because initialization is
still pending.

Fix this by checking for recursive calls to socket() in the preload
library.  When detected, call the real socket() call instead of
directing the call back into rsockets().  Since rsockets is a part
of the librdmacm, it can call rsockets directly if it wants to use
rsockets instead of standard sockets.

This problem and the cause was reported by Chet Murthy <chet@watson.ibm.com>

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