fence: master - fenced: fix reported fence time

David Teigland teigland at fedoraproject.org
Thu Oct 8 21:07:02 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/fence.git?p=fence.git;a=commitdiff;h=d38cf8b6cfadd8d59ff28778400b6eacf6bc6381
Commit:        d38cf8b6cfadd8d59ff28778400b6eacf6bc6381
Parent:        12eec752e6c0c1f3873915b5faa7d234c035537e
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Thu Oct 8 14:39:31 2009 -0500
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Thu Oct 8 16:03:19 2009 -0500

fenced: fix reported fence time

The fence time reported through libfenced was the fence time on
the master node.  If the node times are different this can break
the dlm_controld check that the fence time is later than the time
it saw the node start.  Instead, save the local time when we get
the victim_done message and report that.

(I've considered this issue in the past but somehow didn't believe
there was a problem... don't recall that reasoning, so not entirely
sure there's not still something being missed.)

Signed-off-by: David Teigland <teigland at redhat.com>
---
 fence/fenced/cpg.c |   14 +++++++++++---
 fence/fenced/fd.h  |    1 +
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/fence/fenced/cpg.c b/fence/fenced/cpg.c
index 3fc7879..0b1cd48 100644
--- a/fence/fenced/cpg.c
+++ b/fence/fenced/cpg.c
@@ -602,6 +602,7 @@ void send_victim_done(struct fd *fd, int victim)
 static void receive_victim_done(struct fd *fd, struct fd_header *hd, int len)
 {
 	struct node *node;
+	struct node_history *nodeh;
 	uint32_t seq = hd->msgdata;
 	struct id_info *id;
 
@@ -620,8 +621,15 @@ static void receive_victim_done(struct fd *fd, struct fd_header *hd, int len)
 		return;
 	}
 
-	log_debug("receive_victim_done %d:%u remove victim %d how %d",
-		  hd->nodeid, seq, id->nodeid, id->fence_how);
+	log_debug("receive_victim_done %d:%u remove victim %d time %llu how %d",
+		  hd->nodeid, seq, id->nodeid,
+		  (unsigned long long)id->fence_time, id->fence_how);
+
+	nodeh = get_node_history(fd, id->nodeid);
+	if (!nodeh)
+		log_error("receive_victim_done no node history %d", id->nodeid);
+	else
+		nodeh->fence_time_local = time(NULL);
 
 	if (hd->nodeid == our_nodeid) {
 		/* sanity check, I don't think this should happen;
@@ -2233,7 +2241,7 @@ int set_node_info(struct fd *fd, int nodeid, struct fenced_node *nodeinfo)
 	if (node) {
 		nodeinfo->last_fenced_master = node->fence_master;
 		nodeinfo->last_fenced_how = node->fence_how;
-		nodeinfo->last_fenced_time = node->fence_time;
+		nodeinfo->last_fenced_time = node->fence_time_local;
 	}
 
 	return 0;
diff --git a/fence/fenced/fd.h b/fence/fenced/fd.h
index 51d51e2..f026973 100644
--- a/fence/fenced/fd.h
+++ b/fence/fenced/fd.h
@@ -132,6 +132,7 @@ struct node_history {
 	uint64_t left_time;
 	uint64_t fail_time;
 	uint64_t fence_time;
+	uint64_t fence_time_local;
 	uint64_t fence_external_time;
 	uint64_t cluster_add_time;
 	uint64_t cluster_remove_time;


More information about the cluster-commits mailing list