Commit 593951d8 authored by David Goodell's avatar David Goodell
Browse files

[svn-r5051] Fix for ticket #197, uninitialized usage of rreq->dev.recv_pending_count.

This ticket also converts the MPIDI_Request_recv_pending macro into two
macros which have slightly clearer names and usages.  The side effect of
the old macro was very confusing.

Reviewed by buntinas@.
parent 41e65155
......@@ -447,11 +447,17 @@ extern MPIDI_Process_t MPIDI_Process;
(req_)->dev.cancel_pending = TRUE; \
}
/* FIXME: Why does this have a side effect? */
#define MPIDI_Request_recv_pending(req_, recv_pending_) \
{ \
*(recv_pending_) = --(req_)->dev.recv_pending_count; \
}
/* the following two macros were formerly a single confusing macro with side
effects named MPIDI_Request_recv_pending() */
#define MPIDI_Request_check_pending(req_, recv_pending_) \
do { \
*(recv_pending_) = (req_)->dev.recv_pending_count; \
} while (0)
#define MPIDI_Request_decr_pending(req_) \
do { \
--(req_)->dev.recv_pending_count; \
} while (0)
/* MPIDI_Request_fetch_and_clear_rts_sreq() - atomically fetch current
partner RTS sreq and nullify partner request */
......
......@@ -244,6 +244,8 @@ typedef struct MPIDI_Request {
unsigned int state;
int cancel_pending;
/* FIXME the precise meaning of this field is unclear, comments/docs
about it should be added */
int recv_pending_count;
/* The next 8 are for RMA */
......
......@@ -436,7 +436,8 @@ int MPIDI_CH3_ReqHandler_UnpackUEBufComplete( MPIDI_VC_t *vc ATTRIBUTE((unused))
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_REQHANDLER_UNPACKUEBUFCOMPLETE);
MPIDI_Request_recv_pending(rreq, &recv_pending);
MPIDI_Request_decr_pending(rreq);
MPIDI_Request_check_pending(rreq, &recv_pending);
if (!recv_pending)
{
if (rreq->dev.recv_data_sz > 0)
......
......@@ -509,6 +509,7 @@ MPID_Request * MPIDI_CH3U_Recvq_FDP_or_AEU(MPIDI_Message_match * match,
int mpi_errno=0;
MPIDI_Request_create_rreq( rreq, mpi_errno,
found=FALSE;goto lock_exit );
rreq->dev.recv_pending_count = 1;
rreq->dev.match = *match;
rreq->dev.next = NULL;
if (recvq_unexpected_tail != NULL) {
......
......@@ -79,7 +79,10 @@ int MPID_Irecv(void * buf, int count, MPI_Datatype datatype, int rank, int tag,
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
}
MPIDI_Request_recv_pending(rreq, &recv_pending);
/* the request was found in the unexpected queue, so it has a
recv_pending_count of at least 1 */
MPIDI_Request_decr_pending(rreq);
MPIDI_Request_check_pending(rreq, &recv_pending);
if (!recv_pending)
{
/* All of the data has arrived, we need to copy the data and
......
......@@ -72,7 +72,10 @@ int MPID_Recv(void * buf, int count, MPI_Datatype datatype, int rank, int tag,
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
}
MPIDI_Request_recv_pending(rreq, &recv_pending);
/* the request was found in the unexpected queue, so it has a
recv_pending_count of at least 1 */
MPIDI_Request_decr_pending(rreq);
MPIDI_Request_check_pending(rreq, &recv_pending);
if (!recv_pending)
{
/* All of the data has arrived, we need to unpack the data and
......
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