The corosync compat layer in evil.c needs to process event barriers to
be compatible with openais whitetank.
This patch does that when corosync is run in compatibility mode
whitetank.
Regards
-steve
Index: exec/evil.c
===================================================================
--- exec/evil.c (revision 2309)
+++ exec/evil.c (working copy)
@@ -76,6 +76,12 @@
#include "sync.h"
#include "evil.h"
+static unsigned int my_evt_checked_in = 0;
+
+static unsigned int my_member_list_entries;
+
+static struct corosync_api_v1 *api = NULL;
+
static void clm_sync_init (
const unsigned int *member_list,
size_t member_list_entries,
@@ -100,6 +106,13 @@
static int clm_hack_init (void);
+static void deliver_fn_evt_compat (
+ unsigned int nodeid,
+ unsigned int service,
+ unsigned int fn_id,
+ const void *msg,
+ unsigned int endian_conversion_required);
+
static struct sync_callbacks clm_sync_operations = {
.name = "dummy CLM service",
.sync_init = clm_sync_init,
@@ -116,7 +129,6 @@
.sync_abort = evt_sync_abort,
};
-static struct corosync_api_v1 *api = NULL;
static void sync_dummy_init (
const unsigned int *member_list,
@@ -169,6 +181,9 @@
callbacks->name = "dummy CKPT service";
break;
case EVT_SERVICE:
+ /*
+ * double ugh
+ */
memcpy (callbacks, &evt_sync_operations, sizeof (struct sync_callbacks));
callbacks_init = 0;
break;
@@ -206,6 +221,23 @@
return (0);
}
+void evil_deliver_fn (
+ unsigned int nodeid,
+ unsigned int service,
+ unsigned int fn_id,
+ const void *msg,
+ unsigned int endian_conversion_required)
+{
+ if (service == EVT_SERVICE) {
+ deliver_fn_evt_compat (
+ nodeid,
+ service,
+ fn_id,
+ msg,
+ endian_conversion_required);
+ }
+}
+
/*
* This sends the clm nodejoin message required by clm services
* on whitetank as well as the event service
@@ -387,7 +419,10 @@
enum evt_sync_states {
EVT_SYNC_PART_ONE,
- EVT_SYNC_PART_TWO
+ EVT_SYNC_PART_TWO,
+ EVT_SYNC_PART_THREE,
+ EVT_SYNC_PART_FOUR,
+ EVT_SYNC_DONE
};
static enum evt_sync_states evt_sync_state;
@@ -419,6 +454,9 @@
size_t member_list_entries,
const struct memb_ring_id *ring_id)
{
+ my_member_list_entries = member_list_entries;
+ my_evt_checked_in = 0;
+
evt_sync_state = EVT_SYNC_PART_ONE;
return;
}
@@ -445,14 +483,18 @@
}
evt_sync_state = EVT_SYNC_PART_TWO;
}
- if (evt_sync_state == EVT_SYNC_PART_TWO) {
+ if (evt_sync_state == EVT_SYNC_PART_THREE) {
cpkt.chc_op = EVT_CONF_DONE;
res = api->totem_mcast(&chn_iovec, 1,TOTEMPG_AGREED);
if (res == -1) {
return (res);
}
+ evt_sync_state = EVT_SYNC_PART_FOUR;
}
- return (0);
+ if (evt_sync_state == EVT_SYNC_DONE) {
+ return (0);
+ }
+ return (-1);
}
static void evt_sync_activate (void)
@@ -464,3 +506,38 @@
{
return;
}
+
+static void deliver_fn_evt_compat (
+ unsigned int nodeid,
+ unsigned int service,
+ unsigned int fn_id,
+ const void *msg,
+ unsigned int endian_conversion_required)
+{
+ const struct req_evt_chan_command *cpkt = msg;
+ unsigned int operation;
+
+ if (fn_id != MESSAGE_REQ_EXEC_EVT_CHANCMD) {
+ return;
+ }
+ operation = cpkt->chc_op;
+
+ if (endian_conversion_required) {
+ operation = swab32 (operation);
+ }
+
+ switch (operation) {
+ case EVT_OPEN_COUNT_DONE:
+ if (++my_evt_checked_in == my_member_list_entries) {
+ evt_sync_state = EVT_SYNC_PART_THREE;
+ my_evt_checked_in = 0;
+ }
+ break;
+ case EVT_CONF_DONE:
+ if (++my_evt_checked_in == my_member_list_entries) {
+ evt_sync_state = EVT_SYNC_DONE;
+ my_evt_checked_in = 0;
+ }
+ break;
+ }
+}
Index: exec/evil.h
===================================================================
--- exec/evil.h (revision 2309)
+++ exec/evil.h (working copy)
@@ -45,4 +45,11 @@
int sync_id,
struct sync_callbacks *callbacks);
+extern void evil_deliver_fn (
+ unsigned int nodeid,
+ unsigned int service,
+ unsigned int fn_id,
+ const void *msg,
+ unsigned int endian_conversion_required);
+
#endif /* EVIL_H_DEFINED */
Index: exec/main.c
===================================================================
--- exec/main.c (revision 2309)
+++ exec/main.c (working copy)
@@ -272,10 +272,14 @@
{
int res;
- if (service_id == CLM_SERVICE && ais_service[CLM_SERVICE] == NULL) {
+ if (minimum_sync_mode == CS_SYNC_V1 && service_id == CLM_SERVICE && ais_service[CLM_SERVICE] == NULL) {
res = evil_callbacks_load (service_id, callbacks);
return (res);
}
+ if (minimum_sync_mode == CS_SYNC_V1 && service_id == EVT_SERVICE && ais_service[EVT_SERVICE] == NULL) {
+ res = evil_callbacks_load (service_id, callbacks);
+ return (res);
+ }
if (ais_service[service_id] == NULL) {
return (-1);
}
@@ -436,11 +440,19 @@
*/
service = id >> 16;
fn_id = id & 0xffff;
- if (!ais_service[service])
- return;
serialize_lock();
+ if (ais_service[service] == NULL && service == EVT_SERVICE) {
+ evil_deliver_fn (nodeid, service, fn_id, msg,
+ endian_conversion_required);
+ }
+
+ if (!ais_service[service]) {
+ serialize_unlock();
+ return;
+ }
+
if (endian_conversion_required) {
assert(ais_service[service]->exec_engine[fn_id].exec_endian_convert_fn != NULL);
ais_service[service]->exec_engine[fn_id].exec_endian_convert_fn
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais