aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAriel Nahum <arieln@mellanox.com>2014-05-22 04:00:19 -0400
committerRoland Dreier <roland@purestorage.com>2014-05-26 11:19:48 -0400
commit66d4e62d27875f3ae417e3b73396e290bb184b5c (patch)
tree8c6390d7bbd438ffbf2ab0001a426ba2bd8a8602
parentb73c3adabdb1e2cb2f2c69bc3cbb9306aa3f9700 (diff)
IB/iser: Fix a possible race in iser connection states transition
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 torn 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 <arieln@mellanox.com> Signed-off-by: Sagi Grimberg <sagig@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c4
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 4c698e58e550..ea01075f9f9b 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)
732 iser_info("remote qpn:%x my qpn:%x\n", attr.dest_qp_num, cma_id->qp->qp_num); 732 iser_info("remote qpn:%x my qpn:%x\n", attr.dest_qp_num, cma_id->qp->qp_num);
733 733
734 ib_conn = (struct iser_conn *)cma_id->context; 734 ib_conn = (struct iser_conn *)cma_id->context;
735 ib_conn->state = ISER_CONN_UP; 735 if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_PENDING, ISER_CONN_UP))
736 wake_up_interruptible(&ib_conn->wait); 736 wake_up_interruptible(&ib_conn->wait);
737} 737}
738 738
739static void iser_disconnected_handler(struct rdma_cm_id *cma_id) 739static void iser_disconnected_handler(struct rdma_cm_id *cma_id)