Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 8947872a56f49f1658d793a8e9b60efa5337eba8
Parent: 7fc46e322b78c59b160d6dade2699eb841353a61
Author: John Ruemker <jruemker(a)redhat.com>
AuthorDate: Wed Feb 15 18:37:01 2012 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Wed Feb 15 18:37:01 2012 -0500
cman: Improve quorum timer handling how quorum timers work
Previously, the timer was simply once per quorumd poll interval.
This led to a possibility of qdiskd (or other programs using the
CMAN quorum API) to continue as 'alive' until a time period greater
than the poll interval.
With this patch, the quorum device timer is reset each time the
program using the quorum API.
Resolves: rhbz#759603
Signed-off-by: John Ruemker <jruemker(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/daemon/commands.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index f397234..e7df2f3 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -1331,19 +1331,21 @@ static void ccsd_timer_fn(void *arg)
static void quorum_device_timer_fn(void *arg)
{
struct timeval now;
+ unsigned long long timediff_us;
if (!quorum_device || quorum_device->state == NODESTATE_DEAD)
return;
log_printf(LOGSYS_LEVEL_DEBUG, "memb: quorum_device_timer_fn\n");
gettimeofday(&now, NULL);
- if (quorum_device->last_hello.tv_sec + quorumdev_poll/1000 < now.tv_sec) {
+ timediff_us=((now.tv_sec - quorum_device->last_hello.tv_sec)*1000000 + (now.tv_usec -
quorum_device->last_hello.tv_usec));
+ if (timediff_us >= quorumdev_poll*1000) {
quorum_device->state = NODESTATE_DEAD;
log_printf(LOG_INFO, "lost contact with quorum device\n");
recalculate_quorum(0, 0);
}
else {
- corosync->timer_add_duration((unsigned long long)quorumdev_poll*1000000,
quorum_device,
- quorum_device_timer_fn, &quorum_device_timer);
+ corosync->timer_add_duration(1000*(quorumdev_poll*1000 - timediff_us),
+ quorum_device, quorum_device_timer_fn, &quorum_device_timer);
}
}