From e4f39905e01f060563009d43a4aa3f3f43d2218d Mon Sep 17 00:00:00 2001 From: Libor Peltan <libor.peltan@nic.cz> Date: Thu, 20 Jun 2024 09:36:02 +0200 Subject: [PATCH] ctl: prohibit opening zone-begin when blocking command is running If a command called with -b would be started and knotc zone-begin arrived in the meantime before the first command reaches zone_update_begin(), it might be blocked until zone-abort, which might however not be possible to send because ctl is blocked due to -b. --- src/knot/ctl/commands.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/knot/ctl/commands.c b/src/knot/ctl/commands.c index 3d0b304287..bf2eaeead4 100644 --- a/src/knot/ctl/commands.c +++ b/src/knot/ctl/commands.c @@ -863,6 +863,11 @@ static int zone_txn_begin(zone_t *zone, _unused_ ctl_args_t *args) return KNOT_EAGAIN; } + if (zone->events.running && zone->events.type >= 0 && zone->events.blocking[zone->events.type] != NULL) { + log_zone_warning(zone->name, "some blocking event running, try opening control transaction later"); + return KNOT_EAGAIN; + } + zone->control_update = malloc(sizeof(zone_update_t)); if (zone->control_update == NULL) { return KNOT_ENOMEM; -- GitLab