diff --git a/src/mca/gpr/replica/gpr_replica.c b/src/mca/gpr/replica/gpr_replica.c index a13fd40f68..55dcd01f18 100644 --- a/src/mca/gpr/replica/gpr_replica.c +++ b/src/mca/gpr/replica/gpr_replica.c @@ -87,6 +87,7 @@ int gpr_replica_put_nl(ompi_registry_mode_t addr_mode, char *segment, ompi_registry_notify_message_t *notify_msg; int return_code, num_tokens; mca_gpr_replica_key_t *keys, *key2; + bool still_valid; if (mca_gpr_replica_debug) { @@ -178,6 +179,7 @@ int gpr_replica_put_nl(ompi_registry_mode_t addr_mode, char *segment, num_tokens, keys)) { trig->count++; } + still_valid = true; if (((OMPI_REGISTRY_SYNCHRO_MODE_ASCENDING & trig->synch_mode) && (trig->count >= trig->trigger) && (MCA_GPR_REPLICA_TRIGGER_BELOW_LEVEL == trig->above_below)) || @@ -186,19 +188,21 @@ int gpr_replica_put_nl(ompi_registry_mode_t addr_mode, char *segment, notify_msg = gpr_replica_construct_notify_message(addr_mode, segment, trig->tokens); notify_msg->trig_action = OMPI_REGISTRY_NOTIFY_NONE; notify_msg->trig_synchro = trig->synch_mode; - gpr_replica_process_triggers(segment, trig, notify_msg); + still_valid = gpr_replica_process_triggers(segment, trig, notify_msg); } else if ((OMPI_REGISTRY_NOTIFY_ALL & trig->action) || (OMPI_REGISTRY_NOTIFY_ADD_ENTRY & trig->action) || (OMPI_REGISTRY_NOTIFY_MODIFICATION & trig->action && OMPI_REGISTRY_OVERWRITE & put_mode)) { notify_msg = gpr_replica_construct_notify_message(addr_mode, segment, trig->tokens); notify_msg->trig_action = trig->action; notify_msg->trig_synchro = OMPI_REGISTRY_SYNCHRO_MODE_NONE; - gpr_replica_process_triggers(segment, trig, notify_msg); + still_valid = gpr_replica_process_triggers(segment, trig, notify_msg); } - if (trig->count > trig->trigger) { - trig->above_below = MCA_GPR_REPLICA_TRIGGER_ABOVE_LEVEL; - } else if (trig->count == trig->trigger) { - trig->above_below = MCA_GPR_REPLICA_TRIGGER_AT_LEVEL; + if (still_valid) { + if (trig->count > trig->trigger) { + trig->above_below = MCA_GPR_REPLICA_TRIGGER_ABOVE_LEVEL; + } else if (trig->count == trig->trigger) { + trig->above_below = MCA_GPR_REPLICA_TRIGGER_AT_LEVEL; + } } trig = next; } @@ -238,6 +242,7 @@ int gpr_replica_delete_object_nl(ompi_registry_mode_t addr_mode, int num_tokens, return_code; mca_gpr_replica_trigger_list_t *trig; ompi_registry_notify_message_t *notify_msg; + bool still_valid; if (mca_gpr_replica_debug) { ompi_output(0, "[%d,%d,%d] gpr replica: delete_object entered: segment 1st token", @@ -307,6 +312,7 @@ int gpr_replica_delete_object_nl(ompi_registry_mode_t addr_mode, num_tokens, keys)) { trig->count--; } + still_valid = true; if (((OMPI_REGISTRY_SYNCHRO_MODE_DESCENDING & trig->synch_mode) && (trig->count <= trig->trigger) && (MCA_GPR_REPLICA_TRIGGER_ABOVE_LEVEL == trig->above_below)) || @@ -314,18 +320,20 @@ int gpr_replica_delete_object_nl(ompi_registry_mode_t addr_mode, notify_msg = gpr_replica_construct_notify_message(addr_mode, segment, trig->tokens); notify_msg->trig_action = OMPI_REGISTRY_NOTIFY_NONE; notify_msg->trig_synchro = trig->synch_mode; - gpr_replica_process_triggers(segment, trig, notify_msg); + still_valid = gpr_replica_process_triggers(segment, trig, notify_msg); } else if ((OMPI_REGISTRY_NOTIFY_ALL & trig->action) || (OMPI_REGISTRY_NOTIFY_DELETE_ENTRY & trig->action)) { notify_msg = gpr_replica_construct_notify_message(addr_mode, segment, trig->tokens); notify_msg->trig_action = trig->action; notify_msg->trig_synchro = OMPI_REGISTRY_SYNCHRO_MODE_NONE; - gpr_replica_process_triggers(segment, trig, notify_msg); + still_valid = gpr_replica_process_triggers(segment, trig, notify_msg); } - if (trig->count < trig->trigger) { - trig->above_below = MCA_GPR_REPLICA_TRIGGER_BELOW_LEVEL; - } else if (trig->count == trig->trigger) { - trig->above_below = MCA_GPR_REPLICA_TRIGGER_AT_LEVEL; + if (still_valid) { + if (trig->count < trig->trigger) { + trig->above_below = MCA_GPR_REPLICA_TRIGGER_BELOW_LEVEL; + } else if (trig->count == trig->trigger) { + trig->above_below = MCA_GPR_REPLICA_TRIGGER_AT_LEVEL; + } } trig = next; } diff --git a/src/mca/gpr/replica/gpr_replica_internals.c b/src/mca/gpr/replica/gpr_replica_internals.c index 03fe7c39ea..71ca1e3145 100644 --- a/src/mca/gpr/replica/gpr_replica_internals.c +++ b/src/mca/gpr/replica/gpr_replica_internals.c @@ -725,7 +725,7 @@ ompi_registry_notify_message_t *gpr_replica_construct_notify_message(ompi_regist return msg; } -void gpr_replica_process_triggers(char *segment, +bool gpr_replica_process_triggers(char *segment, mca_gpr_replica_trigger_list_t *trig, ompi_registry_notify_message_t *message) { @@ -743,14 +743,13 @@ void gpr_replica_process_triggers(char *segment, /* protect against errors */ if (NULL == message || NULL == segment) { - return; + return true; } - /* OMPI_THREAD_LOCK(&mca_gpr_replica_internals_mutex); */ seg = gpr_replica_find_seg(false, segment); if (NULL == seg) { /* couldn't find segment */ - return; + return true; } if (mca_gpr_replica_debug) { @@ -773,7 +772,7 @@ void gpr_replica_process_triggers(char *segment, if (!found) { /* didn't find request */ ompi_output(0, "Notification error - request not found"); /* OMPI_THREAD_UNLOCK(&mca_gpr_replica_internals_mutex); */ - return; + return true; } /* process request */ @@ -823,6 +822,8 @@ void gpr_replica_process_triggers(char *segment, ompi_process_info.name->jobid, ompi_process_info.name->vpid); } + return false; + /* OMPI_THREAD_UNLOCK(&mca_gpr_replica_internals_mutex); */ } diff --git a/src/mca/gpr/replica/gpr_replica_internals.h b/src/mca/gpr/replica/gpr_replica_internals.h index 6ffb581b08..0c9506b030 100644 --- a/src/mca/gpr/replica/gpr_replica_internals.h +++ b/src/mca/gpr/replica/gpr_replica_internals.h @@ -85,7 +85,7 @@ mca_gpr_replica_trigger_list_t *gpr_replica_construct_trigger(ompi_registry_sync ompi_registry_notify_message_t *gpr_replica_construct_notify_message(ompi_registry_mode_t addr_mode, char *segment, char **tokens); -void gpr_replica_process_triggers(char *segment, +bool gpr_replica_process_triggers(char *segment, mca_gpr_replica_trigger_list_t *trig, ompi_registry_notify_message_t *message);