TALLOC_CTX *release_ips_ctx; /* a context used to automatically drop all IPs if we fail to recover the node */
TALLOC_CTX *event_script_ctx;
+ int active_events;
struct ctdb_event_script_state *current_monitor;
struct ctdb_scripts_wire *last_status[CTDB_EVENT_MAX];
status = 0;
}
+ state->ctdb->active_events--;
+ if (state->ctdb->active_events < 0) {
+ ctdb_fatal(state->ctdb, "Active events < 0");
+ }
+
/* This is allowed to free us; talloc will prevent double free anyway,
* but beware if you call this outside the destructor!
* the callback hangs off a different context so we walk the list
}
}
+ /* Do not run new monitor events if some event is already running */
+ if (call == CTDB_EVENT_MONITOR && ctdb->active_events > 0) {
+ if (callback != NULL) {
+ callback(ctdb, -ECANCELED, private_data);
+ }
+ return 0;
+ }
+
/* Kill off any running monitor events to run this event. */
if (ctdb->current_monitor) {
struct ctdb_event_script_state *ms = talloc_get_type(ctdb->current_monitor, struct ctdb_event_script_state);
talloc_set_destructor(state, event_script_destructor);
+ ctdb->active_events++;
+
/* Nothing to do? */
if (state->scripts->num_scripts == 0) {
talloc_free(state);