1
1

Minor adjustment to latest "fix" - if a trigger was removed, the functions still attempted to adjust some of its fields, leading to potentially random failures. I've now included a check to protect against this behavior.

This commit was SVN r2727.
Этот коммит содержится в:
Ralph Castain 2004-09-16 16:49:47 +00:00
родитель 998b9b47d2
Коммит d0dffbc5ee
3 изменённых файлов: 27 добавлений и 18 удалений

Просмотреть файл

@ -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,20 +188,22 @@ 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 (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,19 +320,21 @@ 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 (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;
}

Просмотреть файл

@ -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); */
}

Просмотреть файл

@ -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);