Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Fix a potential race condition in which a progress matching thread co… #1003

Merged
merged 1 commit into from
Mar 8, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ompi/mca/pml/ob1/pml_ob1_recvreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down