IB/ehca: Wait for async events to finish before destroying QP
This is necessary because, in a multicore environment, a race between uverbs async handler and destroy QP could occur. Signed-off-by: Stefan Roscher <stefan.roscher at de.ibm.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:

committed by
Roland Dreier

parent
ab69b3cf12
commit
12137c593d
@@ -204,6 +204,8 @@ static void qp_event_callback(struct ehca_shca *shca, u64 eqe,
|
||||
|
||||
read_lock(&ehca_qp_idr_lock);
|
||||
qp = idr_find(&ehca_qp_idr, token);
|
||||
if (qp)
|
||||
atomic_inc(&qp->nr_events);
|
||||
read_unlock(&ehca_qp_idr_lock);
|
||||
|
||||
if (!qp)
|
||||
@@ -223,6 +225,8 @@ static void qp_event_callback(struct ehca_shca *shca, u64 eqe,
|
||||
if (fatal && qp->ext_type == EQPT_SRQBASE)
|
||||
dispatch_qp_event(shca, qp, IB_EVENT_QP_LAST_WQE_REACHED);
|
||||
|
||||
if (atomic_dec_and_test(&qp->nr_events))
|
||||
wake_up(&qp->wait_completion);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user