From 864f88a2a3f7bcd0c685fa6f418b6e06c0a49a6f Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 21 Oct 2015 18:27:10 -0600 Subject: [PATCH] osc/pt2pt: reset all_sync sync object before sending complete messages This commit fixes a bug that occurs when a post message comes in when sending complete messages or while waiting for all outgoing messages to flush. In that case the post message might get incorrecly associated with the ending sync object. References open-mpi/ompi#1012 Signed-off-by: Nathan Hjelm --- ompi/mca/osc/pt2pt/osc_pt2pt_active_target.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_active_target.c b/ompi/mca/osc/pt2pt/osc_pt2pt_active_target.c index 77a45d61fe..22f9d1f7c4 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_active_target.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_active_target.c @@ -321,6 +321,9 @@ int ompi_osc_pt2pt_complete (ompi_win_t *win) peers = sync->peer_list.peers; + /* need to reset the sync here to avoid processing incorrect post messages */ + ompi_osc_pt2pt_sync_reset (sync); + OPAL_THREAD_UNLOCK(&module->lock); OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, @@ -396,8 +399,6 @@ int ompi_osc_pt2pt_complete (ompi_win_t *win) opal_condition_wait(&module->cond, &module->lock); } - ompi_osc_pt2pt_sync_reset (sync); - /* unlock here, as group cleanup can take a while... */ OPAL_THREAD_UNLOCK(&module->lock);