From 0e822e03f7ba83c5531ce13a55bf4d3a711291e7 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Thu, 12 Feb 2015 18:50:59 -0700 Subject: [PATCH] osc/sm: always release the lock on MPI_Unlock When a lock was obtained with MPI_MODE_NOCHECK it was not correctly release on unlock. This is an error. Signed-off-by: Nathan Hjelm --- ompi/mca/osc/sm/osc_sm_passive_target.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ompi/mca/osc/sm/osc_sm_passive_target.c b/ompi/mca/osc/sm/osc_sm_passive_target.c index a9a8fe90bc..c54be0b496 100644 --- a/ompi/mca/osc/sm/osc_sm_passive_target.c +++ b/ompi/mca/osc/sm/osc_sm_passive_target.c @@ -1,7 +1,7 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2014 Los Alamos National Security, LLC. All rights + * Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -150,18 +150,20 @@ ompi_osc_sm_unlock(int target, /* ensure all memory operations have completed */ opal_atomic_mb(); + if (lock_none == module->outstanding_locks[target]) { + return OMPI_ERR_RMA_SYNC; + } + if (module->outstanding_locks[target] == lock_nocheck) { ret = OMPI_SUCCESS; } else if (module->outstanding_locks[target] == lock_exclusive) { ret = end_exclusive(module, target); - module->outstanding_locks[target] = lock_none; } else if (module->outstanding_locks[target] == lock_shared) { ret = end_shared(module, target); - module->outstanding_locks[target] = lock_none; - } else { - ret = OMPI_ERR_RMA_SYNC; } + module->outstanding_locks[target] = lock_none; + return ret; }