The RDMA CM fail calls to set REUSEADDR on an rdma_cm_id if
it is not in the idle state.  As a result, this causes a failure
in NetPipe when run with socket calls intercepted by rsockets.
Fix this by returning success when REUSEADDR is set on an rsocket
that has already been connected.  When running over IB, REUSEADDR
is not necessary, since the TCP/IP addresses are mapped.

Signed-off-by: Sean Hefty <[email protected]>
---
 src/rsocket.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/rsocket.c b/src/rsocket.c
index 2ffde9b..de0ec3e 100644
--- a/src/rsocket.c
+++ b/src/rsocket.c
@@ -1621,7 +1621,9 @@ int rsetsockopt(int socket, int level, int optname,
                        ret = rdma_set_option(rs->cm_id, RDMA_OPTION_ID,
                                              RDMA_OPTION_ID_REUSEADDR,
                                              (void *) optval, optlen);
-                       if (ret && errno == ENOSYS)
+                       if (ret && ((errno == ENOSYS) || ((rs->state != 
rs_init) &&
+                           rs->cm_id->context &&
+                           (rs->cm_id->verbs->device->transport_type == 
IBV_TRANSPORT_IB))))
                                ret = 0;
                        opt_on = *(int *) optval;
                        break;


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to