cluster: STABLE3 - fenced: fix reported fence time

David Teigland teigland at fedoraproject.org
Thu Oct 8 20:58:27 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=31b667749ef522d8d17472365231f223951474c6
Commit:        31b667749ef522d8d17472365231f223951474c6
Parent:        43ee13f381d6b0c7c40c8716c43ceb77ab3e2caf
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 15:53:20 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 0bd2057..6714687 100644
--- a/fence/fenced/cpg.c
+++ b/fence/fenced/cpg.c
@@ -600,6 +600,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;
 
@@ -618,8 +619,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;
@@ -2229,7 +2237,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 ab162b8..9f64dff 100644
--- a/fence/fenced/fd.h
+++ b/fence/fenced/fd.h
@@ -139,6 +139,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