From 0413a8f4672352171f0df731b7d9c1fe20acbc4c Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 14 Jun 2017 16:27:37 +0200 Subject: [PATCH] totem: Propagate totem initialization failure (backported from master 564b4bf7d4c5b3f632a48610761dce58e5809b3a) Signed-off-by: Jan Friesse Reviewed-by: Christine Caulfield --- exec/main.c | 8 ++++++-- exec/totempg.c | 5 +++++ exec/totemrrp.c | 6 +++++- exec/totemsrp.c | 6 +++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/exec/main.c b/exec/main.c index 5f96c28..0d381c2 100644 --- a/exec/main.c +++ b/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); diff --git a/exec/totempg.c b/exec/totempg.c index 05729be..5cef5e1 100644 --- a/exec/totempg.c +++ b/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); } diff --git a/exec/totemrrp.c b/exec/totemrrp.c index c6b97bc..f806feb 100644 --- a/exec/totemrrp.c +++ b/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); } diff --git a/exec/totemsrp.c b/exec/totemsrp.c index f80f8e4..91c5423 100644 --- a/exec/totemsrp.c +++ b/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 -- 1.7.1