Add missing rwlock calls when access keynode.initial and keynode.managed

    WARNING: ThreadSanitizer: data race
    Write of size 1 at 0x000000000001 by thread T1 (mutexes: write M1):
    #0 dns_keynode_trust lib/dns/keytable.c:836
    #1 keyfetch_done lib/dns/zone.c:10187
    #2 dispatch lib/isc/task.c:1152
    #3 run lib/isc/task.c:1344
    #4 <null> <null>

    Previous read of size 1 at 0x000000000001 by thread T2 (mutexes: read M2):
    #0 keynode_dslist_totext lib/dns/keytable.c:682
    #1 dns_keytable_totext lib/dns/keytable.c:732
    #2 named_server_dumpsecroots bin/named/server.c:11357
    #3 named_control_docommand bin/named/control.c:264
    #4 control_command bin/named/controlconf.c:390
    #5 dispatch lib/isc/task.c:1152
    #6 run lib/isc/task.c:1344
    #7 <null> <null>

    Location is heap block of size 241 at 0x000000000010 allocated by thread T3:
    #0 malloc <null>
    #1 default_memalloc lib/isc/mem.c:713
    #2 mem_get lib/isc/mem.c:622
    #3 mem_allocateunlocked lib/isc/mem.c:1268
    #4 isc___mem_allocate lib/isc/mem.c:1288
    #5 isc__mem_allocate lib/isc/mem.c:2453
    #6 isc___mem_get lib/isc/mem.c:1037
    #7 isc__mem_get lib/isc/mem.c:2432
    #8 new_keynode lib/dns/keytable.c:346
    #9 insert lib/dns/keytable.c:393
    #10 dns_keytable_add lib/dns/keytable.c:421
    #11 process_key bin/named/server.c:955
    #12 load_view_keys bin/named/server.c:983
    #13 configure_view_dnsseckeys bin/named/server.c:1140
    #14 configure_view bin/named/server.c:5371
    #15 load_configuration bin/named/server.c:9110
    #16 loadconfig bin/named/server.c:10310
    #17 named_server_reconfigcommand bin/named/server.c:10693
    #18 named_control_docommand bin/named/control.c:250
    #19 control_command bin/named/controlconf.c:390
    #20 dispatch lib/isc/task.c:1152
    #21 run lib/isc/task.c:1344
    #22 <null> <null>

    Mutex M1 is already destroyed.

    Mutex M2 is already destroyed.

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

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

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

    SUMMARY: ThreadSanitizer: data race lib/dns/keytable.c:836 in dns_keynode_trust

(cherry picked from commit 840cf7ad)
79 jobs for !4207 with 2191-missing-locks-when-accessing-keynode-initial-and-keynode-managed-triggering-tsan-v9_16 in 19 minutes and 33 seconds (queued for 13 seconds)
detached
Status Job ID Name Coverage
  Precheck
passed #1192079
amd64 linux
autoreconf

00:00:19

passed #1192081
amd64 linux
clang-format

00:00:20

passed #1192082
amd64 linux
coccinelle

00:03:28

passed #1192083
amd64 linux
danger

00:00:17

passed #1192080
amd64 linux
misc

00:00:20

 
  Build
passed #1192097
amd64 linux
clang:asan

00:03:52

passed #1192101
amd64 linux
clang:buster:amd64

00:01:56

passed #1192104
amd64 libvirt
clang:freebsd11:amd64

00:01:51

passed #1192105
amd64 libvirt
clang:freebsd12:amd64

00:01:43

passed #1192106
amd64 libvirt
clang:openbsd:amd64

00:04:27

passed #1192099
amd64 linux
clang:tsan

00:02:24

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

00:01:55

passed #1192096
amd64 linux
gcc:asan

00:03:18

passed #1192089
amd64 linux
gcc:buster:amd64

00:01:44

passed #1192085
amd64 linux
gcc:centos6:amd64

00:01:26

passed #1192086
amd64 linux
gcc:centos7:amd64

00:01:30

passed #1192087
amd64 linux
gcc:centos8:amd64

00:01:52

passed #1192095
amd64 linux
gcc:focal:amd64

00:01:31

passed #1192100
amd64 linux
gcc:mutexatomics

00:01:54

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

00:01:37

passed #1192090
amd64 linux
gcc:sid:amd64

00:02:29

passed #1192092
i386 linux
gcc:sid:i386

00:01:34

passed #1192102
amd64 linux
gcc:softhsm2.4

00:01:46

passed #1192103
amd64 linux
gcc:softhsm2.6

00:01:50

passed #1192088
amd64 linux
gcc:stretch:amd64

00:02:06

passed #1192098
amd64 linux
gcc:tsan

00:01:55

passed #1192093
amd64 linux
gcc:tumbleweed:amd64

00:01:47

passed #1192094
amd64 linux
gcc:xenial:amd64

00:01:54

passed #1192108
amd64 windows
msvc:windows:amd64

00:00:54

passed #1192107
amd64 linux
nolibtool:sid:amd64

00:02:39

 
  Unit
passed #1192121
amd64 linux
unit:clang:asan

00:00:52

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

00:00:34

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

00:01:04

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

00:01:02

passed #1192123
amd64 linux
unit:clang:tsan

00:01:32

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

00:00:46

passed #1192120
amd64 linux
unit:gcc:asan

00:00:49

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

00:00:43

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

00:00:37

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

00:00:38

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

00:00:42

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

00:00:38

passed #1192124
amd64 linux
unit:gcc:mutexatomics

00:00:38

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

00:00:35

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

00:00:41

passed #1192126
amd64 linux
unit:gcc:softhsm2.4

00:00:40

passed #1192127
amd64 linux
unit:gcc:softhsm2.6

00:00:37

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

00:00:33

passed #1192122
amd64 linux
unit:gcc:tsan

00:02:00

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

00:00:39

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

00:00:38

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

00:00:51

 
  System
passed #1192143
amd64 linux
system:clang:asan

00:12:33

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

00:10:30

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

00:10:25

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

00:10:07

failed #1192145
amd64 linux allowed to fail
system:clang:tsan

00:16:37

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

00:11:33

passed #1192142
amd64 linux
system:gcc:asan

00:12:45

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

00:11:21

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

00:11:35

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

00:11:16

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

00:11:12

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

00:11:17

passed #1192146
amd64 linux
system:gcc:mutexatomics

00:10:23

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

00:10:11

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

00:11:02

passed #1192148
amd64 linux
system:gcc:softhsm2.4

00:11:11

passed #1192149
amd64 linux
system:gcc:softhsm2.6

00:11:43

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

00:10:28

failed #1192144
amd64 linux allowed to fail
system:gcc:tsan

00:17:00

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

00:11:15

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

00:10:32

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

00:12:53

 
  Docs
passed #1192153
amd64 linux
docs

00:02:22

 
  Postcheck
passed #1192157
amd64 linux
cppcheck

00:00:22

passed #1192154
amd64 linux
flake8

00:00:22

passed #1192155
amd64 linux
pylint

00:00:24

passed #1192156
amd64 linux
scan-build

00:09:02

 
Name Stage Failure
failed
system:clang:tsan System
Running after_script
Running after script...
$ find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
Uploading artifacts for failed job
Uploading artifacts...
untracked: found 1716 files

Uploading artifacts as "archive" to coordinator... ok
id=1192145 responseStatus=201 Created token=Hn9biJQj
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
system:gcc:tsan System
Running after_script
Running after script...
$ find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
Uploading artifacts for failed job
Uploading artifacts...
untracked: found 1675 files

Uploading artifacts as "archive" to coordinator... ok
id=1192144 responseStatus=201 Created token=GZuLYtcL
Cleaning up file based variables
ERROR: Job failed: exit code 1