[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
Branch: 	RHEL50
Changes by:	teigland sourceware org	2006-12-14 19:55:04

Modified files:
	group/daemon   : cman.c 

Log message:
	Switch from CMAN_DISPATCH_ONE loop to CMAN_DISPATCH_ALL to resolve
	delayed cman shutdown callbacks.
	bz 219385

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/cman.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.27.4.1&r2=1.27.4.2

--- cluster/group/daemon/cman.c	2006/12/01 20:27:36	1.27.4.1
+++ cluster/group/daemon/cman.c	2006/12/14 19:55:04	1.27.4.2
@@ -10,8 +10,6 @@
 static int		old_node_count;
 static cman_node_t	cman_nodes[MAX_NODES];
 static int		cman_node_count;
-static int		cman_cb;
-static int		cman_reason;
 static char		name_buf[CMAN_MAX_NODENAME_LEN+1];
 
 
@@ -106,26 +104,18 @@
 	}
 }
 
-static void process_cman_callback(void)
+static void cman_callback(cman_handle_t h, void *private, int reason, int arg)
 {
-	switch (cman_reason) {
+	switch (reason) {
+	case CMAN_REASON_TRY_SHUTDOWN:
+		cman_replyto_shutdown(ch, 1);
+		break;
 	case CMAN_REASON_STATECHANGE:
 		statechange();
 		break;
-	default:
-		break;
 	}
 }
 
-static void cman_callback(cman_handle_t h, void *private, int reason, int arg)
-{
-	cman_cb = 1;
-	cman_reason = reason;
-
-	if (reason == CMAN_REASON_TRY_SHUTDOWN)
-		cman_replyto_shutdown(ch, 1);
-}
-
 static void close_cman(int ci)
 {
 	log_debug("cluster is down, exiting");
@@ -135,19 +125,7 @@
 static void process_cman(int ci)
 {
 	int rv;
-
-	while (1) {
-		rv = cman_dispatch(ch, CMAN_DISPATCH_ONE);
-		if (rv < 0)
-			break;
-
-		if (cman_cb) {
-			cman_cb = 0;
-			process_cman_callback();
-		} else
-			break;
-	}
-
+	rv = cman_dispatch(ch, CMAN_DISPATCH_ALL);
 	if (rv == -1 && errno == EHOSTDOWN)
 		close_cman(ci);
 }


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