Skip to contentSkip to conversation

Cluster Project branch, master, updated. gfs-kernel_0_1_22-215-g1307d58

Cluster-devel [email protected] 1 participant 1 message Apr 25, 2008

lore
Share & tools
lore
#0 lore raw

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=1307d58730031a6d9f7401ba7182034e73280b49

The branch, master has been updated

       via  1307d58730031a6d9f7401ba7182034e73280b49 (commit)
      from  5ec7deb8f5677cc33b6b0c3bf3cc3d3d9d8c2dfd (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

- Log ----------------------------------------------------------------- commit 1307d58730031a6d9f7401ba7182034e73280b49

Author: David Teigland <[email protected]>
Date:   Fri Apr 25 12:48:29 2008 -0500

fence: using new libs

Filling out various incomplete parts, making use of the new interfaces.

-----------------------------------------------------------------------

Summary of changes:

 fence/fence_node/fence_node.c |    2 +
 fence/fence_tool/Makefile     |    3 +-
 fence/fence_tool/fence_tool.c |    5 ++-
 fence/fenced/cpg.c            |   54 ++++++++++++++++++++++++++-
 fence/fenced/fd.h             |    1 +
 fence/fenced/main.c           |   37 +++++++++++++-----
 fence/fenced/member_cman.c    |   84 +++++++++++++++++++++++++++++++++++-----
 fence/libfenced/libfenced.h   |    2 -
 group/dlm_controld/Makefile   |    4 +-
 group/dlm_controld/cpg.c      |   37 +++++++++++-------
 10 files changed, 186 insertions(+), 43 deletions(-)
fence/fence_node/fence_node.c +2 -0
index 6662f52..00fe6ea 100644
@@ -108,6 +108,8 @@ int main(int argc, char *argv[])
 	} else {
 		syslog(LOG_NOTICE, "Fence of \"%s\" was successful\n", victim);
 
+		/* Tell fenced what we've done so that it can avoid fencing
+		   this node again if the fence_node() rebooted it. */
 		fenced_external(victim);
 
 		exit(EXIT_SUCCESS);
fence/fence_tool/Makefile +1 -2
index faf6580..c3b1a22 100644
@@ -27,11 +27,10 @@ OBJS=fence_tool.o
 
 CFLAGS += -D_FILE_OFFSET_BITS=64
 CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${fencedincdir}
-CFLAGS += -I$(S)/../include -I$(SRCDIR)/group/lib
+CFLAGS += -I$(S)/../include
 CFLAGS += -I${incdir} 
 
 LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -L${fencedlibdir} -lccs -lcman -lfenced
-LDFLAGS += -L../../group/lib -lgroup 
 
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)
fence/fence_tool/fence_tool.c +4 -1
index 72c262e..334231c 100644
@@ -31,7 +31,6 @@
 #include "ccs.h"
 #include "copyright.cf"
 #include "libcman.h"
-#include "libgroup.h"
 #include "libfenced.h"
 
 #define OPTION_STRING			("Vht:wQ")
@@ -142,6 +141,7 @@ static void sigalarm_handler(int sig)
 
 static int we_are_in_fence_domain(void)
 {
+#if 0
 	group_data_t gdata;
 	int rv;
 
@@ -152,6 +152,9 @@ static int we_are_in_fence_domain(void)
 		return 0;
 
 	return gdata.member;
+#endif
+	printf("FIXME: use libfenced:fenced_domain_members()\n");
+	return 1;
 }
 
 /*
fence/fenced/cpg.c +53 -1

72 lines not on this page · raw message

fence/fenced/fd.h +1 -0
index 605cb1b..413d75c 100644
@@ -268,6 +268,7 @@ void process_cman(int ci);
 int setup_cman(void);
 int is_cman_member(int nodeid);
 char *nodeid_to_name(int nodeid);
+int name_to_nodeid(char *name);
 struct node *get_new_node(struct fd *fd, int nodeid);
 
 /* recover.c */
fence/fenced/main.c +27 -10
index f208378..2e08355 100644
@@ -244,23 +244,21 @@ static int do_leave(char *name)
 	return rv;
 }
 
-static int do_external(char *name, int ci)
+static int do_external(char *name, char *extra, int extra_len)
 {
 	struct fd *fd;
-	int nodeid = 0;
+	int rv = 0;
 
 	fd = find_fd(name);
 	if (!fd)
 		return -EINVAL;
 
 	if (group_mode == GROUP_LIBGROUP)
-		return -EINVAL;
-
-	/* FIXME: do_read(client[ci].fd, buf, MAX_NODENAME_LEN);
-	   which gets the nodename, then translate the nodename to nodeid */
+		rv = -ENOSYS;
+	else
+		send_external(fd, name_to_nodeid(extra));
 
-	send_external(fd, nodeid);
-	return 0;
+	return rv;
 }
 
 /* combines a header and the data and sends it back to the client in
@@ -397,7 +395,8 @@ static void do_domain_members(int ci, int max)
 static void process_connection(int ci)
 {
 	struct fenced_header h;
-	int rv;
+	char *extra = NULL;
+	int rv, extra_len;
 
 	rv = do_read(client[ci].fd, &h, sizeof(h));
 	if (rv < 0) {
@@ -415,6 +414,22 @@ static void process_connection(int ci)
 		goto out;
 	}
 
+	if (h.len > sizeof(h)) {
+		extra_len = h.len - sizeof(h);
+		extra = malloc(extra_len);
+		if (!extra) {
+			log_error("process_connection no mem %d", extra_len);
+			goto out;
+		}
+		memset(extra, 0, extra_len);
+
+		rv = do_read(client[ci].fd, extra, extra_len);
+		if (rv < 0) {
+			log_debug("connection %d extra read error %d", ci, rv);
+			goto out;
+		}
+	}
+
 	switch (h.command) {
 	case FENCED_CMD_JOIN:
 		do_join("default");
@@ -423,7 +438,7 @@ static void process_connection(int ci)
 		do_leave("default");
 		break;
 	case FENCED_CMD_EXTERNAL:
-		do_external("default", ci);
+		do_external("default", extra, extra_len);
 		break;
 	case FENCED_CMD_DUMP_DEBUG:
 		do_dump(ci);
@@ -442,6 +457,8 @@ static void process_connection(int ci)
 			  ci, h.command);
 	}
  out:
+	if (extra)
+		free(extra);
 	client_dead(ci);
 }
 
fence/fenced/member_cman.c +73 -11

106 lines not on this page · raw message

fence/libfenced/libfenced.h +0 -2
index b10055b..a79d188 100644
@@ -32,8 +32,6 @@ struct fenced_node {
 	int last_fenced_master;
 	int last_fenced_how;
 	uint64_t last_fenced_time;
-	uint64_t last_joined_time;
-	uint64_t last_remove_time;
 };
 
 struct fenced_domain {
group/dlm_controld/Makefile +2 -2
index 8098bad..4c6376c 100644
@@ -33,12 +33,12 @@ OBJS=	action.o \
 	plock.o \
 	group.o
 
-CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir} -I${openaisincdir}
+CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir} -I${openaisincdir} -I${fencedincdir}
 CFLAGS += -I${KERNEL_SRC}/include/
 CFLAGS += -I$(S)/../lib/ -I$(S)/../include/
 CFLAGS += -I${incdir}
 
-LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -L${dlmlibdir} -lccs -lcman -ldlm
+LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -L${dlmlibdir} -L${fencedlibdir} -lccs -lcman -ldlm -lfenced
 LDFLAGS += -L${openaislibdir} -lcpg -lSaCkpt
 LDFLAGS += -L../lib -lgroup
 
group/dlm_controld/cpg.c +23 -14
index e531b65..59872d7 100644
@@ -12,6 +12,7 @@
 
 #include "dlm_daemon.h"
 #include "config.h"
+#include "libfenced.h"
 
 uint32_t cpgname_to_crc(const char *data, int len);
 
@@ -36,7 +37,7 @@ struct node {
 	int check_quorum;
 	int check_fs;
 	int fs_notify;
-	struct timeval add_time;
+	uint64_t add_time;
 };
 
 /* One of these change structs is created for every confchg a cpg gets. */
@@ -302,7 +303,7 @@ static void node_history_init(struct lockspace *ls, int nodeid)
 	memset(node, 0, sizeof(struct node));
 
 	node->nodeid = nodeid;
-	timerclear(&node->add_time);
+	node->add_time = 0;
 	list_add_tail(&node->list, &ls->node_history);
 }
 
@@ -316,7 +317,7 @@ static void node_history_start(struct lockspace *ls, int nodeid)
 		return;
 	}
 
-	gettimeofday(&node->add_time, NULL);
+	node->add_time = time(NULL);
 }
 
 static void node_history_left(struct lockspace *ls, int nodeid)
@@ -329,7 +330,7 @@ static void node_history_left(struct lockspace *ls, int nodeid)
 		return;
 	}
 
-	timerclear(&node->add_time);
+	node->add_time = 0;
 }
 
 static void node_history_fail(struct lockspace *ls, int nodeid)
@@ -342,7 +343,7 @@ static void node_history_fail(struct lockspace *ls, int nodeid)
 		return;
 	}
 
-	if (!timerisset(&node->add_time))
+	if (!node->add_time)
 		node->check_fencing = 1;
 
 	node->check_quorum = 1;
@@ -352,8 +353,10 @@ static void node_history_fail(struct lockspace *ls, int nodeid)
 static int check_fencing_done(struct lockspace *ls)
 {
 	struct node *node;
-	struct timeval last_fenced;
+	struct fenced_node nodeinfo;
+	struct fenced_domain domain;
 	int wait_count = 0;
+	int rv;
 
 	list_for_each_entry(node, &ls->node_history, list) {
 		if (!node->check_fencing)
@@ -362,12 +365,15 @@ static int check_fencing_done(struct lockspace *ls)
 		/* check with fenced to see if the node has been
 		   fenced since node->add_time */
 
-		/* fenced_last_success(node->nodeid, &last_fenced); */
-		gettimeofday(&last_fenced, NULL);
+		memset(&nodeinfo, 0, sizeof(nodeinfo));
+
+		rv = fenced_node_info(node->nodeid, &nodeinfo);
+		if (rv < 0)
+			log_error("fenced_node_info error %d", rv);
 
-		if (timercmp(&last_fenced, &node->add_time, >)) {
+		if (nodeinfo.last_fenced_time > node->add_time) {
 			node->check_fencing = 0;
-			timerclear(&node->add_time);
+			node->add_time = 0;
 		} else {
 			log_group(ls, "check_fencing %d needs fencing",
 				  node->nodeid);
@@ -382,11 +388,14 @@ static int check_fencing_done(struct lockspace *ls)
 	   we may not have seen in any lockspace), and return 0 if there
 	   are any */
 
-	/*
-	fenced_pending_count(&pending);
-	if (pending)
+	rv = fenced_domain_info(&domain);
+	if (rv < 0) {
+		log_error("fenced_domain_info error %d", rv);
+		return 0;
+	}
+
+	if (domain.victim_count)
 		return 0;
-	*/
 	return 1;
 }
 

hooks/post-receive
--
Cluster Project