This backports patch 1379 from trunk for the upcoming new IPC changes to
both whitetank and trunk.

Regards
-steve
Index: exec/cfg.c
===================================================================
--- exec/cfg.c	(revision 1489)
+++ exec/cfg.c	(working copy)
@@ -298,7 +298,7 @@
 	res_lib_cfg_ringstatusget.header.error = SA_AIS_OK;
 
 	totempg_ifaces_get (
-		this_ip->nodeid,
+		totempg_my_nodeid_get(),
 		interfaces,
 		&status,
 		&iface_count);
Index: exec/evs.c
===================================================================
--- exec/evs.c	(revision 1489)
+++ exec/evs.c	(working copy)
@@ -454,7 +454,7 @@
 	res_lib_evs_membership_get.header.size = sizeof (struct res_lib_evs_membership_get);
 	res_lib_evs_membership_get.header.id = MESSAGE_RES_EVS_MEMBERSHIP_GET;
 	res_lib_evs_membership_get.header.error = EVS_OK;
-	res_lib_evs_membership_get.local_nodeid = this_ip->nodeid;
+	res_lib_evs_membership_get.local_nodeid = totempg_my_nodeid_get ();
 	memcpy (&res_lib_evs_membership_get.member_list,
 		&res_evs_confchg_callback.member_list,
 		sizeof (res_lib_evs_membership_get.member_list));
Index: exec/cpg.c
===================================================================
--- exec/cpg.c	(revision 1489)
+++ exec/cpg.c	(working copy)
@@ -481,7 +481,7 @@
 
 	if (gi) {
 		notify_info.pid = pi->pid;
-		notify_info.nodeid = this_ip->nodeid;
+		notify_info.nodeid = totempg_my_nodeid_get();
 		notify_info.reason = CONFCHG_CPG_REASON_PROCDOWN;
 		cpg_node_joinleave_send(gi, pi, MESSAGE_REQ_EXEC_CPG_PROCLEAVE, CONFCHG_CPG_REASON_PROCDOWN);
 		list_del(&pi->list);
@@ -627,8 +627,8 @@
 				lowest_nodeid = member_list[i];
 		}
 
-		log_printf(LOG_LEVEL_DEBUG, "confchg, low nodeid=%d, us = %d\n", lowest_nodeid, this_ip->nodeid);
-		if (lowest_nodeid == this_ip->nodeid) {
+		log_printf(LOG_LEVEL_DEBUG, "confchg, low nodeid=%d, us = %d\n", lowest_nodeid, totempg_my_nodeid_get());
+		if (lowest_nodeid == totempg_my_nodeid_get()) {
 
 			req_exec_cpg_downlist.header.id = SERVICE_ID_MAKE(CPG_SERVICE, MESSAGE_REQ_EXEC_CPG_DOWNLIST);
 			req_exec_cpg_downlist.header.size = sizeof(struct req_exec_cpg_downlist);
@@ -729,7 +729,7 @@
 		if (pi->pid == pid && pi->nodeid == nodeid) {
 
 			/* It could be a local join message */
-			if ((nodeid == this_ip->nodeid) &&
+			if ((nodeid == totempg_my_nodeid_get()) &&
 				(!pi->flags & PI_FLAG_MEMBER)) {
 				goto local_join;
 			} else {
@@ -864,7 +864,7 @@
 		nodeid);
 
 	/* Ignore our own messages */
-	if (nodeid == this_ip->nodeid) {
+	if (nodeid == totempg_my_nodeid_get()) {
 		return;
 	}
 
@@ -943,7 +943,7 @@
 			gi = list_entry(iter, struct group_info, list);
 			for (iter2 = gi->members.next; iter2 != &gi->members; iter2 = iter2->next) {
 				struct process_info *pi = list_entry(iter2, struct process_info, list);
-				if (pi->pid && pi->nodeid == this_ip->nodeid) {
+				if (pi->pid && pi->nodeid == totempg_my_nodeid_get()) {
 					count++;
 				}
 			}
@@ -970,7 +970,7 @@
 			for (iter2 = gi->members.next; iter2 != &gi->members; iter2 = iter2->next) {
 
 				struct process_info *pi = list_entry(iter2, struct process_info, list);
-				if (pi->pid && pi->nodeid == this_ip->nodeid) {
+				if (pi->pid && pi->nodeid == totempg_my_nodeid_get()) {
 					memcpy(&jle->group_name, &gi->group_name, sizeof(mar_cpg_name_t));
 					jle->pid = pi->pid;
 					jle++;
@@ -1029,7 +1029,7 @@
 		pi);
 
 	/* Add a node entry for us */
-	pi->nodeid = this_ip->nodeid;
+	pi->nodeid = totempg_my_nodeid_get();
 	pi->pid = req_lib_cpg_join->pid;
 	pi->group = gi;
 	list_add(&pi->list, &gi->members);
@@ -1213,7 +1213,7 @@
 	res_lib_cpg_local_get.header.size = sizeof(res_lib_cpg_local_get);
 	res_lib_cpg_local_get.header.id = MESSAGE_RES_CPG_LOCAL_GET;
 	res_lib_cpg_local_get.header.error = SA_AIS_OK;
-	res_lib_cpg_local_get.local_nodeid = this_ip->nodeid;
+	res_lib_cpg_local_get.local_nodeid = totempg_my_nodeid_get();
 
 	openais_conn_send_response(conn, &res_lib_cpg_local_get,
 		sizeof(res_lib_cpg_local_get));
Index: exec/clm.c
===================================================================
--- exec/clm.c	(revision 1489)
+++ exec/clm.c	(working copy)
@@ -262,24 +262,29 @@
 	mar_clm_cluster_node_t cluster_node __attribute__((aligned(8)));
 };
 
-static int clm_exec_init_fn (struct objdb_iface_ver0 *objdb)
+static void my_cluster_node_load (void)
 {
-	log_init ("CLM");
+	struct totem_ip_address interfaces[INTERFACE_MAX];
+	unsigned int iface_count;
+	char **status;
+	const char *iface_string;
 
-	memset (cluster_node_entries, 0,
-		sizeof (mar_clm_cluster_node_t) * PROCESSOR_COUNT_MAX);
+	totempg_ifaces_get (
+		totempg_my_nodeid_get (),
+		interfaces,
+		&status,
+		&iface_count);
 
-	/*
-	 * Build local cluster node data structure
-	 */
+	iface_string = totemip_print (&interfaces[0]);
+
 	sprintf ((char *)my_cluster_node.node_address.value, "%s",
-		totemip_print (this_ip));
+		iface_string);
 	my_cluster_node.node_address.length =
 		strlen ((char *)my_cluster_node.node_address.value);
-	if (this_ip->family == AF_INET) {
+	if (totempg_my_family_get () == AF_INET) {
 		my_cluster_node.node_address.family = SA_CLM_AF_INET;
 	} else
-	if (this_ip->family == AF_INET6) {
+	if (totempg_my_family_get () == AF_INET6) {
 		my_cluster_node.node_address.family = SA_CLM_AF_INET6;
 	} else {
 		assert (0);
@@ -289,8 +294,20 @@
 		(char *)my_cluster_node.node_address.value);
 	my_cluster_node.node_name.length =
 		my_cluster_node.node_address.length;
-	my_cluster_node.node_id = this_ip->nodeid;
+	my_cluster_node.node_id = totempg_my_nodeid_get ();
 	my_cluster_node.member = 1;
+
+	memcpy (&cluster_node_entries[0], &my_cluster_node,
+		sizeof (mar_clm_cluster_node_t));
+}
+
+static int clm_exec_init_fn (struct objdb_iface_ver0 *objdb)
+{
+	log_init ("CLM");
+
+	memset (cluster_node_entries, 0,
+		sizeof (mar_clm_cluster_node_t) * PROCESSOR_COUNT_MAX);
+
 	{
 #if defined(OPENAIS_LINUX)
 		struct sysinfo s_info;
@@ -313,7 +330,6 @@
 #endif
 	}
 
-	memcpy (&cluster_node_entries[0], &my_cluster_node, sizeof (mar_clm_cluster_node_t));
 	cluster_node_count = 1;
 
 	main_clm_get_by_nodeid = clm_get_by_nodeid;
@@ -519,20 +535,7 @@
 	 * Load the my_cluster_node data structure in case we are
 	 * transitioning to network interface up or down
 	 */
-	sprintf ((char *)my_cluster_node.node_address.value, "%s", totemip_print (this_ip));
-	my_cluster_node.node_address.length = strlen ((char *)my_cluster_node.node_address.value);
-	if (this_ip->family == AF_INET) {
-	my_cluster_node.node_address.family = SA_CLM_AF_INET;
-	} else
-	if (this_ip->family == AF_INET6) {
-	my_cluster_node.node_address.family = SA_CLM_AF_INET6;
-	} else {
-		assert (0);
-	}
-	strcpy ((char *)my_cluster_node.node_name.value,
-		(char *)my_cluster_node.node_address.value);
-	my_cluster_node.node_name.length = my_cluster_node.node_address.length;
-	my_cluster_node.node_id = this_ip->nodeid;
+	my_cluster_node_load ();
 }
 
 /*
Index: exec/ipc.c
===================================================================
--- exec/ipc.c	(revision 1489)
+++ exec/ipc.c	(working copy)
@@ -94,8 +94,6 @@
 
 static unsigned int g_gid_valid = 0;
 
-static struct totem_ip_address *my_ip;
-
 static totempg_groups_handle ipc_handle;
 
 DECLARE_LIST_INIT (conn_info_list_head);
@@ -962,7 +960,7 @@
 	int ret = 0;
 
 	assert (source != NULL);
-	if (source->nodeid == my_ip->nodeid) {
+	if (source->nodeid == totempg_my_nodeid_get ()) {
 		ret = 1;
 	}
 	return ret;
@@ -974,7 +972,7 @@
 {
 	assert ((source != NULL) && (conn != NULL));
 	memset (source, 0, sizeof (mar_message_source_t));
-	source->nodeid = my_ip->nodeid;
+	source->nodeid = totempg_my_nodeid_get ();
 	source->conn = conn;
 }
 
@@ -990,8 +988,7 @@
 void openais_ipc_init (
 	void (*serialize_lock_fn) (void),
 	void (*serialize_unlock_fn) (void),
-	unsigned int gid_valid,
-	struct totem_ip_address *my_ip_in)
+	unsigned int gid_valid)
 {
 	int libais_server_fd;
 	struct sockaddr_un un_addr;
@@ -1048,8 +1045,6 @@
 
 	g_gid_valid = gid_valid;
 
-	my_ip = my_ip_in;
-
 	/*
 	 * Reset internal state of flow control when
 	 * configuration change occurs
Index: exec/totempg.c
===================================================================
--- exec/totempg.c	(revision 1489)
+++ exec/totempg.c	(working copy)
@@ -1243,3 +1243,12 @@
 	return (iface_string);
 }
 
+int totempg_my_nodeid_get (void)
+{
+	return (totemmrp_my_nodeid_get());
+}
+
+int totempg_my_family_get (void)
+{
+	return (totemmrp_my_family_get());
+}
Index: exec/ipc.h
===================================================================
--- exec/ipc.h	(revision 1489)
+++ exec/ipc.h	(working copy)
@@ -51,8 +51,7 @@
 extern void openais_ipc_init (
         void (*serialize_lock_fn) (void),
         void (*serialize_unlock_fn) (void),
-	unsigned int gid_valid,
-	struct totem_ip_address *non_loopback_ip);
+	unsigned int gid_valid);
 
 extern int openais_ipc_timer_add (
 	void *conn,
Index: exec/totempg.h
===================================================================
--- exec/totempg.h	(revision 1489)
+++ exec/totempg.h	(working copy)
@@ -137,8 +137,12 @@
 	char ***status,
         unsigned int *iface_count);
 
+extern char *totempg_ifaces_print (unsigned int nodeid);
+
+extern int totempg_my_nodeid_get (void);
+
+extern int totempg_my_family_get (void);
+
 extern int totempg_ring_reenable (void);
 	
-extern char *totempg_ifaces_print (unsigned int nodeid);
-
 #endif /* TOTEMPG_H_DEFINED */
Index: exec/ckpt.c
===================================================================
--- exec/ckpt.c	(revision 1489)
+++ exec/ckpt.c	(working copy)
@@ -3572,7 +3572,7 @@
 
 	switch (my_sync_state) {
 	case SYNC_STATE_CHECKPOINT:
-		if (my_lowest_nodeid == this_ip->nodeid) {
+		if (my_lowest_nodeid == totempg_my_nodeid_get()) {
 			TRACE1 ("should transmit checkpoints because lowest member in old configuration.\n");
 			res = sync_checkpoints_iterate ();
 
@@ -3592,7 +3592,7 @@
 
 	case SYNC_STATE_REFCOUNT:
 		done_queueing = 1;
-		if (my_lowest_nodeid == this_ip->nodeid) {
+		if (my_lowest_nodeid == totempg_my_nodeid_get()) {
 			TRACE1 ("transmit refcounts because this processor is the lowest member in old configuration.\n");
 			res = sync_refcounts_iterate ();
 		}
Index: exec/vsf_ykd.c
===================================================================
--- exec/vsf_ykd.c	(revision 1489)
+++ exec/vsf_ykd.c	(working copy)
@@ -458,7 +458,7 @@
 	memcpy (&ykd_ring_id, ring_id, sizeof (struct memb_ring_id));
 
 	if (first_run) {
-		ykd_state.last_primary.member_list[0] = this_ip->nodeid;
+		ykd_state.last_primary.member_list[0] = totempg_my_nodeid_get();
 		ykd_state.last_primary.member_list_entries = 1;
 		ykd_state.last_primary.session_id = 0;
 		first_run = 0;
Index: exec/totemmrp.c
===================================================================
--- exec/totemmrp.c	(revision 1489)
+++ exec/totemmrp.c	(working copy)
@@ -191,6 +191,16 @@
 	return (res);
 }
 
+int totemmrp_my_nodeid_get (void)
+{
+	return (totemsrp_my_nodeid_get (totemsrp_handle_in));
+}
+
+int totemmrp_my_family_get (void)
+{
+	return (totemsrp_my_family_get (totemsrp_handle_in));
+}
+
 extern int totemmrp_ring_reenable (void)
 {
 	int res;
Index: exec/lck.c
===================================================================
--- exec/lck.c	(revision 1489)
+++ exec/lck.c	(working copy)
@@ -1185,7 +1185,7 @@
 				req_exec_lck_resourceunlock->invocation;
 
 			openais_conn_send_response (
-				req_exec_lck_resourceunlock->source.conn,
+				openais_conn_partner_get(req_exec_lck_resourceunlock->source.conn),
 				&res_lib_lck_resourceunlockasync,
 				sizeof (struct res_lib_lck_resourceunlockasync));
 			openais_conn_send_response (
Index: exec/totemmrp.h
===================================================================
--- exec/totemmrp.h	(revision 1489)
+++ exec/totemmrp.h	(working copy)
@@ -105,6 +105,10 @@
 	char ***status,
 	unsigned int *iface_count);
 
+extern int totemmrp_my_nodeid_get (void);
+
+extern int totemmrp_my_family_get (void);
+
 extern int totemmrp_ring_reenable (void);
 
 #endif /* TOTEMMRP_H_DEFINED */
Index: exec/totemsrp.c
===================================================================
--- exec/totemsrp.c	(revision 1489)
+++ exec/totemsrp.c	(working copy)
@@ -907,6 +907,43 @@
 	return (res);
 }
 
+int totemsrp_my_nodeid_get (
+	totemsrp_handle handle)
+{
+	struct totemsrp_instance *instance;
+	int res;
+
+	res = hdb_handle_get (&totemsrp_instance_database, handle,
+		(void *)&instance);
+	if (res != 0) {
+		return (0);
+	}
+
+	res = instance->totem_config->interfaces[0].boundto.nodeid;
+
+	hdb_handle_put (&totemsrp_instance_database, handle);
+	return (res);
+}
+
+int totemsrp_my_family_get (
+	totemsrp_handle handle)
+{
+	struct totemsrp_instance *instance;
+	int res;
+
+	res = hdb_handle_get (&totemsrp_instance_database, handle,
+		(void *)&instance);
+	if (res != 0) {
+		return (0);
+	}
+
+	res = instance->totem_config->interfaces[0].boundto.family;
+
+	hdb_handle_put (&totemsrp_instance_database, handle);
+	return (res);
+}
+
+
 int totemsrp_ring_reenable (
         totemsrp_handle handle)
 {
Index: exec/totemsrp.h
===================================================================
--- exec/totemsrp.h	(revision 1489)
+++ exec/totemsrp.h	(working copy)
@@ -104,6 +104,12 @@
 	char ***status,
 	unsigned int *iface_count);
 
+extern int totemsrp_my_nodeid_get (
+	totemsrp_handle handle);
+
+extern int totemsrp_my_family_get (
+	totemsrp_handle handle);
+
 extern int totemsrp_ring_reenable (
 	totemsrp_handle handle);
 
Index: exec/main.c
===================================================================
--- exec/main.c	(revision 1489)
+++ exec/main.c	(working copy)
@@ -120,8 +120,6 @@
 }
 
 
-struct totem_ip_address *this_ip;
-struct totem_ip_address this_non_loopback_ip;
 #define LOCALHOST_IP inet_addr("127.0.0.1")
 
 totempg_groups_handle openais_group_handle;
@@ -214,10 +212,6 @@
 
 	memcpy (&aisexec_ring_id, ring_id, sizeof (struct memb_ring_id));
 
-	if (!totemip_localhost_check(this_ip)) {
-		totemip_copy(&this_non_loopback_ip, this_ip);
-	}
-
 	/*
 	 * Call configuration change for all services
 	 */
@@ -413,10 +407,6 @@
 	log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2002-2006 MontaVista Software, Inc and contributors.\n");
 	log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2006 Red Hat, Inc.\n");
 
-	memset(&this_non_loopback_ip, 0, sizeof(struct totem_ip_address));
-
-	totemip_localhost(AF_INET, &this_non_loopback_ip);
-
 	signal (SIGINT, sigintr_handler);
 	signal (SIGUSR2, sigusr2_handler);
 	signal (SIGSEGV, sigsegv_handler);
@@ -562,8 +552,6 @@
 	/*
 	 * This must occur after totempg is initialized because "this_ip" must be set
 	 */
-	this_ip = &totem_config.interfaces[0].boundto;
-
 	res = openais_service_init_all (service_count, objdb);
 	if (res == -1) {
 		log_printf (LOG_LEVEL_ERROR, "Could not init services\n");
@@ -591,8 +579,7 @@
 	openais_ipc_init (
 		serialize_mutex_lock,
 		serialize_mutex_unlock,
-		gid_valid,
-		&this_non_loopback_ip);
+		gid_valid);
 
 	/*
 	 * Start main processing loop
Index: exec/msg.c
===================================================================
--- exec/msg.c	(revision 1489)
+++ exec/msg.c	(working copy)
@@ -675,9 +675,6 @@
 	/*
 	 *  Initialize the saved ring ID.
 	 */
-//	saved_ring_id.seq = 0;
-//	saved_ring_id.rep.s_addr = this_ip->sin_addr.s_addr;		
-	
 	return (0);
 }
 
Index: exec/main.h
===================================================================
--- exec/main.h	(revision 1489)
+++ exec/main.h	(working copy)
@@ -53,8 +53,6 @@
 
 #define SIZEINB MESSAGE_SIZE_MAX
 
-extern struct totem_ip_address *this_ip;
-
 extern struct totempg_group openais_group;
 
 extern totempg_groups_handle openais_group_handle;
_______________________________________________
Openais mailing list
Openais@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to