Commit 1e171ff6 authored by Wesley Bland's avatar Wesley Bland
Browse files

Make handling of request cleanup more uniform



There are quite a few places where the request cleanup is done via:

MPIU_Object_set_ref(req, 0);
MPIDI_CH3_Request_destroy(req);

when it should be:

MPID_Request_release(req);

This makes the handling more uniform so requests are cleaned up by releasing
references rather than hitting them with the destroy hammer.

Fixes #1664
Signed-off-by: Kenneth Raffenetti's avatarKen Raffenetti <raffenet@mcs.anl.gov>
parent 6b5993af
......@@ -449,8 +449,7 @@ static int send_msg(ptl_hdr_data_t ssend_flag, struct MPIDI_VC *vc, const void *
return mpi_errno;
fn_fail:
if (sreq) {
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
sreq = NULL;
}
MPIU_CHKPMEM_REAP();
......
......@@ -457,8 +457,7 @@ int MPID_nem_scif_SendNoncontig(MPIDI_VC_t * vc, MPID_Request * sreq, void *head
MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_SCIF_SENDNONCONTIG);
return mpi_errno;
fn_fail:
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
goto fn_exit;
}
......
......@@ -805,8 +805,7 @@ fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_TCP_SENDNONCONTIG);
return mpi_errno;
fn_fail:
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
goto fn_exit;
}
......
......@@ -616,7 +616,6 @@ int MPID_nem_newtcp_SendNoncontig(MPIDI_VC_t *vc, MPID_Request *sreq, void *head
fn_exit:
return mpi_errno;
fn_fail:
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
goto fn_exit;
}
......@@ -47,8 +47,7 @@ int MPIDI_CH3_SendNoncontig_iov( MPIDI_VC_t *vc, MPID_Request *sreq,
/* --BEGIN ERROR HANDLING-- */
if (mpi_errno != MPI_SUCCESS)
{
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**ch3|eagermsg");
}
/* --END ERROR HANDLING-- */
......@@ -59,8 +58,7 @@ int MPIDI_CH3_SendNoncontig_iov( MPIDI_VC_t *vc, MPID_Request *sreq,
else
{
/* --BEGIN ERROR HANDLING-- */
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**ch3|loadsendiov");
/* --END ERROR HANDLING-- */
}
......@@ -552,8 +550,7 @@ int MPIDI_CH3_EagerContigIsend( MPID_Request **sreq_p,
/* --BEGIN ERROR HANDLING-- */
if (mpi_errno != MPI_SUCCESS)
{
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
*sreq_p = NULL;
MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**ch3|eagermsg");
}
......
......@@ -79,8 +79,7 @@ int MPIDI_CH3_EagerSyncNoncontigSend( MPID_Request **sreq_p,
/* --BEGIN ERROR HANDLING-- */
if (mpi_errno != MPI_SUCCESS)
{
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
*sreq_p = NULL;
MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**ch3|eagermsg");
}
......@@ -151,8 +150,7 @@ int MPIDI_CH3_EagerSyncZero(MPID_Request **sreq_p, int rank, int tag,
/* --BEGIN ERROR HANDLING-- */
if (mpi_errno != MPI_SUCCESS)
{
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
*sreq_p = NULL;
MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**ch3|eagermsg");
}
......
......@@ -380,8 +380,7 @@ int MPIDI_CH3_ReqHandler_GetRespDerivedDTComplete( MPIDI_VC_t *vc,
/* --BEGIN ERROR HANDLING-- */
if (mpi_errno != MPI_SUCCESS)
{
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
sreq = NULL;
MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**ch3|rmamsg");
}
......@@ -581,8 +580,7 @@ int MPIDI_CH3_ReqHandler_FOPComplete( MPIDI_VC_t *vc,
/* --BEGIN ERROR HANDLING-- */
fn_fail:
if (resp_req != NULL) {
MPIU_Object_set_ref(resp_req, 0);
MPIDI_CH3_Request_destroy(resp_req);
MPID_Request_release(resp_req);
}
goto fn_exit;
/* --END ERROR HANDLING-- */
......@@ -1209,8 +1207,7 @@ static int do_simple_get(MPID_Win *win_ptr, MPIDI_Win_lock_queue *lock_queue)
/* --BEGIN ERROR HANDLING-- */
if (mpi_errno != MPI_SUCCESS)
{
MPIU_Object_set_ref(req, 0);
MPIDI_CH3_Request_destroy(req);
MPID_Request_release(req);
MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**ch3|rmamsg");
}
/* --END ERROR HANDLING-- */
......
......@@ -1498,16 +1498,14 @@ static int MPIDI_CH3I_Send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
/* --BEGIN ERROR HANDLING-- */
fn_fail:
if (resp_req) {
MPIU_Object_set_ref(resp_req, 0);
MPIDI_CH3_Request_destroy(resp_req);
MPID_Request_release(resp_req);
}
if (*request)
{
MPIU_CHKPMEM_REAP();
if ((*request)->dev.datatype_ptr)
MPID_Datatype_release((*request)->dev.datatype_ptr);
MPIU_Object_set_ref(*request, 0);
MPIDI_CH3_Request_destroy(*request);
MPID_Request_release(*request);
}
*request = NULL;
goto fn_exit;
......@@ -1621,8 +1619,7 @@ static int MPIDI_CH3I_Send_contig_acc_msg(MPIDI_RMA_Op_t *rma_op,
fn_fail:
if (*request)
{
MPIU_Object_set_ref(*request, 0);
MPIDI_CH3_Request_destroy(*request);
MPID_Request_release(*request);
}
*request = NULL;
goto fn_exit;
......@@ -1772,13 +1769,11 @@ fn_exit:
/* --BEGIN ERROR HANDLING-- */
fn_fail:
if (*request) {
MPIU_Object_set_ref(*request, 0);
MPIDI_CH3_Request_destroy(*request);
MPID_Request_release(*request);
}
*request = NULL;
if (rmw_req) {
MPIU_Object_set_ref(rmw_req, 0);
MPIDI_CH3_Request_destroy(rmw_req);
MPID_Request_release(rmw_req);
}
goto fn_exit;
/* --END ERROR HANDLING-- */
......@@ -3787,8 +3782,7 @@ static int MPIDI_CH3I_Send_lock_put_or_acc(MPID_Win *win_ptr, int target_rank)
if (mpi_errno)
{
MPID_Datatype_release(request->dev.datatype_ptr);
MPIU_Object_set_ref(request, 0);
MPIDI_CH3_Request_destroy(request);
MPID_Request_release(request);
MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**ch3|loadsendiov");
}
/* --END ERROR HANDLING-- */
......
......@@ -56,8 +56,7 @@ int MPIDI_CH3_RndvSend( MPID_Request **sreq_p, const void * buf, int count,
/* --BEGIN ERROR HANDLING-- */
if (mpi_errno != MPI_SUCCESS)
{
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
*sreq_p = NULL;
MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**ch3|rtspkt");
}
......@@ -66,8 +65,7 @@ int MPIDI_CH3_RndvSend( MPID_Request **sreq_p, const void * buf, int count,
{
if (rts_sreq->status.MPI_ERROR != MPI_SUCCESS)
{
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
*sreq_p = NULL;
mpi_errno = rts_sreq->status.MPI_ERROR;
MPID_Request_release(rts_sreq);
......
......@@ -67,8 +67,7 @@ int MPID_Cancel_send(MPID_Request * sreq)
"send-to-self cancellation successful, sreq=0x%08x, rreq=0x%08x",
sreq->handle, rreq->handle));
MPIU_Object_set_ref(rreq, 0);
MPIDI_CH3_Request_destroy(rreq);
MPID_Request_release(rreq);
MPIR_STATUS_SET_CANCEL_BIT(sreq->status, TRUE);
/* no other thread should be waiting on sreq, so it is safe to
......
......@@ -90,8 +90,7 @@ int MPID_Irsend(const void * buf, int count, MPI_Datatype datatype, int rank, in
/* --BEGIN ERROR HANDLING-- */
if (mpi_errno != MPI_SUCCESS)
{
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
sreq = NULL;
MPIU_ERR_SET(mpi_errno, MPI_ERR_OTHER, "**ch3|eagermsg");
goto fn_exit;
......
......@@ -109,8 +109,7 @@ int MPID_Isend(const void * buf, int count, MPI_Datatype datatype, int rank,
/* --BEGIN ERROR HANDLING-- */
if (mpi_errno != MPI_SUCCESS)
{
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
sreq = NULL;
MPIU_ERR_SET(mpi_errno, MPI_ERR_OTHER, "**ch3|eagermsg");
goto fn_exit;
......
......@@ -45,8 +45,7 @@ int MPIDI_Isend_self(const void * buf, int count, MPI_Datatype datatype, int ran
/* --BEGIN ERROR HANDLING-- */
if (rreq == NULL)
{
MPIU_Object_set_ref(sreq, 0);
MPIDI_CH3_Request_destroy(sreq);
MPID_Request_release(sreq);
sreq = NULL;
MPIU_ERR_SET1(mpi_errno, MPI_ERR_OTHER, "**nomem",
"**nomemuereq %d", MPIDI_CH3U_Recvq_count_unexp());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment