Signed-off-by: Angus Salkeld <[email protected]>
---
exec/ipc_glue.c | 49 ++++++++++++++++++++++++++++++++++++-------------
exec/main.c | 8 +++++++-
services/cpg.c | 10 +++-------
3 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/exec/ipc_glue.c b/exec/ipc_glue.c
index 9d6e8c8..d1db76c 100644
--- a/exec/ipc_glue.c
+++ b/exec/ipc_glue.c
@@ -588,7 +588,8 @@ static int32_t cs_ipcs_msg_process(qb_ipcs_connection_t *c,
struct qb_ipc_response_header response;
struct qb_ipc_request_header *request_pt = (struct
qb_ipc_request_header *)data;
int32_t service = qb_ipcs_service_id_get(c);
- int32_t send_ok;
+ int32_t send_ok = 0;
+ int32_t is_async_call = QB_FALSE;
ssize_t res = -1;
int sending_allowed_private_data;
@@ -597,25 +598,31 @@ static int32_t cs_ipcs_msg_process(qb_ipcs_connection_t
*c,
request_pt,
&sending_allowed_private_data);
+ is_async_call = (service == CPG_SERVICE && request_pt->id == 2);
+
/*
* This happens when the message contains some kind of invalid
* parameter, such as an invalid size
*/
- if (send_ok == -1) {
+ if (send_ok == -EINVAL) {
response.size = sizeof (response);
response.id = 0;
response.error = CS_ERR_INVALID_PARAM;
- log_printf(LOG_INFO, "%s() invalid message! size:%d error:%d",
- __func__, response.size,
response.error);
- qb_ipcs_response_send (c,
+ if (is_async_call) {
+ log_printf(LOG_INFO, "*** %s() invalid message! size:%d
error:%d",
+ __func__, response.size, response.error);
+ } else {
+ qb_ipcs_response_send (c,
&response,
sizeof (response));
+ }
res = -EINVAL;
- } else {
- if (send_ok) {
-
ais_service[service]->lib_engine[request_pt->id].lib_handler_fn(c, request_pt);
- res = 0;
- } else {
+ } else if (send_ok < 0) {
+ log_printf(LOG_CRIT,
+ "*** %s() (%d:%d - %d) %s!",
+ __func__, service, request_pt->id,
+ is_async_call, strerror(-send_ok));
+ if (!is_async_call) {
/*
* Overload, tell library to retry
*/
@@ -623,10 +630,26 @@ static int32_t cs_ipcs_msg_process(qb_ipcs_connection_t
*c,
response.id = 0;
response.error = CS_ERR_TRY_AGAIN;
qb_ipcs_response_send (c,
- &response,
- sizeof (response));
- res = -ENOBUFS;
+ &response,
+ sizeof (response));
+ }
+ res = -ENOBUFS;
+ }
+
+ if (send_ok) {
+ if (!is_async_call) {
+ log_printf(LOG_INFO, "%s() calling %d:%d",
+ __func__,
+ service, request_pt->id);
+ }
+
ais_service[service]->lib_engine[request_pt->id].lib_handler_fn(c, request_pt);
+ if (!is_async_call) {
+ log_printf(LOG_INFO, "%s() %d:%d done",
+ __func__,
+ service, request_pt->id);
}
+
+ res = 0;
}
corosync_sending_allowed_release (&sending_allowed_private_data);
return res;
diff --git a/exec/main.c b/exec/main.c
index ca744d3..c6bc2de 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -853,7 +853,7 @@ int corosync_sending_allowed (
corosync_group_handle,
&reserve_iovec, 1);
if (pd->reserved_msgs == -1) {
- return (-1);
+ return -EINVAL;
}
sending_allowed = QB_FALSE;
@@ -865,7 +865,13 @@ int corosync_sending_allowed (
sending_allowed = QB_TRUE;
} else if (pd->reserved_msgs && sync_in_process == 0) {
sending_allowed = QB_TRUE;
+ } else if (pd->reserved_msgs == 0) {
+ return -ENOBUFS;
+ } else /* (sync_in_process) */ {
+ return -EINPROGRESS;
}
+ } else {
+ return -EHOSTUNREACH;
}
return (sending_allowed);
diff --git a/services/cpg.c b/services/cpg.c
index dafa54e..6537caa 100644
--- a/services/cpg.c
+++ b/services/cpg.c
@@ -1651,7 +1651,6 @@ static void message_handler_req_lib_cpg_mcast (void
*conn, const void *message)
struct iovec req_exec_cpg_iovec[2];
struct req_exec_cpg_mcast req_exec_cpg_mcast;
- struct res_lib_cpg_mcast res_lib_cpg_mcast;
int msglen = req_lib_cpg_mcast->msglen;
int result;
cs_error_t error = CPG_ERR_NOT_EXIST;
@@ -1690,13 +1689,10 @@ static void message_handler_req_lib_cpg_mcast (void
*conn, const void *message)
result = api->totem_mcast (req_exec_cpg_iovec, 2, TOTEM_AGREED);
assert(result == 0);
+ } else {
+ log_printf(LOGSYS_LEVEL_ERROR, "*** %p can't mcast to group %s
state:%d, error:%d\n",
+ conn, group_name.value, cpd->cpd_state, error);
}
-
- res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast);
- res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST;
- res_lib_cpg_mcast.header.error = error;
- api->ipc_response_send (conn, &res_lib_cpg_mcast,
- sizeof (res_lib_cpg_mcast));
}
static void message_handler_req_lib_cpg_zc_execute (
--
1.7.3.1
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais