Hi,

I noticed a quirk with CLM where it sometimes passes a client application a
CLM node-ID of zero in saClmClusterTrackCallback. The problem seems to be a
timing issue at startup.

The situation is a client application is registering with the CLM service at
the same time corosync is starting up and loading the service. The client is
calling saClmClusterTrack() with the SA_TRACK_CURRENT flag, so it will get a
saClmClusterTrackCallback callback as soon as it registers.

However, it looks like the local node-ID (cluster_node_entries[0]) is zero
until the clm_service_engine[] clm_confchg_fn() callback is first called.
cluster_node_count gets initialized to '1' earlier in clm_exec_init_fn(). So
there is a brief window at startup when a client can connect where:

cluster_node_count = 1
cluster_node_entries[0] = 0

The attached patch avoids the problem by initializing cluster_node_count
slightly later, although it's not a particularly elegant solution.

We're using openais 1.1.2 and corosync 1.2.0, although I couldn't see anything
about something like this being fixed in the later releases.

BTW, 'Accessing Sources' on the OpenAIS webpage still talks about using
subversion - should this be updated to GIT now?
http://openais.org/doku.php?id=developers

Regards,
Tim
diff --git a/services/clm.c b/services/clm.c
index 06ea7e8..bc6a765 100644
--- a/services/clm.c
+++ b/services/clm.c
@@ -390,8 +390,6 @@ static int clm_exec_init_fn (struct corosync_api_v1 *corosync_api)
 #endif
 	}
 
-	cluster_node_count = 1;
-
 	return (0);
 }
 
@@ -569,6 +567,12 @@ static void clm_confchg_fn (
 	int i;
 	unsigned int node_ids[PROCESSOR_COUNT_MAX];
 
+	/* If this is the first config-change event, the local node's ID won't have
+	 * been initialised yet. Update node-count to now include the local node */
+	if (cluster_node_count == 0) {
+		cluster_node_count = 1;
+	}
+
 	view_current = ring_id->seq / 4;
 	if (view_initial == 0) {
 		view_initial = ring_id->seq / 4;
_______________________________________________
Openais mailing list
Openais@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to