[ofa-general] [PATCH 1/1] LIBSDP - accept() fails on 'both' after signal
Jim Mott
jim at mellanox.com
Fri Feb 8 16:21:39 PST 2008
There are some tests that use signal-driven IO on TCP sockets through
the fcntl option FASYNC. The second accept() would fall through to the
TCP socket and return EINTR. The fix is to act like we do on
nonblocking IO and use the SDP socket first again.
While this fixes the problem in the test, it is not a good idea to use
signal-driven IO on SDP sockets marked 'both'. If the application uses
FASYNC sockets, it would be better to use libsdp.conf to direct the
socket to either SDP or TCP. While this fix makes things work in the
barely useful case where a new connection is established, bad things are
likely to happen if you unleash all the TCP signal conditions on a
system with both an SDP and a TCP socket pretending to be a single
socket.
Signed-off-by: Jim Mott <jim at mellanox.com>
---
Index: ofa_1_3_dev_user/src/userspace/libsdp/src/port.c
===================================================================
--- ofa_1_3_dev_user.orig/src/userspace/libsdp/src/port.c
2008-02-04 00:32:17.000000000 -0600
+++ ofa_1_3_dev_user/src/userspace/libsdp/src/port.c 2008-02-08
19:07:01.000000000 -0600
@@ -2117,8 +2117,8 @@
shadow_fd, fopts);
- /* we need different behavior for NONBLOCK and BLOCK */
- if ((fopts > 0) && (fopts & O_NONBLOCK)) {
+ /* we need different behavior for NONBLOCK or signal IO
and BLOCK */
+ if ((fopts > 0) && (fopts & (O_NONBLOCK | FASYNC))) {
__sdp_log( 1, "ACCEPT: accepting (nonblock) on
SDP fd:<%d>\n",
shadow_fd );
ret = _socket_funcs.accept( shadow_fd, addr,
addrlen );
More information about the general
mailing list