Skip to content

Commit

Permalink
ch4/am: hold a reference to comm in long_req_target_msg_cb
Browse files Browse the repository at this point in the history
By the time we match the request, the comm may have been freed from user
space already. Hold on to a reference so we are still able to use it to
send additional active messages.

This should not be necessary if we use global rank in sending am
transport.
  • Loading branch information
hzhou committed Feb 25, 2020
1 parent 0f12039 commit baad166
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/mpid/ch4/src/ch4r_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,12 @@ int MPIDIG_send_long_req_target_msg_cb(int handler_id, void *am_hdr, void **data
}
MPID_THREAD_CS_EXIT(VCI, MPIDIU_THREAD_MPIDIG_GLOBAL_MUTEX);
} else {
/* Matching receive was posted, tell the netmod */
MPIR_Comm_release(root_comm); /* -1 for posted_list */
/* Matching receive was posted */
rreq->comm = root_comm;
/* NOTE: we are skipping MPIR_Comm_release for taking off posted_list since we are holding
* the reference to root_comm in the rreq. We need to hold on to this reference so the comm
* may remain valid by the time we send ack (using the comm).
*/
MPIDIG_REQUEST(rreq, req->status) |= MPIDIG_REQ_LONG_RTS;
MPIDIG_REQUEST(rreq, req->rreq.peer_req_ptr) = lreq_hdr->sreq_ptr;
MPIDIG_REQUEST(rreq, rank) = hdr->src_rank;
Expand Down

0 comments on commit baad166

Please sign in to comment.