Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66d4e62d authored by Ariel Nahum's avatar Ariel Nahum Committed by Roland Dreier
Browse files

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: default avatarAriel Nahum <arieln@mellanox.com>
Signed-off-by: default avatarSagi Grimberg <sagig@mellanox.com>
Reviewed-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent b73c3ada
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -732,7 +732,7 @@ 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;
	if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_PENDING, ISER_CONN_UP))
		wake_up_interruptible(&ib_conn->wait);
}