[PATCH 09/10] quorum: integrate votequorum and ykd correctly

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

 



From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx>

the problem is mostly in votequorum here, where votequorum_exec is
initialized with or without votequorum being configured as quorum
provider.

re-establish init order (regression from dropping lcrso) and make
sure we init correctly only the module configured.

ykd changes are for consistency only at this point in time.

Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx>
---
:100644 100644 9306a75... 0f4f05a... M	exec/votequorum.c
:100644 100644 901d3aa... 282ba7f... M	exec/vsf_ykd.c
 exec/votequorum.c |   24 +++++++++++++-----------
 exec/vsf_ykd.c    |   10 +++++++++-
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/exec/votequorum.c b/exec/votequorum.c
index 9306a75..0f4f05a 100644
--- a/exec/votequorum.c
+++ b/exec/votequorum.c
@@ -58,6 +58,7 @@ LOGSYS_DECLARE_SUBSYS ("VOTEQ");
  */
 
 static struct corosync_api_v1 *corosync_api;
+static int votequorum_configured = 0;
 
 /*
  * votequorum global config vars
@@ -221,8 +222,6 @@ static quorum_set_quorate_fn_t quorum_callback;
  * votequorum_exec handler and definitions
  */
 
-static int votequorum_exec_init_fn (struct corosync_api_v1 *api);
-
 static void message_handler_req_exec_votequorum_nodeinfo (
 	const void *message,
 	unsigned int nodeid);
@@ -329,7 +328,6 @@ static struct corosync_service_engine votequorum_service_engine = {
 	.lib_exit_fn			= quorum_lib_exit_fn,
 	.lib_engine			= quorum_lib_service,
 	.lib_engine_count		= sizeof (quorum_lib_service) / sizeof (struct corosync_lib_handler),
-	.exec_init_fn			= votequorum_exec_init_fn,
 	.exec_engine			= votequorum_exec_engine,
 	.exec_engine_count		= sizeof (votequorum_exec_engine) / sizeof (struct corosync_exec_handler),
 	.confchg_fn			= votequorum_confchg_fn,
@@ -1068,13 +1066,6 @@ static int votequorum_exec_init_fn (struct corosync_api_v1 *api)
 
 	ENTER();
 
-	corosync_api = api;
-
-	if (!api) {
-		LEAVE();
-		return (1);
-	}
-
 	list_init(&cluster_members_list);
 	list_init(&trackers_list);
 
@@ -1140,6 +1131,11 @@ static void votequorum_confchg_fn (
 
 	ENTER();
 
+	if (votequorum_configured == 0) {
+		LEAVE();
+		return;
+	}
+
 	if (member_list_entries > 1) {
 		first_trans = 0;
 	}
@@ -1205,11 +1201,17 @@ cs_error_t votequorum_init(struct corosync_api_v1 *api,
 	}
 
 	corosync_api = api;
-
 	quorum_callback = q_set_quorate_fn;
 
 	votequorum_readconfig_static();
 
+	if (votequorum_exec_init_fn(api) != 0) {
+		LEAVE();
+		return CS_ERR_NO_MEMORY;
+	}
+
+	votequorum_configured = 1;
+
 	LEAVE();
 
 	return CS_OK;
diff --git a/exec/vsf_ykd.c b/exec/vsf_ykd.c
index 901d3aa..282ba7f 100644
--- a/exec/vsf_ykd.c
+++ b/exec/vsf_ykd.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2005 MontaVista Software, Inc.
- * Copyright (c) 2006-2009 Red Hat, Inc.
+ * Copyright (c) 2006-2009, 2012 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -146,6 +146,8 @@ hdb_handle_t schedwrk_state_send_callback_handle;
 
 static struct corosync_api_v1 *api;
 
+static int ykd_configured = 0;
+
 static void (*ykd_primary_callback_fn) (
 	const unsigned int *view_list,
 	size_t view_list_entries,
@@ -463,6 +465,10 @@ static void ykd_confchg_fn (
 {
 	int i;
 
+	if (ykd_configured == 0) {
+		return;
+	}
+
 	if (configuration_type != TOTEM_CONFIGURATION_REGULAR) {
 		return;
 	}
@@ -519,6 +525,8 @@ cs_error_t ykd_init (
 		return CS_ERR_INVALID_PARAM;
 	}
 
+	ykd_configured = 1;
+
 	api->tpg_init (
 		&ykd_group_handle,
 		ykd_deliver_fn,
-- 
1.7.7.5

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux