Skip to content

Commit 6f301e0

Browse files
KAGA-KOKOdledford
authored andcommitted
RDMA/rxe: Fix a race condition related to the QP error state
The following sequence: * Change queue pair state into IB_QPS_ERR. * Post a work request on the queue pair. Triggers the following race condition in the rdma_rxe driver: * rxe_qp_error() triggers an asynchronous call of rxe_completer(), the function that examines the QP send queue. * rxe_post_send() posts a work request on the QP send queue. If rxe_completer() runs prior to rxe_post_send(), it will drain the send queue and the driver will assume no further action is necessary. However, once we post the send to the send queue, because the queue is in error, no send completion will ever happen and the send will get stuck. In order to process the send, we need to make sure that rxe_completer() gets run after a send is posted to a queue pair in an error state. This patch ensures that happens. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: Moni Shoua <monis@mellanox.com> Cc: <stable@vger.kernel.org> # v4.8 Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent da005f9 commit 6f301e0

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/infiniband/sw/rxe/rxe_verbs.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,8 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, struct ib_send_wr *wr,
814814
(queue_count(qp->sq.queue) > 1);
815815

816816
rxe_run_task(&qp->req.task, must_sched);
817+
if (unlikely(qp->req.state == QP_STATE_ERROR))
818+
rxe_run_task(&qp->comp.task, 1);
817819

818820
return err;
819821
}

0 commit comments

Comments
 (0)