RDMA/cma: Allow enabling reuseaddr in any state
authorSean Hefty <sean.hefty@intel.com>
Wed, 29 May 2013 17:09:08 +0000 (10:09 -0700)
committerRoland Dreier <roland@purestorage.com>
Thu, 20 Jun 2013 20:08:01 +0000 (13:08 -0700)
The rdma_cm only allows setting reuseaddr if the corresponding
rdma_cm_id is in the idle state.  Allow setting this value in other
states.  This brings the behavior more inline with sockets.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/core/cma.c

index 34fbc2f60a09debc72652b4e8ab8dcef0d09dbe7..fde428bd2dad1c362a3efed01a798482132fa1e3 100644 (file)
@@ -2097,7 +2097,7 @@ int rdma_set_reuseaddr(struct rdma_cm_id *id, int reuse)
 
        id_priv = container_of(id, struct rdma_id_private, id);
        spin_lock_irqsave(&id_priv->lock, flags);
-       if (id_priv->state == RDMA_CM_IDLE) {
+       if (reuse || id_priv->state == RDMA_CM_IDLE) {
                id_priv->reuseaddr = reuse;
                ret = 0;
        } else {