cluster: RHEL6 - cman: check for new config only once per second
Fabio M. Di Nitto
fabbione at fedoraproject.org
Fri Jul 23 07:34:12 UTC 2010
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=48da29636cd862a012e38ef4860d2d4e99aede4d
Commit: 48da29636cd862a012e38ef4860d2d4e99aede4d
Parent: 657368d7d68eae52db155828e2087bdea51a4417
Author: Jan Friesse <jfriesse at redhat.com>
AuthorDate: Thu Jul 22 13:48:37 2010 +0200
Committer: Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Fri Jul 23 09:33:31 2010 +0200
cman: check for new config only once per second
This patch fixes a condition where user calls cman_tool version
multiple times where version is non existing multiple times.
This will cause addition of many corosync_timers and new configuration
is then tested every 1/(no. calls) sec, instead of (default) 1sec. If
fraction is really small, corosync will keep reloading file using 100%
CPU time and doing nothing else.
Resolves: rhbz#616222
---
cman/daemon/commands.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index c223a81..604e400 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -85,6 +85,7 @@ static uint32_t shutdown_flags;
static int shutdown_yes;
static int shutdown_no;
static int shutdown_expected;
+static int ccsd_timer_active = 0;
static struct cluster_node *find_node_by_nodeid(int nodeid);
static struct cluster_node *find_node_by_name(char *name);
@@ -1206,8 +1207,10 @@ static int reread_config(int new_version)
/* Keep looking */
if (read_err || config_version < wanted_config_version) {
- corosync->timer_add_duration((unsigned long long)ccsd_poll_interval*1000000, NULL,
- ccsd_timer_fn, &ccsd_timer);
+ if (!ccsd_timer_active)
+ corosync->timer_add_duration((unsigned long long)ccsd_poll_interval*1000000, NULL,
+ ccsd_timer_fn, &ccsd_timer);
+ ccsd_timer_active = 1;
}
else {
recalculate_quorum(1, 0);
@@ -1220,6 +1223,9 @@ static int reread_config(int new_version)
static void ccsd_timer_fn(void *arg)
{
log_printf(LOG_DEBUG, "Polling configuration for updated information\n");
+
+ ccsd_timer_active = 0;
+
if (!reread_config(wanted_config_version) && config_version >= wanted_config_version) {
log_printf(LOG_ERR, "Now got config information version %d, continuing\n", config_version);
config_error = 0;
More information about the cluster-commits
mailing list