[v9_18] Call dns_resolver_createfetch() asynchronously in zone_refreshkeys()
Because dns_resolver_createfetch() locks the view, it was necessary to unlock the zone in zone_refreshkeys() before calling it in order to maintain the lock order, and relock afterward. this permitted a race with dns_zone_synckeyzone().
This commit moves the call to dns_resolver_createfetch() into a separate function which is called asynchronously after the zone has been unlocked.
The keyfetch object now attaches to the zone to ensure that it won't be shut down before the asynchronous call completes.
This necessitated refactoring dns_zone_detach() so it always runs unlocked. For managed zones it schedules zone_shutdown() to run asynchronously; for unmanaged zones there is no task.
Backport of !6971 (merged)
Closes #3617 (closed)
Edited by Michał Kępień