diff -Naurd corosync-0.94.orig/exec/apidef.c corosync-trunk/exec/apidef.c --- corosync-0.94.orig/exec/apidef.c 2009-02-25 12:14:47.000000000 +0100 +++ corosync-trunk/exec/apidef.c 2009-03-06 08:38:34.000000000 +0100 @@ -86,7 +86,6 @@ .totem_family_get = totempg_my_family_get, .totem_ring_reenable = totempg_ring_reenable, .totem_mcast = main_mcast, - .totem_send_ok = main_send_ok, .totem_ifaces_get = totempg_ifaces_get, .totem_ifaces_print = totempg_ifaces_print, .totem_ip_print = totemip_print, @@ -96,9 +95,11 @@ .tpg_join = (typedef_tpg_join)totempg_groups_join, .tpg_leave = (typedef_tpg_leave)totempg_groups_leave, .tpg_joined_mcast = totempg_groups_mcast_joined, - .tpg_joined_send_ok = totempg_groups_send_ok_joined, + .tpg_joined_reserve = totempg_groups_joined_reserve, + .tpg_joined_release = totempg_groups_joined_release, .tpg_groups_mcast = (typedef_tpg_groups_mcast)totempg_groups_mcast_groups, - .tpg_groups_send_ok = (typedef_tpg_groups_send_ok)totempg_groups_send_ok_groups, + .tpg_groups_reserve = NULL, + .tpg_groups_release = NULL, .sync_request = sync_request, .quorum_is_quorate = corosync_quorum_is_quorate, .quorum_register_callback = corosync_quorum_register_callback, diff -Naurd corosync-0.94.orig/exec/ipc.c corosync-trunk/exec/ipc.c --- corosync-0.94.orig/exec/ipc.c 2009-03-03 01:58:16.000000000 +0100 +++ corosync-trunk/exec/ipc.c 2009-03-06 08:38:34.000000000 +0100 @@ -270,7 +270,7 @@ struct res_overlay res_overlay; struct iovec send_ok_joined_iovec; int send_ok = 0; - int send_ok_joined = 0; + int reserved_msgs = 0; for (;;) { sop.sem_num = 0; @@ -296,14 +296,16 @@ send_ok_joined_iovec.iov_base = (char *)header; send_ok_joined_iovec.iov_len = header->size; - send_ok_joined = totempg_groups_send_ok_joined (corosync_group_handle, + + reserved_msgs = totempg_groups_joined_reserve ( + corosync_group_handle, &send_ok_joined_iovec, 1); send_ok = (corosync_quorum_is_quorate() == 1 || ais_service[conn_info->service]->allow_inquorate == CS_LIB_ALLOW_INQUORATE) && ( (ais_service[conn_info->service]->lib_engine[header->id].flow_control == CS_LIB_FLOW_CONTROL_NOT_REQUIRED) || ((ais_service[conn_info->service]->lib_engine[header->id].flow_control == CS_LIB_FLOW_CONTROL_REQUIRED) && - (send_ok_joined) && + (reserved_msgs) && (sync_in_process() == 0))); if (send_ok) { @@ -321,6 +323,7 @@ res_overlay.header.size); } + totempg_groups_joined_release (reserved_msgs); cs_conn_refcount_dec (conn); } pthread_exit (0); diff -Naurd corosync-0.94.orig/exec/logsys.c corosync-trunk/exec/logsys.c --- corosync-0.94.orig/exec/logsys.c 2009-01-23 15:25:30.000000000 +0100 +++ corosync-trunk/exec/logsys.c 2009-03-10 09:03:50.000000000 +0100 @@ -112,8 +112,6 @@ static int logsys_facility = LOG_DAEMON; -static char *logsys_format = NULL; - /* * operating global variables */ @@ -139,7 +137,7 @@ static int logsys_buffer_full = 0; -static char *format_buffer="[%6s] %b"; +static char *format_buffer=NULL; static int log_requests_pending = 0; @@ -875,11 +873,25 @@ { pthread_mutex_lock (&logsys_config_mutex); - logsys_format = format; + if (format_buffer) { + free(format_buffer); + format_buffer = NULL; + } + + if (format) { + format_buffer = strdup(format); + } else { + format_buffer = strdup("[%6s] %b"); + } pthread_mutex_unlock (&logsys_config_mutex); } +char *logsys_format_get (void) +{ + return format_buffer; +} + void logsys_config_facility_set (char *name, unsigned int facility) { pthread_mutex_lock (&logsys_config_mutex); diff -Naurd corosync-0.94.orig/exec/main.c corosync-trunk/exec/main.c --- corosync-0.94.orig/exec/main.c 2009-02-25 12:14:47.000000000 +0100 +++ corosync-trunk/exec/main.c 2009-03-09 13:59:40.000000000 +0100 @@ -83,7 +83,7 @@ LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED | LOG_MODE_FORK, NULL, LOG_DAEMON, - "[%6s] %b", + NULL, 1000000); LOGSYS_DECLARE_SUBSYS ("MAIN", LOG_INFO); @@ -448,13 +448,6 @@ return (totempg_groups_mcast_joined (corosync_group_handle, iovec, iov_len, guarantee)); } -extern int main_send_ok ( - struct iovec *iovec, - int iov_len) -{ - return (totempg_groups_send_ok_joined (corosync_group_handle, iovec, iov_len)); -} - int main (int argc, char **argv) { char *error_string; diff -Naurd corosync-0.94.orig/exec/mainconfig.c corosync-trunk/exec/mainconfig.c --- corosync-0.94.orig/exec/mainconfig.c 2009-02-25 12:14:47.000000000 +0100 +++ corosync-trunk/exec/mainconfig.c 2009-03-09 13:59:40.000000000 +0100 @@ -158,16 +158,14 @@ } } if (!objdb_get_string (objdb,object_service_handle, "timestamp", &value)) { -/* todo change format string if (strcmp (value, "on") == 0) { - main_config->logmode |= LOG_MODE_DISPLAY_TIMESTAMP; + logsys_format_set("%t [%6s] %b"); } else if (strcmp (value, "off") == 0) { - main_config->logmode &= ~LOG_MODE_DISPLAY_TIMESTAMP; + logsys_format_set(NULL); } else { goto parse_error; } -*/ } /* free old string on reload */ diff -Naurd corosync-0.94.orig/exec/main.h corosync-trunk/exec/main.h --- corosync-0.94.orig/exec/main.h 2009-02-25 12:14:47.000000000 +0100 +++ corosync-trunk/exec/main.h 2009-03-06 08:38:34.000000000 +0100 @@ -62,8 +62,4 @@ int iov_len, unsigned int guarantee); -extern int main_send_ok ( - struct iovec *iovec, - int iov_len); - #endif /* MAIN_H_DEFINED */ diff -Naurd corosync-0.94.orig/exec/totemip.c corosync-trunk/exec/totemip.c --- corosync-0.94.orig/exec/totemip.c 2009-01-26 21:46:45.000000000 +0100 +++ corosync-trunk/exec/totemip.c 2009-03-03 04:57:37.000000000 +0100 @@ -406,6 +406,7 @@ memset(&nladdr, 0, sizeof(nladdr)); nladdr.nl_family = AF_NETLINK; + memset(&req, 0, sizeof(req)); req.nlh.nlmsg_len = sizeof(req); req.nlh.nlmsg_type = RTM_GETADDR; req.nlh.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST; diff -Naurd corosync-0.94.orig/exec/totempg.c corosync-trunk/exec/totempg.c --- corosync-0.94.orig/exec/totempg.c 2009-02-25 12:14:47.000000000 +0100 +++ corosync-trunk/exec/totempg.c 2009-03-06 08:38:34.000000000 +0100 @@ -145,6 +145,8 @@ static int mcast_packed_msg_count = 0; +static int totempg_reserved = 0; + /* * Function and data used to log messages */ @@ -225,8 +227,6 @@ .mutex = PTHREAD_MUTEX_INITIALIZER }; -static int send_ok (int msg_size); - static unsigned char next_fragment = 1; static pthread_mutex_t totempg_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -241,6 +241,10 @@ __FILE__, __LINE__, level, format, ##args); \ } while (0); +static int msg_count_send_ok (int msg_count); + +static int byte_count_send_ok (int byte_count); + static struct assembly *assembly_ref (unsigned int nodeid) { struct assembly *assembly; @@ -765,7 +769,7 @@ total_size += iovec[i].iov_len; } - if (send_ok (total_size + sizeof(unsigned short) * + if (byte_count_send_ok (total_size + sizeof(unsigned short) * (mcast_packed_msg_count+1)) == 0) { pthread_mutex_unlock (&mcast_msg_mutex); @@ -888,23 +892,44 @@ /* * Determine if a message of msg_size could be queued */ -#define FUZZY_AVAIL_SUBTRACT 5 -static int send_ok ( - int msg_size) +static int msg_count_send_ok ( + int msg_count) { int avail = 0; - int total; - avail = totemmrp_avail () - FUZZY_AVAIL_SUBTRACT; + avail = totemmrp_avail () - totempg_reserved - 1; - /* - * msg size less then totempg_totem_config->net_mtu - 25 will take up - * a full message, so add +1 - * totempg_totem_config->net_mtu - 25 is for the totempg_mcast header - */ - total = (msg_size / (totempg_totem_config->net_mtu - 25)) + 1; + return (avail > msg_count); +} - return (avail >= total); +static int byte_count_send_ok ( + int byte_count) +{ + unsigned int msg_count = 0; + int avail = 0; + + avail = totemmrp_avail () - 1; + + msg_count = (byte_count / (totempg_totem_config->net_mtu - 25)) + 1; + + return (avail > msg_count); +} + +static int send_reserve ( + int msg_size) +{ + unsigned int msg_count = 0; + + msg_count = (msg_size / (totempg_totem_config->net_mtu - 25)) + 1; + totempg_reserved += msg_count; + + return (msg_count); +} + +static void send_release ( + int msg_count) +{ + totempg_reserved -= msg_count; } int totempg_callback_token_create ( @@ -1091,7 +1116,7 @@ return (res); } -int totempg_groups_send_ok_joined ( +int totempg_groups_joined_reserve ( hdb_handle_t handle, struct iovec *iovec, int iov_len) @@ -1100,6 +1125,7 @@ unsigned int size = 0; unsigned int i; unsigned int res; + unsigned int reserved = 0; pthread_mutex_lock (&totempg_mutex); pthread_mutex_lock (&mcast_msg_mutex); @@ -1116,14 +1142,28 @@ size += iovec[i].iov_len; } - res = send_ok (size); + reserved = send_reserve (size); + if (msg_count_send_ok (reserved) == 0) { + send_release (reserved); + reserved = 0; + } hdb_handle_put (&totempg_groups_instance_database, handle); error_exit: pthread_mutex_unlock (&mcast_msg_mutex); pthread_mutex_unlock (&totempg_mutex); - return (res); + return (reserved); +} + + +void totempg_groups_joined_release (int msg_count) +{ + pthread_mutex_lock (&totempg_mutex); + pthread_mutex_lock (&mcast_msg_mutex); + send_release (msg_count); + pthread_mutex_unlock (&mcast_msg_mutex); + pthread_mutex_unlock (&totempg_mutex); } int totempg_groups_mcast_groups ( @@ -1201,7 +1241,7 @@ size += iovec[i].iov_len; } - res = send_ok (size); + res = msg_count_send_ok (size); hdb_handle_put (&totempg_groups_instance_database, handle); error_exit: diff -Naurd corosync-0.94.orig/include/corosync/engine/coroapi.h corosync-trunk/include/corosync/engine/coroapi.h --- corosync-0.94.orig/include/corosync/engine/coroapi.h 2009-02-26 15:49:41.000000000 +0100 +++ corosync-trunk/include/corosync/engine/coroapi.h 2009-03-06 08:38:34.000000000 +0100 @@ -413,8 +413,6 @@ int (*totem_mcast) (struct iovec *iovec, int iov_len, unsigned int guarantee); - int (*totem_send_ok) (struct iovec *iovec, int iov_len); - int (*totem_ifaces_get) ( unsigned int nodeid, struct totem_ip_address *interfaces, @@ -472,11 +470,14 @@ int iov_len, int guarantee); - int (*tpg_joined_send_ok) ( + int (*tpg_joined_reserve) ( hdb_handle_t handle, struct iovec *iovec, int iov_len); + int (*tpg_joined_release) ( + int reserved_msgs); + int (*tpg_groups_mcast) ( hdb_handle_t handle, int guarantee, @@ -485,13 +486,16 @@ struct iovec *iovec, int iov_len); - int (*tpg_groups_send_ok) ( + int (*tpg_groups_reserve) ( hdb_handle_t handle, struct corosync_tpg_group *groups, int groups_cnt, struct iovec *iovec, int iov_len); + int (*tpg_groups_release) ( + int reserved_msgs); + int (*sync_request) ( char *service_name); diff -Naurd corosync-0.94.orig/include/corosync/engine/logsys.h corosync-trunk/include/corosync/engine/logsys.h --- corosync-0.94.orig/include/corosync/engine/logsys.h 2009-01-16 09:59:09.000000000 +0100 +++ corosync-trunk/include/corosync/engine/logsys.h 2009-03-10 09:03:50.000000000 +0100 @@ -97,6 +97,8 @@ extern void logsys_format_set ( char *format); +extern char *logsys_format_get (void); + extern unsigned int logsys_config_subsys_set ( const char *subsys, unsigned int tags, diff -Naurd corosync-0.94.orig/include/corosync/ipc_cfg.h corosync-trunk/include/corosync/ipc_cfg.h --- corosync-0.94.orig/include/corosync/ipc_cfg.h 2009-02-19 03:23:58.000000000 +0100 +++ corosync-trunk/include/corosync/ipc_cfg.h 2009-03-06 11:07:35.000000000 +0100 @@ -69,7 +69,8 @@ MESSAGE_RES_CFG_TRYSHUTDOWN = 9, MESSAGE_RES_CFG_TESTSHUTDOWN = 10, MESSAGE_RES_CFG_GET_NODE_ADDRS = 11, - MESSAGE_RES_CFG_LOCAL_GET = 12 + MESSAGE_RES_CFG_LOCAL_GET = 12, + MESSAGE_RES_CFG_REPLYTOSHUTDOWN = 13 }; struct req_lib_cfg_statetrack { diff -Naurd corosync-0.94.orig/include/corosync/totem/totempg.h corosync-trunk/include/corosync/totem/totempg.h --- corosync-0.94.orig/include/corosync/totem/totempg.h 2009-02-25 12:14:47.000000000 +0100 +++ corosync-trunk/include/corosync/totem/totempg.h 2009-03-06 08:38:34.000000000 +0100 @@ -110,10 +110,13 @@ int iov_len, int guarantee); -extern int totempg_groups_send_ok_joined ( +extern int totempg_groups_joined_reserve ( hdb_handle_t handle, struct iovec *iovec, int iov_len); + +extern void totempg_groups_joined_release ( + int msg_count); extern int totempg_groups_mcast_groups ( hdb_handle_t handle, diff -Naurd corosync-0.94.orig/lib/cfg.c corosync-trunk/lib/cfg.c --- corosync-0.94.orig/lib/cfg.c 2009-02-19 03:23:58.000000000 +0100 +++ corosync-trunk/lib/cfg.c 2009-03-06 11:07:35.000000000 +0100 @@ -295,8 +295,6 @@ pthread_mutex_destroy (&cfg_instance->dispatch_mutex); - cslib_service_disconnect (&cfg_instance->ipc_ctx); - (void)saHandleDestroy (&cfg_hdb, cfg_handle); (void)saHandleInstancePut (&cfg_hdb, cfg_handle); diff -Naurd corosync-0.94.orig/services/cfg.c corosync-trunk/services/cfg.c --- corosync-0.94.orig/services/cfg.c 2009-02-25 12:14:47.000000000 +0100 +++ corosync-trunk/services/cfg.c 2009-03-06 11:07:35.000000000 +0100 @@ -237,8 +237,8 @@ }, { /* 10 */ .lib_handler_fn = message_handler_req_lib_cfg_replytoshutdown, - .response_size = 0, - .response_id = 0, + .response_size = sizeof (struct res_lib_cfg_replytoshutdown), + .response_id = MESSAGE_RES_CFG_REPLYTOSHUTDOWN, .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED }, { /* 11 */ @@ -385,7 +385,7 @@ return 0; } -static void send_test_shutdown(void * conn, int status) +static void send_test_shutdown(void *only_conn, void *exclude_conn, int status) { struct res_lib_cfg_testshutdown res_lib_cfg_testshutdown; struct list_head *iter; @@ -396,17 +396,19 @@ res_lib_cfg_testshutdown.header.error = status; res_lib_cfg_testshutdown.flags = shutdown_flags; - if (conn) { - TRACE1("sending testshutdown to %p", conn); - api->ipc_response_send(conn, &res_lib_cfg_testshutdown, - sizeof(res_lib_cfg_testshutdown)); + if (only_conn) { + TRACE1("sending testshutdown to only %p", only_conn); + api->ipc_dispatch_send(only_conn, &res_lib_cfg_testshutdown, + sizeof(res_lib_cfg_testshutdown)); } else { for (iter = trackers_list.next; iter != &trackers_list; iter = iter->next) { struct cfg_info *ci = list_entry(iter, struct cfg_info, list); - TRACE1("sending testshutdown to %p", ci->tracker_conn); - api->ipc_dispatch_send(ci->tracker_conn, &res_lib_cfg_testshutdown, - sizeof(res_lib_cfg_testshutdown)); + if (ci->conn != exclude_conn) { + TRACE1("sending testshutdown to %p", ci->tracker_conn); + api->ipc_dispatch_send(ci->tracker_conn, &res_lib_cfg_testshutdown, + sizeof(res_lib_cfg_testshutdown)); + } } } LEAVE(); @@ -436,11 +438,6 @@ shutdown_flags == CFG_SHUTDOWN_FLAG_REGARDLESS) { TRACE1("shutdown confirmed"); - /* - * Tell other nodes we are going down - */ - send_shutdown(); - res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; res_lib_cfg_tryshutdown.header.error = CS_OK; @@ -451,6 +448,12 @@ api->ipc_response_send(shutdown_con->conn, &res_lib_cfg_tryshutdown, sizeof(res_lib_cfg_tryshutdown)); shutdown_con = NULL; + + /* + * Tell other nodes we are going down + */ + send_shutdown(); + } else { @@ -486,7 +489,7 @@ shutdown_no = shutdown_expected; check_shutdown_status(); - send_test_shutdown(NULL, CS_ERR_TIMEOUT); + send_test_shutdown(NULL, NULL, CS_ERR_TIMEOUT); LEAVE(); } @@ -695,7 +698,6 @@ void *msg) { struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); -// struct req_lib_cfg_statetrack *req_lib_cfg_statetrack = (struct req_lib_cfg_statetrack *)message; struct res_lib_cfg_statetrack res_lib_cfg_statetrack; ENTER(); @@ -713,7 +715,7 @@ */ ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; shutdown_expected++; - send_test_shutdown(conn, CS_OK); + send_test_shutdown(conn, NULL, CS_OK); } } @@ -898,15 +900,32 @@ shutdown_expected = 0; for (iter = trackers_list.next; iter != &trackers_list; iter = iter->next) { - struct cfg_info *ci = list_entry(iter, struct cfg_info, list); - ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; - shutdown_expected++; + struct cfg_info *testci = list_entry(iter, struct cfg_info, list); + /* + * It is assumed that we will allow shutdown + */ + if (testci != ci) { + testci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; + shutdown_expected++; + } } /* * If no-one is listening for events then we can just go down now */ if (shutdown_expected == 0) { + struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown; + + res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); + res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; + res_lib_cfg_tryshutdown.header.error = CS_OK; + + /* + * Tell originator that shutdown was confirmed + */ + api->ipc_response_send(conn, &res_lib_cfg_tryshutdown, + sizeof(res_lib_cfg_tryshutdown)); + send_shutdown(); LEAVE(); return; @@ -944,7 +963,7 @@ /* * Tell the users we would like to shut down */ - send_test_shutdown(NULL, CS_OK); + send_test_shutdown(NULL, conn, CS_OK); } /* @@ -961,11 +980,13 @@ { struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); struct req_lib_cfg_replytoshutdown *req_lib_cfg_replytoshutdown = (struct req_lib_cfg_replytoshutdown *)msg; + struct res_lib_cfg_replytoshutdown res_lib_cfg_replytoshutdown; + int status = CS_OK; ENTER(); if (!shutdown_con) { - LEAVE(); - return; + status = CS_ERR_ACCESS; + goto exit_fn; } if (req_lib_cfg_replytoshutdown->response) { @@ -977,6 +998,15 @@ ci->shutdown_reply = SHUTDOWN_REPLY_NO; } check_shutdown_status(); + +exit_fn: + res_lib_cfg_replytoshutdown.header.error = status; + res_lib_cfg_replytoshutdown.header.id = MESSAGE_RES_CFG_REPLYTOSHUTDOWN; + res_lib_cfg_replytoshutdown.header.size = sizeof(res_lib_cfg_replytoshutdown); + + api->ipc_response_send(conn, &res_lib_cfg_replytoshutdown, + sizeof(res_lib_cfg_replytoshutdown)); + LEAVE(); } diff -Naurd corosync-0.94.orig/services/cpg.c corosync-trunk/services/cpg.c --- corosync-0.94.orig/services/cpg.c 2009-03-03 01:57:44.000000000 +0100 +++ corosync-trunk/services/cpg.c 2009-03-06 03:42:48.000000000 +0100 @@ -489,8 +489,8 @@ notify_info.nodeid = api->totem_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); } + list_del(&pi->list); api->ipc_refcnt_dec (conn); return (0); } diff -Naurd corosync-0.94.orig/services/evs.c corosync-trunk/services/evs.c --- corosync-0.94.orig/services/evs.c 2009-02-19 03:23:58.000000000 +0100 +++ corosync-trunk/services/evs.c 2009-03-06 08:38:34.000000000 +0100 @@ -363,7 +363,6 @@ struct res_lib_evs_mcast_joined res_lib_evs_mcast_joined; struct iovec req_exec_evs_mcast_iovec[3]; struct req_exec_evs_mcast req_exec_evs_mcast; - int send_ok = 0; int res; struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn); @@ -382,8 +381,6 @@ req_exec_evs_mcast_iovec[1].iov_len = evs_pd->group_entries * sizeof (struct evs_group); req_exec_evs_mcast_iovec[2].iov_base = (char *)&req_lib_evs_mcast_joined->msg; req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_joined->msg_len; -// TODO this doesn't seem to work for some reason - send_ok = api->totem_send_ok (req_exec_evs_mcast_iovec, 3); res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED); // TODO @@ -407,7 +404,6 @@ struct iovec req_exec_evs_mcast_iovec[3]; struct req_exec_evs_mcast req_exec_evs_mcast; char *msg_addr; - int send_ok = 0; int res; req_exec_evs_mcast.header.size = sizeof (struct req_exec_evs_mcast) + @@ -430,8 +426,6 @@ req_exec_evs_mcast_iovec[2].iov_base = msg_addr; req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_groups->msg_len; -// TODO this is wacky - send_ok = api->totem_send_ok (req_exec_evs_mcast_iovec, 3); res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED); if (res == 0) { error = CS_OK; diff -Naurd corosync-0.94.orig/test/logsysbench.c corosync-trunk/test/logsysbench.c --- corosync-0.94.orig/test/logsysbench.c 2008-10-30 23:25:56.000000000 +0100 +++ corosync-trunk/test/logsysbench.c 2009-03-09 13:59:40.000000000 +0100 @@ -42,7 +42,7 @@ LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, NULL, LOG_DAEMON, - "[%6s] %b", + NULL, 100000); LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); diff -Naurd corosync-0.94.orig/test/logsysrec.c corosync-trunk/test/logsysrec.c --- corosync-0.94.orig/test/logsysrec.c 2008-10-30 23:25:56.000000000 +0100 +++ corosync-trunk/test/logsysrec.c 2009-03-09 13:59:40.000000000 +0100 @@ -39,7 +39,7 @@ LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, NULL, LOG_DAEMON, - "[%6s] %b", + NULL, 100000); LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); diff -Naurd corosync-0.94.orig/test/logsys_t2.c corosync-trunk/test/logsys_t2.c --- corosync-0.94.orig/test/logsys_t2.c 2008-10-30 23:25:56.000000000 +0100 +++ corosync-trunk/test/logsys_t2.c 2009-03-09 13:59:40.000000000 +0100 @@ -39,7 +39,7 @@ LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, NULL, LOG_DAEMON, - "[%6s] %b" + NULL, 100000); LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); diff -Naurd corosync-0.94.orig/tools/corosync-cfgtool.c corosync-trunk/tools/corosync-cfgtool.c --- corosync-0.94.orig/tools/corosync-cfgtool.c 2009-02-13 10:21:57.000000000 +0100 +++ corosync-trunk/tools/corosync-cfgtool.c 2009-03-06 11:07:35.000000000 +0100 @@ -147,36 +147,13 @@ (void)corosync_cfg_finalize (handle); } -void shutdown_callback (corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_flags_t flags) -{ - printf("shutdown callback called, flags = %d\n",flags); - - (void)corosync_cfg_replyto_shutdown (cfg_handle, COROSYNC_CFG_SHUTDOWN_FLAG_YES); -} - -void *shutdown_dispatch_thread(void *arg) -{ - int res = CS_OK; - corosync_cfg_handle_t *handle = arg; - - while (res == CS_OK) { - res = corosync_cfg_dispatch(*handle, CS_DISPATCH_ALL); - if (res != CS_OK) - printf ("Could not dispatch cfg messages: %d\n", res); - } - return NULL; -} - void shutdown_do() { cs_error_t result; corosync_cfg_handle_t handle; corosync_cfg_callbacks_t callbacks; - corosync_cfg_state_notification_t notification_buffer; - pthread_t dispatch_thread; - printf ("Shutting down corosync\n"); - callbacks.corosync_cfg_shutdown_callback = shutdown_callback; + callbacks.corosync_cfg_shutdown_callback = NULL; result = corosync_cfg_initialize (&handle, &callbacks); if (result != CS_OK) { @@ -184,16 +161,7 @@ exit (1); } - pthread_create(&dispatch_thread, NULL, shutdown_dispatch_thread, &handle); - - result = corosync_cfg_state_track (handle, - 0, - ¬ification_buffer); - if (result != CS_OK) { - printf ("Could not start corosync cfg tracking error %d\n", result); - exit (1); - } - + printf ("Shutting down corosync\n"); result = corosync_cfg_try_shutdown (handle, COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST); if (result != CS_OK) { printf ("Could not shutdown (error = %d)\n", result); @@ -262,7 +230,7 @@ void usage_do (void) { - printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [service_name] [-v] [version] [-k] [nodeid] [-a] [nodeid]\n\n"); + printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [-H] [service_name] [-v] [version] [-k] [nodeid] [-a] [nodeid]\n\n"); printf ("A tool for displaying and configuring active parameters within corosync.\n"); printf ("options:\n"); printf ("\t-s\tDisplays the status of the current rings on this node.\n"); @@ -272,11 +240,11 @@ printf ("\t-u\tUnload a service identified by name.\n"); printf ("\t-a\tDisplay the IP address(es) of a node\n"); printf ("\t-k\tKill a node identified by node id.\n"); - printf ("\t-h\tShutdown corosync cleanly on this node.\n"); + printf ("\t-H\tShutdown corosync cleanly on this node.\n"); } int main (int argc, char *argv[]) { - const char *options = "srl:u:v:k:a:h"; + const char *options = "srl:u:v:k:a:hH"; int opt; int service_load = 0; unsigned int nodeid; @@ -307,7 +275,7 @@ nodeid = atoi (optarg); killnode_do(nodeid); break; - case 'h': + case 'H': shutdown_do(); break; case 'a': @@ -316,6 +284,9 @@ case 'v': version = atoi (optarg); break; + case 'h': + usage_do(); + break; } }