From: Ariel Nahum <[email protected]>

In some circumstances (multiple targets), RDMA_CM ESTABLISHED event and
ep_disconnect may race. In this case, the iser connection state may
transition to UP (after ep_disconnect transitioned it to TERMINATING),
while the connection is being teared down.

Upon RDMA_CM event ESTABLISHED we allow iser connection state to transition
to UP only from PENDING. We also make sure to protect this state change
(done under the connection lock).

Signed-off-by: Ariel Nahum <[email protected]>
Signed-off-by: Sagi Grimberg <[email protected]>
Reviewed-by: Or Gerlitz <[email protected]>
---
 drivers/infiniband/ulp/iser/iser_verbs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c 
b/drivers/infiniband/ulp/iser/iser_verbs.c
index 4c698e5..ea01075 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -732,8 +732,8 @@ static void iser_connected_handler(struct rdma_cm_id 
*cma_id)
        iser_info("remote qpn:%x my qpn:%x\n", attr.dest_qp_num, 
cma_id->qp->qp_num);
 
        ib_conn = (struct iser_conn *)cma_id->context;
-       ib_conn->state = ISER_CONN_UP;
-       wake_up_interruptible(&ib_conn->wait);
+       if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_PENDING, ISER_CONN_UP))
+               wake_up_interruptible(&ib_conn->wait);
 }
 
 static void iser_disconnected_handler(struct rdma_cm_id *cma_id)
-- 
1.7.1

--
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