Address lock-order-inversion

    WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
    Cycle in lock order graph: M1 (0x000000000001) => M2 (0x000000000002) => M1

    Mutex M2 acquired here while holding mutex M1 in thread T1:
    #0 pthread_rwlock_wrlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:52:4
    #2 zone_postload lib/dns/zone.c:5101:2
    #3 receive_secure_db lib/dns/zone.c:16206:11
    #4 dispatch lib/isc/task.c:1152:7
    #5 run lib/isc/task.c:1344:2

    Mutex M1 previously acquired by the same thread here:
    #0 pthread_mutex_lock <null>
    #1 receive_secure_db lib/dns/zone.c:16204:2
    #2 dispatch lib/isc/task.c:1152:7
    #3 run lib/isc/task.c:1344:2

    Mutex M1 acquired here while holding mutex M2 in thread T1:
    #0 pthread_mutex_lock <null>
    #1 get_raw_serial lib/dns/zone.c:2518:2
    #2 zone_gotwritehandle lib/dns/zone.c:2559:4
    #3 dispatch lib/isc/task.c:1152:7
    #4 run lib/isc/task.c:1344:2

    Mutex M2 previously acquired by the same thread here:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 zone_gotwritehandle lib/dns/zone.c:2552:2
    #3 dispatch lib/isc/task.c:1152:7
    #4 run lib/isc/task.c:1344:2

    Thread T1 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_taskmgr_create lib/isc/task.c:1434:3
    #3 create_managers bin/named/main.c:915:11
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) in pthread_rwlock_wrlock

(cherry picked from commit 10908766)
80 jobs for !4164 with 2157-threadsanitizer-lock-order-inversion-potential-deadlock-in-pthread_rwlock_wrlock-v9_11 in 22 minutes and 26 seconds (queued for 32 seconds)
latest detached
Status Job ID Name Coverage
  Precheck
passed #1174470
amd64 linux
autoreconf

00:00:15

passed #1174472
amd64 linux
clang-format

00:00:07

passed #1174473
amd64 linux
coccinelle

00:00:58

passed #1174550
linux amd64
danger

00:00:12

passed #1174471
amd64 linux
misc

00:00:14

failed #1174474
amd64 linux
danger

00:00:20

 
  Build
passed #1174489
amd64 linux
clang:asan

00:04:30

passed #1174493
amd64 linux
clang:buster:amd64

00:02:10

passed #1174495
amd64 libvirt
clang:freebsd11:amd64

00:01:55

passed #1174496
amd64 libvirt
clang:freebsd12:amd64

00:01:46

passed #1174497
amd64 libvirt
clang:openbsd:amd64

00:04:04

passed #1174491
amd64 linux
clang:tsan

00:02:28

passed #1174475
amd64 linux
gcc:alpine3.12:amd64

00:01:46

passed #1174488
amd64 linux
gcc:asan

00:03:30

passed #1174480
amd64 linux
gcc:buster:amd64

00:01:39

passed #1174476
amd64 linux
gcc:centos6:amd64

00:01:30

passed #1174477
amd64 linux
gcc:centos7:amd64

00:01:40

passed #1174478
amd64 linux
gcc:centos8:amd64

00:01:45

passed #1174485
amd64 linux
gcc:fedora32:amd64

00:01:47

passed #1174487
amd64 linux
gcc:focal:amd64

00:01:46

passed #1174492
amd64 linux
gcc:mutexatomics

00:01:46

passed #1174482
amd64 linux
gcc:out-of-tree

00:01:42

passed #1174494
amd64 linux
gcc:pkcs11

00:01:45

passed #1174481
amd64 linux
gcc:sid:amd64

00:02:14

passed #1174483
i386 linux
gcc:sid:i386

00:01:51

passed #1174479
amd64 linux
gcc:stretch:amd64

00:01:57

passed #1174490
amd64 linux
gcc:tsan

00:02:03

passed #1174484
amd64 linux
gcc:tumbleweed:amd64

00:01:47

passed #1174486
amd64 linux
gcc:xenial:amd64

00:01:51

passed #1174499
amd64 windows
msvc:windows:amd64

00:00:58

passed #1174498
amd64 linux
nolibtool:sid:amd64

00:02:20

 
  Unit
passed #1174513
amd64 linux
unit:clang:asan

00:01:12

passed #1174517
amd64 linux
unit:clang:buster:amd64

00:00:30

passed #1174519
amd64 libvirt
unit:clang:freebsd11:amd64

00:01:08

passed #1174520
amd64 libvirt
unit:clang:freebsd12:amd64

00:00:54

passed #1174515
amd64 linux
unit:clang:tsan

00:04:27

passed #1174500
amd64 linux
unit:gcc:alpine3.12:amd64

00:00:32

passed #1174512
amd64 linux
unit:gcc:asan

00:01:10

passed #1174505
amd64 linux
unit:gcc:buster:amd64

00:00:31

passed #1174501
amd64 linux
unit:gcc:centos6:amd64

00:00:42

passed #1174502
amd64 linux
unit:gcc:centos7:amd64

00:00:33

passed #1174503
amd64 linux
unit:gcc:centos8:amd64

00:00:31

passed #1174509
amd64 linux
unit:gcc:fedora32:amd64

00:00:31

passed #1174511
amd64 linux
unit:gcc:focal:amd64

00:00:32

passed #1174516
amd64 linux
unit:gcc:mutexatomics

00:00:32

passed #1174518
amd64 linux
unit:gcc:pkcs11

00:00:36

passed #1174506
amd64 linux
unit:gcc:sid:amd64

00:00:29

passed #1174507
i386 linux
unit:gcc:sid:i386

00:00:31

passed #1174504
amd64 linux
unit:gcc:stretch:amd64

00:00:31

passed #1174514
amd64 linux
unit:gcc:tsan

00:04:56

passed #1174508
amd64 linux
unit:gcc:tumbleweed:amd64

00:00:31

passed #1174510
amd64 linux
unit:gcc:xenial:amd64

00:00:32

passed #1174521
amd64 linux
unit:nolibtool:sid:amd64

00:00:48

 
  System
passed #1174535
amd64 linux
system:clang:asan

00:09:26

passed #1174539
amd64 linux
system:clang:buster:amd64

00:07:15

passed #1174541
amd64 libvirt
system:clang:freebsd11:amd64

00:08:24

passed #1174542
amd64 libvirt
system:clang:freebsd12:amd64

00:09:22

passed #1174537
amd64 linux
system:clang:tsan

00:11:10

passed #1174522
amd64 linux
system:gcc:alpine3.12:amd64

00:07:21

passed #1174534
amd64 linux
system:gcc:asan

00:09:44

passed #1174527
amd64 linux
system:gcc:buster:amd64

00:07:10

passed #1174523
amd64 linux
system:gcc:centos6:amd64

00:07:18

passed #1174524
amd64 linux
system:gcc:centos7:amd64

00:07:12

passed #1174525
amd64 linux
system:gcc:centos8:amd64

00:07:10

passed #1174531
amd64 linux
system:gcc:fedora32:amd64

00:07:10

passed #1174533
amd64 linux
system:gcc:focal:amd64

00:07:10

passed #1174538
amd64 linux
system:gcc:mutexatomics

00:07:21

passed #1174540
amd64 linux
system:gcc:pkcs11

00:08:04

passed #1174528
amd64 linux
system:gcc:sid:amd64

00:07:04

passed #1174529
i386 linux
system:gcc:sid:i386

00:07:18

passed #1174526
amd64 linux
system:gcc:stretch:amd64

00:07:13

passed #1174536
amd64 linux
system:gcc:tsan

00:12:31

passed #1174530
amd64 linux
system:gcc:tumbleweed:amd64

00:07:10

passed #1174532
amd64 linux
system:gcc:xenial:amd64

00:07:00

passed #1174543
amd64 linux
system:nolibtool:sid:amd64

00:07:16

 
  Docs
passed #1174544
amd64 linux
docs

00:00:26

 
  Postcheck
passed #1174548
amd64 linux
cppcheck

00:00:25

passed #1174545
amd64 linux
flake8

00:00:20

passed #1174546
amd64 linux
pylint

00:00:23

passed #1174547
amd64 linux
scan-build

00:10:05