1
1

Fix a potential race condition in which a progress matching thread could match a request while we are cancelling it.

Этот коммит содержится в:
Aurélien Bouteiller 2016-03-01 16:43:45 -05:00
родитель c9f7bb6751
Коммит 892e1ed57e

Просмотреть файл

@ -103,13 +103,14 @@ static int mca_pml_ob1_recv_request_cancel(struct ompi_request_t* ompi_request,
ompi_communicator_t *comm = request->req_recv.req_base.req_comm;
mca_pml_ob1_comm_t *ob1_comm = comm->c_pml_comm;
/* The rest should be protected behind the match logic lock */
OPAL_THREAD_LOCK(&ob1_comm->matching_lock);
if( true == request->req_match_received ) { /* way to late to cancel this one */
OPAL_THREAD_UNLOCK(&ob1_comm->matching_lock);
assert( OMPI_ANY_TAG != ompi_request->req_status.MPI_TAG ); /* not matched isn't it */
return OMPI_SUCCESS;
}
/* The rest should be protected behind the match logic lock */
OPAL_THREAD_LOCK(&ob1_comm->matching_lock);
if( request->req_recv.req_base.req_peer == OMPI_ANY_SOURCE ) {
opal_list_remove_item( &ob1_comm->wild_receives, (opal_list_item_t*)request );
} else {