Resolve TSAN data race in zone_maintenance

Fix race between zone_maintenance and dns_zone_notifyreceive functions,
zone_maintenance was attempting to read a zone flag calling
DNS_ZONE_FLAG(zone, flag) while dns_zone_notifyreceive was updating
a flag in the same zone calling DNS_ZONE_SETFLAG(zone, ...).

The code reading the flag in zone_maintenance was not protected by the
zone's lock, to avoid a race the zone's lock is now being acquired
before an attempt to read the zone flag is made.
70 jobs for !4864 with 2582-threadsanitizer-data-race-lib-dns-zone-c-10272-7-in-zone_maintenance in 1 minute and 3 seconds (queued for 12 seconds)
latest detached
Status Job ID Name Coverage
  Autoconf
passed #1622859
linux amd64
autoreconf

00:00:17

 
  Precheck
passed #1622861
linux amd64
clang-format

00:00:17

canceled #1622862
linux amd64
coccinelle

00:00:57

passed #1622863
linux amd64
danger

00:00:15

passed #1622860
linux amd64
misc

00:00:21

canceled #1622864
linux amd64
tarball-create

00:00:38

 
  Build
canceled #1622875
linux amd64
clang:asan

00:00:30

canceled #1622879
linux amd64
clang:buster:amd64

00:00:39

canceled #1622882
amd64 libvirt
clang:freebsd11:amd64

00:00:27

canceled #1622883
amd64 libvirt
clang:freebsd12:amd64

00:00:39

canceled #1622884
amd64 libvirt
clang:openbsd:amd64

00:00:37

canceled #1622877
linux amd64
clang:tsan

00:00:30

canceled #1622865
linux amd64
gcc:alpine3.13:amd64

00:00:37

canceled #1622874
linux amd64
gcc:asan

00:00:30

canceled #1622869
linux amd64
gcc:buster:amd64

00:00:31

canceled #1622866
linux amd64
gcc:centos7:amd64

00:00:35

canceled #1622867
linux amd64
gcc:centos8:amd64

00:00:34

canceled #1622873
linux amd64
gcc:focal:amd64

00:00:30

canceled #1622878
linux amd64
gcc:mutexatomics

00:00:28

canceled #1622871
linux amd64
gcc:out-of-tree

00:00:30

canceled #1622870
linux amd64
gcc:sid:amd64

00:00:31

canceled #1622880
linux amd64
gcc:softhsm2.4

00:00:39

canceled #1622881
linux amd64
gcc:softhsm2.6

00:00:38

canceled #1622868
linux amd64
gcc:stretch:amd64

00:00:34

canceled #1622876
linux amd64
gcc:tsan

00:00:30

canceled #1622872
linux amd64
gcc:tumbleweed:amd64

00:00:30

passed #1622885
amd64 windows
msvc:windows:amd64

00:00:50

 
  Unit
canceled #1622895
linux amd64
unit:clang:asan

canceled #1622899
linux amd64
unit:clang:buster:amd64

canceled #1622902
amd64 libvirt
unit:clang:freebsd11:amd64

canceled #1622903
amd64 libvirt
unit:clang:freebsd12:amd64

canceled #1622904
amd64 libvirt
unit:clang:openbsd:amd64

canceled #1622897
linux amd64
unit:clang:tsan

canceled #1622886
linux amd64
unit:gcc:alpine3.13:amd64

canceled #1622894
linux amd64
unit:gcc:asan

canceled #1622890
linux amd64
unit:gcc:buster:amd64

canceled #1622887
linux amd64
unit:gcc:centos7:amd64

canceled #1622888
linux amd64
unit:gcc:centos8:amd64

canceled #1622893
linux amd64
unit:gcc:focal:amd64

canceled #1622898
linux amd64
unit:gcc:mutexatomics

canceled #1622891
linux amd64
unit:gcc:sid:amd64

canceled #1622900
linux amd64
unit:gcc:softhsm2.4

canceled #1622901
linux amd64
unit:gcc:softhsm2.6

canceled #1622889
linux amd64
unit:gcc:stretch:amd64

canceled #1622896
linux amd64
unit:gcc:tsan

canceled #1622892
linux amd64
unit:gcc:tumbleweed:amd64

 
  System
canceled #1622914
linux amd64
system:clang:asan

canceled #1622918
linux amd64
system:clang:buster:amd64

canceled #1622921
amd64 libvirt
system:clang:freebsd11:amd64

canceled #1622922
amd64 libvirt
system:clang:freebsd12:amd64

canceled #1622916
linux amd64
system:clang:tsan

canceled #1622905
linux amd64
system:gcc:alpine3.13:amd64

canceled #1622913
linux amd64
system:gcc:asan

canceled #1622909
linux amd64
system:gcc:buster:amd64

canceled #1622906
linux amd64
system:gcc:centos7:amd64

canceled #1622907
linux amd64
system:gcc:centos8:amd64

canceled #1622912
linux amd64
system:gcc:focal:amd64

canceled #1622917
linux amd64
system:gcc:mutexatomics

canceled #1622910
linux amd64
system:gcc:sid:amd64

canceled #1622919
linux amd64
system:gcc:softhsm2.4

canceled #1622920
linux amd64
system:gcc:softhsm2.6

canceled #1622908
linux amd64
system:gcc:stretch:amd64

canceled #1622915
linux amd64
system:gcc:tsan

canceled #1622911
linux amd64
system:gcc:tumbleweed:amd64

 
  Docs
canceled #1622923
linux amd64
docs

00:00:32

 
  Postcheck
canceled #1622927
linux amd64
cppcheck

00:00:32

passed #1622924
linux amd64
flake8

00:00:21

canceled #1622928
linux amd64
gcov

passed #1622925
linux amd64
pylint

00:00:25

canceled #1622926
linux amd64
scan-build

00:00:30