Improve locking in zone_maintenance()

Tony Finch requested to merge 4135-data-race-zone-refreshkeytimer into bind-9.16

Thread sanitizer reported a data race involving a zone timer, because zone_maintenance() was not careful about consistently locking the zone when accessing its timers. Fix this by adding a helper function that locks the zone while checking one of its timers, and adjust zone_maintenance() to use it where appropriate, and to access other zone properties under a lock.

Closes #4135 (closed)

Merge request reports