[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] Cluster Project branch, master, updated. gfs-kernel_0_1_22-217-gfacac9f



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=facac9f9b1d9575c383e94e10870a71972cdc11a

The branch, master has been updated
       via  facac9f9b1d9575c383e94e10870a71972cdc11a (commit)
      from  d4696e2a5c137c58a6c58a87747ce423b133d7b1 (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 facac9f9b1d9575c383e94e10870a71972cdc11a
Author: David Teigland <teigland redhat com>
Date:   Fri Apr 25 16:19:08 2008 -0500

    fenced: allow queries during fencing; group queries
    
    Put mutex unlock/lock around fencing steps that take a while so that the
    query thread won't be blocked.  Fill in query info for libgroup mode.
    
    Signed-off-by: David Teigland <teigland redhat com>

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

Summary of changes:
 fence/fenced/cpg.c     |   12 ------------
 fence/fenced/fd.h      |    3 +++
 fence/fenced/group.c   |   29 ++++++++++++++++++++++++++++-
 fence/fenced/main.c    |   10 ++++++++++
 fence/fenced/recover.c |   19 +++++++++++++++++++
 5 files changed, 60 insertions(+), 13 deletions(-)

diff --git a/fence/fenced/cpg.c b/fence/fenced/cpg.c
index 9d1a143..430c21e 100644
--- a/fence/fenced/cpg.c
+++ b/fence/fenced/cpg.c
@@ -999,17 +999,6 @@ static int add_change(struct fd *fd,
 	return error;
 }
 
-static int is_victim(struct fd *fd, int nodeid)
-{
-	struct node *node;
-
-	list_for_each_entry(node, &fd->victims, list) {
-		if (node->nodeid == nodeid)
-			return 1;
-	}
-	return 0;
-}
-
 /* add a victim for each node in complete list (represents all nodes in
    cluster.conf) that is not a cman member (and not already a victim) */
 
@@ -1311,7 +1300,6 @@ int set_domain_members(struct fd *fd, int *member_count,
 
 	*member_count = cg->member_count;
 	*members = nodes;
-
 	return 0;
 }
 
diff --git a/fence/fenced/fd.h b/fence/fenced/fd.h
index 413d75c..b111736 100644
--- a/fence/fenced/fd.h
+++ b/fence/fenced/fd.h
@@ -261,6 +261,8 @@ void client_dead(int ci);
 int client_add(int fd, void (*workfn)(int ci), void (*deadfn)(int ci));
 void free_fd(struct fd *fd);
 struct fd *find_fd(char *name);
+void query_lock(void);
+void query_unlock(void);
 
 /* member_cman.c */
 
@@ -276,6 +278,7 @@ struct node *get_new_node(struct fd *fd, int nodeid);
 void free_node_list(struct list_head *head);
 void add_complete_node(struct fd *fd, int nodeid);
 int list_count(struct list_head *head);
+int is_victim(struct fd *fd, int nodeid);
 void delay_fencing(struct fd *fd, int node_join);
 void defer_fencing(struct fd *fd);
 void fence_victims(struct fd *fd);
diff --git a/fence/fenced/group.c b/fence/fenced/group.c
index 01db901..22b6bd0 100644
--- a/fence/fenced/group.c
+++ b/fence/fenced/group.c
@@ -411,19 +411,46 @@ int fd_leave_group(struct fd *fd)
 	return rv;
 }
 
-int set_node_info_group(struct fd *fd, int nodeid, struct fenced_node *node)
+int set_node_info_group(struct fd *fd, int nodeid, struct fenced_node *nodeinfo)
 {
+	nodeinfo->nodeid = nodeid;
+	nodeinfo->victim = is_victim(fd, nodeid);
+	nodeinfo->member = id_in_nodeids(nodeid, cb_member_count, cb_members);
+
+	/* FIXME: need to keep track of last fence info for nodes */
+
 	return 0;
 }
 
 int set_domain_info_group(struct fd *fd, struct fenced_domain *domain)
 {
+	domain->master_nodeid = fd->master;
+	domain->victim_count = list_count(&fd->victims);
+	domain->member_count = cb_member_count;
+	domain->state = cb_action;
 	return 0;
 }
 
 int set_domain_members_group(struct fd *fd, int *member_count,
 			     struct fenced_node **members)
 {
+	struct fenced_node *nodes = NULL, *nodep;
+	int i;
+
+	if (!cb_member_count)
+		goto out;
+
+	nodes = malloc(cb_member_count * sizeof(struct fenced_node));
+	if (!nodes)
+		return -ENOMEM;
+
+	nodep = nodes;
+	for (i = 0; i < cb_member_count; i++) {
+		set_node_info(fd, cb_members[i], nodep++);
+	}
+ out:
+	*member_count = cb_member_count;
+	*members = nodes;
 	return 0;
 }
 
diff --git a/fence/fenced/main.c b/fence/fenced/main.c
index 9d10716..1cc46ef 100644
--- a/fence/fenced/main.c
+++ b/fence/fenced/main.c
@@ -508,6 +508,16 @@ static int setup_listener(char *sock_path)
 	return s;
 }
 
+void query_lock(void)
+{
+	pthread_mutex_lock(&query_mutex);
+}
+
+void query_unlock(void)
+{
+	pthread_mutex_unlock(&query_mutex);
+}
+
 /* This is a thread, so we have to be careful, don't call log_ functions.
    We need a thread to process queries because the main thread will block
    for long periods when running fence agents. */
diff --git a/fence/fenced/recover.c b/fence/fenced/recover.c
index 4774b5a..11a01bb 100644
--- a/fence/fenced/recover.c
+++ b/fence/fenced/recover.c
@@ -42,6 +42,17 @@ int list_count(struct list_head *head)
 	return count;
 }
 
+int is_victim(struct fd *fd, int nodeid)
+{
+	struct node *node;
+
+	list_for_each_entry(node, &fd->victims, list) {
+		if (node->nodeid == nodeid)
+			return 1;
+	}
+	return 0;
+}
+
 static void victim_done(struct fd *fd, int victim, int how)
 {
 	if (group_mode == GROUP_LIBGROUP)
@@ -179,6 +190,7 @@ void delay_fencing(struct fd *fd, int node_join)
 	gettimeofday(&first, NULL);
 	gettimeofday(&start, NULL);
 
+	query_unlock();
 	for (;;) {
 		sleep(1);
 
@@ -205,6 +217,7 @@ void delay_fencing(struct fd *fd, int node_join)
 		if (now.tv_sec - start.tv_sec >= delay)
 			break;
 	}
+	query_lock();
 
 	gettimeofday(&last, NULL);
 
@@ -260,7 +273,9 @@ void fence_victims(struct fd *fd)
 		log_debug("fencing node %s", node->name);
 		syslog(LOG_INFO, "fencing node \"%s\"", node->name);
 
+		query_unlock();
 		error = fence_node(node->name);
+		query_lock();
 
 		syslog(LOG_INFO, "fence \"%s\" %s", node->name,
 		       error ? "failed" : "success");
@@ -273,10 +288,13 @@ void fence_victims(struct fd *fd)
 		}
 
 		if (!comline.override_path) {
+			query_unlock();
 			sleep(5);
+			query_lock();
 			continue;
 		}
 
+		query_unlock();
 		/* Check for manual intervention */
 		override = open_override(comline.override_path);
 		if (check_override(override, node->name,
@@ -288,6 +306,7 @@ void fence_victims(struct fd *fd)
 			free(node);
 		}
 		close_override(&override, comline.override_path);
+		query_lock();
 	}
 }
 


hooks/post-receive
--
Cluster Project


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]