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

[Cluster-devel] cluster/group/daemon cman.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland sourceware org	2007-08-22 13:58:19

Modified files:
	group/daemon   : cman.c 

Log message:
	use an admin handle from cman to call set_dirty

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/cman.c.diff?cvsroot=cluster&r1=1.31&r2=1.32

--- cluster/group/daemon/cman.c	2007/08/21 19:33:55	1.31
+++ cluster/group/daemon/cman.c	2007/08/22 13:58:19	1.32
@@ -5,6 +5,7 @@
 #include "gd_internal.h"
 
 static cman_handle_t	ch;
+static cman_handle_t	ch_admin;
 static int		old_quorate;
 static cman_node_t	old_nodes[MAX_NODES];
 static int		old_node_count;
@@ -15,30 +16,17 @@
 
 int kill_cman(int nodeid)
 {
-	cman_handle_t ach;
-	int rv;
-
-	ach = cman_admin_init(NULL);
-	if (!ach) {
-		log_print("cman_admin_init error %d %d", (int) ch, errno);
-		return -ENOTCONN;
-	}
-	rv = cman_kill_node(ach, nodeid);
-	cman_finish(ach);
-	return rv;
+	return cman_kill_node(ch_admin, nodeid);
 }
 
 int set_cman_dirty(void)
 {
 	int rv;
 
-#if 0
-	rv = cman_set_dirty(ch);
+	rv = cman_set_dirty(ch_admin);
 	if (rv)
 		log_print("cman_set_dirty error %d", rv);
 	return rv;
-#endif
-	return 0;
 }
 
 static int is_member(cman_node_t *node_list, int count, int nodeid)
@@ -154,20 +142,24 @@
 		return -ENOTCONN;
 	}
 
+	ch_admin = cman_admin_init(NULL);
+	if (!ch_admin) {
+		log_print("cman_admin_init error %d %d", (int) ch_admin, errno);
+		rv = -ENOTCONN;
+		goto fail1;
+	}
+
 	rv = cman_start_notification(ch, cman_callback);
 	if (rv < 0) {
 		log_print("cman_start_notification error %d %d", rv, errno);
-		cman_finish(ch);
-		return rv;
+		goto fail2;
 	}
 
 	memset(&node, 0, sizeof(node));
 	rv = cman_get_node(ch, CMAN_NODEID_US, &node);
 	if (rv < 0) {
 		log_print("cman_get_node us error %d %d", rv, errno);
-		cman_stop_notification(ch);
-		cman_finish(ch);
-		goto out;
+		goto fail3;
 	}
 
 	cman_node_count = 0;
@@ -175,7 +167,7 @@
 	rv = cman_get_nodes(ch, MAX_NODES, &cman_node_count, cman_nodes);
 	if (rv < 0) {
 		log_print("cman_get_nodes error %d %d", rv, errno);
-		goto out;
+		goto fail3;
 	}
 
 	cman_quorate = cman_is_quorate(ch);
@@ -189,9 +181,14 @@
 
 	fd = cman_get_fd(ch);
 	client_add(fd, process_cman, close_cman);
+	return 0;
 
-	rv = 0;
- out:
+ fail3:
+	cman_stop_notification(ch);
+ fail2:
+	cman_finish(ch_admin);
+ fail1:
+	cman_finish(ch);
 	return rv;
 }
 


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