Blame SOURCES/bz1484264-1-totem-Propagate-totem-initialization-failure.patch

df4b1e
From 0413a8f4672352171f0df731b7d9c1fe20acbc4c Mon Sep 17 00:00:00 2001
df4b1e
From: Jan Friesse <jfriesse@redhat.com>
df4b1e
Date: Wed, 14 Jun 2017 16:27:37 +0200
df4b1e
Subject: [PATCH] totem: Propagate totem initialization failure
df4b1e
df4b1e
(backported from master 564b4bf7d4c5b3f632a48610761dce58e5809b3a)
df4b1e
df4b1e
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
df4b1e
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
df4b1e
---
df4b1e
 exec/main.c     |    8 ++++++--
df4b1e
 exec/totempg.c  |    5 +++++
df4b1e
 exec/totemrrp.c |    6 +++++-
df4b1e
 exec/totemsrp.c |    6 +++++-
df4b1e
 4 files changed, 21 insertions(+), 4 deletions(-)
df4b1e
df4b1e
diff --git a/exec/main.c b/exec/main.c
df4b1e
index 5f96c28..0d381c2 100644
df4b1e
--- a/exec/main.c
df4b1e
+++ b/exec/main.c
df4b1e
@@ -1355,9 +1355,13 @@ int main (int argc, char **argv, char **envp)
df4b1e
 	 * Join multicast group and setup delivery
df4b1e
 	 *  and configuration change functions
df4b1e
 	 */
df4b1e
-	totempg_initialize (
df4b1e
+	if (totempg_initialize (
df4b1e
 		corosync_poll_handle,
df4b1e
-		&totem_config);
df4b1e
+		&totem_config) != 0) {
df4b1e
+
df4b1e
+		log_printf (LOGSYS_LEVEL_ERROR, "Can't initialize TOTEM layer");
df4b1e
+		corosync_exit_error (COROSYNC_DONE_FATAL_ERR);
df4b1e
+	}
df4b1e
 
df4b1e
 	totempg_service_ready_register (
df4b1e
 		main_service_ready);
df4b1e
diff --git a/exec/totempg.c b/exec/totempg.c
df4b1e
index 05729be..5cef5e1 100644
df4b1e
--- a/exec/totempg.c
df4b1e
+++ b/exec/totempg.c
df4b1e
@@ -814,6 +814,10 @@ int totempg_initialize (
df4b1e
 		totempg_confchg_fn,
df4b1e
 		totempg_waiting_trans_ack_cb);
df4b1e
 
df4b1e
+	if (res == -1) {
df4b1e
+		goto error_exit;
df4b1e
+	}
df4b1e
+
df4b1e
 	totemmrp_callback_token_create (
df4b1e
 		&callback_token_received_handle,
df4b1e
 		TOTEM_CALLBACK_TOKEN_RECEIVED,
df4b1e
@@ -827,6 +831,7 @@ int totempg_initialize (
df4b1e
 
df4b1e
 	list_init (&totempg_groups_list);
df4b1e
 
df4b1e
+error_exit:
df4b1e
 	return (res);
df4b1e
 }
df4b1e
 
df4b1e
diff --git a/exec/totemrrp.c b/exec/totemrrp.c
df4b1e
index c6b97bc..f806feb 100644
df4b1e
--- a/exec/totemrrp.c
df4b1e
+++ b/exec/totemrrp.c
df4b1e
@@ -2150,7 +2150,7 @@ int totemrrp_initialize (
df4b1e
 		deliver_fn_context->iface_no = i;
df4b1e
 		instance->deliver_fn_context[i] = (void *)deliver_fn_context;
df4b1e
 
df4b1e
-		totemnet_initialize (
df4b1e
+		res = totemnet_initialize (
df4b1e
 			poll_handle,
df4b1e
 			&instance->net_handles[i],
df4b1e
 			totem_config,
df4b1e
@@ -2161,6 +2161,10 @@ int totemrrp_initialize (
df4b1e
 			rrp_iface_change_fn,
df4b1e
 			rrp_target_set_completed);
df4b1e
 
df4b1e
+		if (res == -1) {
df4b1e
+			goto error_destroy;
df4b1e
+		}
df4b1e
+
df4b1e
 		totemnet_net_mtu_adjust (instance->net_handles[i], totem_config);
df4b1e
 	}
df4b1e
 
df4b1e
diff --git a/exec/totemsrp.c b/exec/totemsrp.c
df4b1e
index f80f8e4..91c5423 100644
df4b1e
--- a/exec/totemsrp.c
df4b1e
+++ b/exec/totemsrp.c
df4b1e
@@ -851,6 +851,7 @@ int totemsrp_initialize (
df4b1e
 		int waiting_trans_ack))
df4b1e
 {
df4b1e
 	struct totemsrp_instance *instance;
df4b1e
+	int res;
df4b1e
 
df4b1e
 	instance = malloc (sizeof (struct totemsrp_instance));
df4b1e
 	if (instance == NULL) {
df4b1e
@@ -993,7 +994,7 @@ int totemsrp_initialize (
df4b1e
 		}
df4b1e
 	}
df4b1e
 
df4b1e
-	totemrrp_initialize (
df4b1e
+	res = totemrrp_initialize (
df4b1e
 		poll_handle,
df4b1e
 		&instance->totemrrp_context,
df4b1e
 		totem_config,
df4b1e
@@ -1004,6 +1005,9 @@ int totemsrp_initialize (
df4b1e
 		main_token_seqid_get,
df4b1e
 		main_msgs_missing,
df4b1e
 		target_set_completed);
df4b1e
+	if (res == -1) {
df4b1e
+		goto error_exit;
df4b1e
+	}
df4b1e
 
df4b1e
 	/*
df4b1e
 	 * Must have net_mtu adjusted by totemrrp_initialize first
df4b1e
-- 
df4b1e
1.7.1
df4b1e