From: Ondřej Surý Date: Thu, 12 Jan 2023 20:44:31 +0000 (+0100) Subject: Allow interrupting dnssec-signzone during signing X-Git-Tag: v9.19.10~21^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=53e835130e5bf3bf55a0d8d2788b4145d2e193a9;p=thirdparty%2Fbind9.git Allow interrupting dnssec-signzone during signing The signal handler in the isc_loop would wait for all the work to finish before interrupting the signing. Add teardown handlers via isc_loopmgr_teardown() to signal the assignwork() it should stop signing and bail-out early. NOTE: The dnssec-signzone binary still can't be interrupted during zone loading, zone cleaning, nsec(3) chain generation or zone writing. This might get addressed in the future if it becomes a problem. --- diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 3f8367c4779..835dc2737a0 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -1544,6 +1544,13 @@ signapex(void) { } } +static void +abortwork(void *arg) { + UNUSED(arg); + + atomic_store(&shuttingdown, true); +} + /*% * Assigns a node to a worker thread. This is protected by the main task's * lock. @@ -3937,13 +3944,13 @@ main(int argc, char *argv[]) { * processors if possible. */ isc_loopmgr_setup(loopmgr, assignwork, NULL); + isc_loopmgr_teardown(loopmgr, abortwork, NULL); isc_loopmgr_run(loopmgr); if (!atomic_load(&finished)) { fatal("process aborted by user"); } } - atomic_store(&shuttingdown, true); postsign(); TIME_NOW(&sign_finish);