Browse Source

totem: Propagate totem initialization failure

(backported from master 564b4bf7d4c5b3f632a48610761dce58e5809b3a)

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse 8 years ago
parent
commit
0413a8f467
4 changed files with 21 additions and 4 deletions
  1. 6 2
      exec/main.c
  2. 5 0
      exec/totempg.c
  3. 5 1
      exec/totemrrp.c
  4. 5 1
      exec/totemsrp.c

+ 6 - 2
exec/main.c

@@ -1355,9 +1355,13 @@ int main (int argc, char **argv, char **envp)
 	 * Join multicast group and setup delivery
 	 *  and configuration change functions
 	 */
-	totempg_initialize (
+	if (totempg_initialize (
 		corosync_poll_handle,
-		&totem_config);
+		&totem_config) != 0) {
+
+		log_printf (LOGSYS_LEVEL_ERROR, "Can't initialize TOTEM layer");
+		corosync_exit_error (COROSYNC_DONE_FATAL_ERR);
+	}
 
 	totempg_service_ready_register (
 		main_service_ready);

+ 5 - 0
exec/totempg.c

@@ -814,6 +814,10 @@ int totempg_initialize (
 		totempg_confchg_fn,
 		totempg_waiting_trans_ack_cb);
 
+	if (res == -1) {
+		goto error_exit;
+	}
+
 	totemmrp_callback_token_create (
 		&callback_token_received_handle,
 		TOTEM_CALLBACK_TOKEN_RECEIVED,
@@ -827,6 +831,7 @@ int totempg_initialize (
 
 	list_init (&totempg_groups_list);
 
+error_exit:
 	return (res);
 }
 

+ 5 - 1
exec/totemrrp.c

@@ -2150,7 +2150,7 @@ int totemrrp_initialize (
 		deliver_fn_context->iface_no = i;
 		instance->deliver_fn_context[i] = (void *)deliver_fn_context;
 
-		totemnet_initialize (
+		res = totemnet_initialize (
 			poll_handle,
 			&instance->net_handles[i],
 			totem_config,
@@ -2161,6 +2161,10 @@ int totemrrp_initialize (
 			rrp_iface_change_fn,
 			rrp_target_set_completed);
 
+		if (res == -1) {
+			goto error_destroy;
+		}
+
 		totemnet_net_mtu_adjust (instance->net_handles[i], totem_config);
 	}
 

+ 5 - 1
exec/totemsrp.c

@@ -851,6 +851,7 @@ int totemsrp_initialize (
 		int waiting_trans_ack))
 {
 	struct totemsrp_instance *instance;
+	int res;
 
 	instance = malloc (sizeof (struct totemsrp_instance));
 	if (instance == NULL) {
@@ -993,7 +994,7 @@ int totemsrp_initialize (
 		}
 	}
 
-	totemrrp_initialize (
+	res = totemrrp_initialize (
 		poll_handle,
 		&instance->totemrrp_context,
 		totem_config,
@@ -1004,6 +1005,9 @@ int totemsrp_initialize (
 		main_token_seqid_get,
 		main_msgs_missing,
 		target_set_completed);
+	if (res == -1) {
+		goto error_exit;
+	}
 
 	/*
 	 * Must have net_mtu adjusted by totemrrp_initialize first