ctdb-daemon: Allow a new monitor event to cancel one already in progress
authorMartin Schwenke <martin@meltin.net>
Tue, 14 Jul 2015 03:43:14 +0000 (13:43 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 14 Jul 2015 07:57:17 +0000 (09:57 +0200)
Before commit cbffbb7c2f406fc1d8ebad3c531cc2757232690e this was
possible and some users depend on this behaviour.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/eventscript.c

index c0893ff79a65af7e927e79be8e783e543188b973..49619b27063d97e1394f8416076231c31d5274d3 100644 (file)
@@ -715,8 +715,12 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
                }
        }
 
-       /* Do not run new monitor events if some event is already running */
-       if (call == CTDB_EVENT_MONITOR && ctdb->active_events > 0) {
+       /* Do not run new monitor events if some event is already
+        * running, unless the running event is a monitor event, in
+        * which case running a new one should cancel the old one. */
+       if (call == CTDB_EVENT_MONITOR &&
+           ctdb->active_events > 0 &&
+           ctdb->current_monitor == NULL) {
                if (callback != NULL) {
                        callback(ctdb, -ECANCELED, private_data);
                }