Package: pacemaker Version: 1.0.9.1+hg15626-1 Severity: normal Tags: patch Whenever the attrd_local_callback routine in attrd.c is invoked with an updated value which differs from either the current value of the corresponding hash entry or its stored value it will copy the updated value to the current value of this hash entry, kill an existing scheduled CIB updated and schedule a new one. If the frequency of these updates is higher than the CIB update frequency resulting from the hash entry timeout, the CIB update will thus never be executed because the corresponding will always be killed and rescheduled before it fired.
-- System Information: Debian Release: 6.0.2 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.36.4-v3 (SMP w/4 CPU cores) Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Shell: /bin/sh linked to /bin/bash
--- pacemaker-deb/tools/attrd.c 14 Sep 2011 21:04:04 -0000 1.1.1.1 +++ pacemaker-deb/tools/attrd.c 14 Sep 2011 21:17:17 -0000 1.2 @@ -764,44 +764,47 @@ attrd_local_callback(xmlNode * msg) crm_debug("Supplied: %s, Current: %s, Stored: %s", value, hash_entry->value, hash_entry->stored_value); - - if(safe_str_eq(value, hash_entry->value) - && safe_str_eq(value, hash_entry->stored_value)) { - crm_debug_2("Ignoring non-change"); - return; - - } else if(value) { - int offset = 1; - int int_value = 0; - int value_len = strlen(value); - if(value_len < (plus_plus_len + 2) - || value[plus_plus_len] != '+' - || (value[plus_plus_len+1] != '+' && value[plus_plus_len+1] != '=')) { - goto set_unexpanded; - } - - int_value = char2score(hash_entry->value); - if(value[plus_plus_len+1] != '+') { - const char *offset_s = value+(plus_plus_len+2); - offset = char2score(offset_s); - } - int_value += offset; + + if (!safe_str_eq(value, hash_entry->value)) { + if (value) { + int offset = 1; + int int_value = 0; + int value_len = strlen(value); + if(value_len < (plus_plus_len + 2) + || value[plus_plus_len] != '+' + || (value[plus_plus_len+1] != '+' && value[plus_plus_len+1] != '=')) { + goto set_unexpanded; + } - if(int_value > INFINITY) { - int_value = INFINITY; - } + int_value = char2score(hash_entry->value); + if(value[plus_plus_len+1] != '+') { + const char *offset_s = value+(plus_plus_len+2); + offset = char2score(offset_s); + } + int_value += offset; + + if(int_value > INFINITY) { + int_value = INFINITY; + } - crm_info("Expanded %s=%s to %d", attr, value, int_value); - crm_xml_add_int(msg, F_ATTRD_VALUE, int_value); - value = crm_element_value(msg, F_ATTRD_VALUE); - } - - set_unexpanded: - crm_free(hash_entry->value); - hash_entry->value = NULL; - if(value != NULL) { - hash_entry->value = crm_strdup(value); - crm_debug("New value of %s is %s", attr, value); + crm_info("Expanded %s=%s to %d", attr, value, int_value); + crm_xml_add_int(msg, F_ATTRD_VALUE, int_value); + value = crm_element_value(msg, F_ATTRD_VALUE); + } + + set_unexpanded: + crm_free(hash_entry->value); + hash_entry->value = NULL; + if(value != NULL) { + hash_entry->value = crm_strdup(value); + crm_debug("New value of %s is %s", attr, value); + } + } else if (safe_str_eq(value, hash_entry->stored_value)) { + crm_debug_2("Ignoring non-change"); + return; + } else if (hash_entry->timer_id != 0) { + crm_debug_2("Update already scheduled"); + return; } stop_attrd_timer(hash_entry);
--- pacemaker-deb/tools/attrd.c 14 Sep 2011 21:04:04 -0000 1.1.1.1 +++ pacemaker-deb/tools/attrd.c 14 Sep 2011 21:17:17 -0000 1.2 @@ -764,44 +764,47 @@ attrd_local_callback(xmlNode * msg) crm_debug("Supplied: %s, Current: %s, Stored: %s", value, hash_entry->value, hash_entry->stored_value); - - if(safe_str_eq(value, hash_entry->value) - && safe_str_eq(value, hash_entry->stored_value)) { - crm_debug_2("Ignoring non-change"); - return; - - } else if(value) { - int offset = 1; - int int_value = 0; - int value_len = strlen(value); - if(value_len < (plus_plus_len + 2) - || value[plus_plus_len] != '+' - || (value[plus_plus_len+1] != '+' && value[plus_plus_len+1] != '=')) { - goto set_unexpanded; - } - - int_value = char2score(hash_entry->value); - if(value[plus_plus_len+1] != '+') { - const char *offset_s = value+(plus_plus_len+2); - offset = char2score(offset_s); - } - int_value += offset; + + if (!safe_str_eq(value, hash_entry->value)) { + if (value) { + int offset = 1; + int int_value = 0; + int value_len = strlen(value); + if(value_len < (plus_plus_len + 2) + || value[plus_plus_len] != '+' + || (value[plus_plus_len+1] != '+' && value[plus_plus_len+1] != '=')) { + goto set_unexpanded; + } - if(int_value > INFINITY) { - int_value = INFINITY; - } + int_value = char2score(hash_entry->value); + if(value[plus_plus_len+1] != '+') { + const char *offset_s = value+(plus_plus_len+2); + offset = char2score(offset_s); + } + int_value += offset; + + if(int_value > INFINITY) { + int_value = INFINITY; + } - crm_info("Expanded %s=%s to %d", attr, value, int_value); - crm_xml_add_int(msg, F_ATTRD_VALUE, int_value); - value = crm_element_value(msg, F_ATTRD_VALUE); - } - - set_unexpanded: - crm_free(hash_entry->value); - hash_entry->value = NULL; - if(value != NULL) { - hash_entry->value = crm_strdup(value); - crm_debug("New value of %s is %s", attr, value); + crm_info("Expanded %s=%s to %d", attr, value, int_value); + crm_xml_add_int(msg, F_ATTRD_VALUE, int_value); + value = crm_element_value(msg, F_ATTRD_VALUE); + } + + set_unexpanded: + crm_free(hash_entry->value); + hash_entry->value = NULL; + if(value != NULL) { + hash_entry->value = crm_strdup(value); + crm_debug("New value of %s is %s", attr, value); + } + } else if (safe_str_eq(value, hash_entry->stored_value)) { + crm_debug_2("Ignoring non-change"); + return; + } else if (hash_entry->timer_id != 0) { + crm_debug_2("Update already scheduled"); + return; } stop_attrd_timer(hash_entry);
--- pacemaker-deb/tools/attrd.c 14 Sep 2011 21:04:04 -0000 1.1.1.1 +++ pacemaker-deb/tools/attrd.c 14 Sep 2011 21:17:17 -0000 1.2 @@ -764,44 +764,47 @@ attrd_local_callback(xmlNode * msg) crm_debug("Supplied: %s, Current: %s, Stored: %s", value, hash_entry->value, hash_entry->stored_value); - - if(safe_str_eq(value, hash_entry->value) - && safe_str_eq(value, hash_entry->stored_value)) { - crm_debug_2("Ignoring non-change"); - return; - - } else if(value) { - int offset = 1; - int int_value = 0; - int value_len = strlen(value); - if(value_len < (plus_plus_len + 2) - || value[plus_plus_len] != '+' - || (value[plus_plus_len+1] != '+' && value[plus_plus_len+1] != '=')) { - goto set_unexpanded; - } - - int_value = char2score(hash_entry->value); - if(value[plus_plus_len+1] != '+') { - const char *offset_s = value+(plus_plus_len+2); - offset = char2score(offset_s); - } - int_value += offset; + + if (!safe_str_eq(value, hash_entry->value)) { + if (value) { + int offset = 1; + int int_value = 0; + int value_len = strlen(value); + if(value_len < (plus_plus_len + 2) + || value[plus_plus_len] != '+' + || (value[plus_plus_len+1] != '+' && value[plus_plus_len+1] != '=')) { + goto set_unexpanded; + } - if(int_value > INFINITY) { - int_value = INFINITY; - } + int_value = char2score(hash_entry->value); + if(value[plus_plus_len+1] != '+') { + const char *offset_s = value+(plus_plus_len+2); + offset = char2score(offset_s); + } + int_value += offset; + + if(int_value > INFINITY) { + int_value = INFINITY; + } - crm_info("Expanded %s=%s to %d", attr, value, int_value); - crm_xml_add_int(msg, F_ATTRD_VALUE, int_value); - value = crm_element_value(msg, F_ATTRD_VALUE); - } - - set_unexpanded: - crm_free(hash_entry->value); - hash_entry->value = NULL; - if(value != NULL) { - hash_entry->value = crm_strdup(value); - crm_debug("New value of %s is %s", attr, value); + crm_info("Expanded %s=%s to %d", attr, value, int_value); + crm_xml_add_int(msg, F_ATTRD_VALUE, int_value); + value = crm_element_value(msg, F_ATTRD_VALUE); + } + + set_unexpanded: + crm_free(hash_entry->value); + hash_entry->value = NULL; + if(value != NULL) { + hash_entry->value = crm_strdup(value); + crm_debug("New value of %s is %s", attr, value); + } + } else if (safe_str_eq(value, hash_entry->stored_value)) { + crm_debug_2("Ignoring non-change"); + return; + } else if (hash_entry->timer_id != 0) { + crm_debug_2("Update already scheduled"); + return; } stop_attrd_timer(hash_entry);
--- pacemaker-deb/tools/attrd.c 14 Sep 2011 21:04:04 -0000 1.1.1.1 +++ pacemaker-deb/tools/attrd.c 14 Sep 2011 21:17:17 -0000 1.2 @@ -764,44 +764,47 @@ attrd_local_callback(xmlNode * msg) crm_debug("Supplied: %s, Current: %s, Stored: %s", value, hash_entry->value, hash_entry->stored_value); - - if(safe_str_eq(value, hash_entry->value) - && safe_str_eq(value, hash_entry->stored_value)) { - crm_debug_2("Ignoring non-change"); - return; - - } else if(value) { - int offset = 1; - int int_value = 0; - int value_len = strlen(value); - if(value_len < (plus_plus_len + 2) - || value[plus_plus_len] != '+' - || (value[plus_plus_len+1] != '+' && value[plus_plus_len+1] != '=')) { - goto set_unexpanded; - } - - int_value = char2score(hash_entry->value); - if(value[plus_plus_len+1] != '+') { - const char *offset_s = value+(plus_plus_len+2); - offset = char2score(offset_s); - } - int_value += offset; + + if (!safe_str_eq(value, hash_entry->value)) { + if (value) { + int offset = 1; + int int_value = 0; + int value_len = strlen(value); + if(value_len < (plus_plus_len + 2) + || value[plus_plus_len] != '+' + || (value[plus_plus_len+1] != '+' && value[plus_plus_len+1] != '=')) { + goto set_unexpanded; + } - if(int_value > INFINITY) { - int_value = INFINITY; - } + int_value = char2score(hash_entry->value); + if(value[plus_plus_len+1] != '+') { + const char *offset_s = value+(plus_plus_len+2); + offset = char2score(offset_s); + } + int_value += offset; + + if(int_value > INFINITY) { + int_value = INFINITY; + } - crm_info("Expanded %s=%s to %d", attr, value, int_value); - crm_xml_add_int(msg, F_ATTRD_VALUE, int_value); - value = crm_element_value(msg, F_ATTRD_VALUE); - } - - set_unexpanded: - crm_free(hash_entry->value); - hash_entry->value = NULL; - if(value != NULL) { - hash_entry->value = crm_strdup(value); - crm_debug("New value of %s is %s", attr, value); + crm_info("Expanded %s=%s to %d", attr, value, int_value); + crm_xml_add_int(msg, F_ATTRD_VALUE, int_value); + value = crm_element_value(msg, F_ATTRD_VALUE); + } + + set_unexpanded: + crm_free(hash_entry->value); + hash_entry->value = NULL; + if(value != NULL) { + hash_entry->value = crm_strdup(value); + crm_debug("New value of %s is %s", attr, value); + } + } else if (safe_str_eq(value, hash_entry->stored_value)) { + crm_debug_2("Ignoring non-change"); + return; + } else if (hash_entry->timer_id != 0) { + crm_debug_2("Update already scheduled"); + return; } stop_attrd_timer(hash_entry);