Hold qid->lock when calling deref_portentry() as

socket_search() need portentry to be unchanging.

    WARNING: ThreadSanitizer: data race
    Write of size 8 at 0x000000000001 by thread T1 (mutexes: write M1):
    #0 deref_portentry lib/dns/dispatch.c:630
    #1 deactivate_dispsocket lib/dns/dispatch.c:861
    #2 udp_recv lib/dns/dispatch.c:1105
    #3 udp_exrecv lib/dns/dispatch.c:1028
    #4 dispatch lib/isc/task.c:1152
    #5 run lib/isc/task.c:1344
    #6 <null> <null>

    Previous read of size 8 at 0x000000000001 by thread T2 (mutexes: write M1, write M2):
    #0 socket_search lib/dns/dispatch.c:661
    #1 get_dispsocket lib/dns/dispatch.c:744
    #2 dns_dispatch_addresponse lib/dns/dispatch.c:3120
    #3 resquery_send lib/dns/resolver.c:2467
    #4 fctx_query lib/dns/resolver.c:2217
    #5 fctx_try lib/dns/resolver.c:4245
    #6 fctx_timeout lib/dns/resolver.c:4570
    #7 dispatch lib/isc/task.c:1152
    #8 run lib/isc/task.c:1344
    #9 <null> <null>

(cherry picked from commit 5c253c41)
79 jobs for !4302 with 2226-tsan-error-in-dispatch-c-v9_16 in 23 minutes and 21 seconds (queued for 13 minutes and 27 seconds)
detached
Status Job ID Name Coverage
  Precheck
passed #1246167
amd64 linux
autoreconf

00:00:14

passed #1246169
amd64 linux
clang-format

00:00:16

passed #1246170
amd64 linux
coccinelle

00:03:35

passed #1246171
amd64 linux
danger

00:00:12

passed #1246168
amd64 linux
misc

00:00:13

 
  Build
passed #1246185
amd64 linux
clang:asan

00:03:56

passed #1246189
amd64 linux
clang:buster:amd64

00:01:56

passed #1246192
amd64 libvirt
clang:freebsd11:amd64

00:01:46

passed #1246193
amd64 libvirt
clang:freebsd12:amd64

00:01:45

passed #1246194
amd64 libvirt
clang:openbsd:amd64

00:03:50

passed #1246187
amd64 linux
clang:tsan

00:02:20

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

00:01:41

passed #1246184
amd64 linux
gcc:asan

00:03:31

passed #1246177
amd64 linux
gcc:buster:amd64

00:01:37

passed #1246173
amd64 linux
gcc:centos6:amd64

00:01:14

passed #1246174
amd64 linux
gcc:centos7:amd64

00:01:33

passed #1246175
amd64 linux
gcc:centos8:amd64

00:01:36

passed #1246183
amd64 linux
gcc:focal:amd64

00:01:36

passed #1246188
amd64 linux
gcc:mutexatomics

00:01:37

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

00:01:25

passed #1246178
amd64 linux
gcc:sid:amd64

00:02:05

passed #1246180
i386 linux
gcc:sid:i386

00:01:35

passed #1246190
amd64 linux
gcc:softhsm2.4

00:01:42

passed #1246191
amd64 linux
gcc:softhsm2.6

00:01:43

passed #1246176
amd64 linux
gcc:stretch:amd64

00:01:49

passed #1246186
amd64 linux
gcc:tsan

00:02:03

passed #1246181
amd64 linux
gcc:tumbleweed:amd64

00:01:36

passed #1246182
amd64 linux
gcc:xenial:amd64

00:01:52

passed #1246196
amd64 windows
msvc:windows:amd64

00:02:16

passed #1246195
amd64 linux
nolibtool:sid:amd64

00:01:58

 
  Unit
passed #1246209
amd64 linux
unit:clang:asan

00:00:59

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

00:00:37

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

00:00:59

failed #1246217
amd64 libvirt
unit:clang:freebsd12:amd64

00:05:57

passed #1246211
amd64 linux
unit:clang:tsan

00:01:31

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

00:00:45

passed #1246208
amd64 linux
unit:gcc:asan

00:00:53

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

00:00:36

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

00:00:36

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

00:00:37

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

00:00:38

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

00:00:36

passed #1246212
amd64 linux
unit:gcc:mutexatomics

00:00:34

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

00:00:36

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

00:00:44

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

00:00:37

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

00:00:36

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

00:00:36

passed #1246210
amd64 linux
unit:gcc:tsan

00:01:54

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

00:00:36

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

00:00:38

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

00:00:50

 
  System
passed #1246231
amd64 linux
system:clang:asan

00:12:05

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

00:10:40

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

00:10:36

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

00:10:19

passed #1246233
amd64 linux
system:clang:tsan

00:14:45

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

00:11:43

passed #1246230
amd64 linux
system:gcc:asan

00:12:16

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

00:11:13

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

00:11:34

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

00:11:22

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

00:11:55

failed #1246229
amd64 linux
system:gcc:focal:amd64

00:11:12

failed #1246234
amd64 linux
system:gcc:mutexatomics

00:11:25

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

00:11:22

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

00:10:04

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

00:10:44

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

00:10:52

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

00:10:36

passed #1246232
amd64 linux
system:gcc:tsan

00:15:08

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

00:10:33

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

00:10:26

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

00:11:22

 
  Docs
passed #1246241
amd64 linux
docs

00:01:58

 
  Postcheck
passed #1246245
amd64 linux
cppcheck

00:00:20

passed #1246242
amd64 linux
flake8

00:00:18

passed #1246243
amd64 linux
pylint

00:00:22

passed #1246244
amd64 linux
scan-build

00:08:54

 
Name Stage Failure
failed
system:gcc:mutexatomics System
I:The following system tests failed:
I: inline
make: *** [Makefile:491: test] Error 1
Uploading artifacts for failed job
Uploading artifacts...
untracked: found 1925 files

Uploading artifacts as "archive" to coordinator... ok
id=1246234 responseStatus=201 Created token=qRnsFsf7
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
system:gcc:focal:amd64 System
I:The following system tests failed:
I: inline
make: *** [Makefile:491: test] Error 1
Uploading artifacts for failed job
Uploading artifacts...
untracked: found 1921 files

Uploading artifacts as "archive" to coordinator... ok
id=1246229 responseStatus=201 Created token=UWMs-r58
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
unit:clang:freebsd12:amd64 Unit
Generating kyua_html/index.html
Uploading artifacts for failed job
Uploading artifacts...
Runtime platform
arch=amd64 os=freebsd pid=1825 revision=ece86343 version=13.5.0
untracked: found 1405 files

Uploading artifacts as "archive" to coordinator... ok
id=1246217 responseStatus=201 Created token=4xdFztCG
Cleaning up file based variables
Unsupported run stage 'cleanup_file_variables'
ERROR: Job failed: exit status 1