From 020f01155258fdb43bfc87ce323a703d27f61e50 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 25 Mar 2014 23:39:43 +0000 Subject: [PATCH] osc/rdma: fix bugs in lock_all and flush_all This commit fixes two bugs: - We were not correctly setting the lock type in the outstanding lock for lock_all. This caused undefined behavior. - flush_all was incorrectly checking for comm size - 1 lock acks but comm size flush acks. This is the reverse of what was intended. cmr=v1.8:reviewer=jsquyres This commit was SVN r31226. --- ompi/mca/osc/rdma/osc_rdma_passive_target.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_passive_target.c b/ompi/mca/osc/rdma/osc_rdma_passive_target.c index 7821e1f542..3cbdfd41d5 100644 --- a/ompi/mca/osc/rdma/osc_rdma_passive_target.c +++ b/ompi/mca/osc/rdma/osc_rdma_passive_target.c @@ -335,6 +335,7 @@ int ompi_osc_rdma_lock_all(int assert, struct ompi_win_t *win) lock->lock_acks_received = 0; lock->unlock_acks_received = 0; lock->serial_number = module->lock_serial_number++; + lock->type = MPI_LOCK_SHARED; opal_list_append(&module->outstanding_locks, &lock->super); /* if nocheck is not specified, send a lock request to everyone @@ -458,7 +459,7 @@ static int ompi_osc_rdma_flush_lock (ompi_osc_rdma_module_t *module, ompi_osc_rd int my_rank = ompi_comm_rank (module->comm); if (-1 == lock->target) { - peer_count = ompi_comm_size(module->comm) - 1; + peer_count = ompi_comm_size(module->comm); } else { peer_count = 1; } @@ -476,7 +477,8 @@ static int ompi_osc_rdma_flush_lock (ompi_osc_rdma_module_t *module, ompi_osc_rd flush_req.serial_number = lock->serial_number; if (-1 == target) { - flush_count = ompi_comm_size(module->comm); + /* NTH: no local flush */ + flush_count = ompi_comm_size(module->comm) - 1; for (int i = 0 ; i < ompi_comm_size(module->comm) ; ++i) { if (i == my_rank) { continue;