diff options
author | 2019-06-29 22:22:34 +0100 | |
---|---|---|
committer | 2019-06-30 05:22:34 +0800 | |
commit | 3a0c7c61532db7f8e4ce79f99129201a79729525 (patch) | |
tree | fab82dba453c4676a796f3b2e8f02b3573a1466f /plugin/file/lookup.go | |
parent | 2c1f5009be5fa0074b1e204f1c2906d6d1f8ea68 (diff) | |
download | coredns-3a0c7c61532db7f8e4ce79f99129201a79729525.tar.gz coredns-3a0c7c61532db7f8e4ce79f99129201a79729525.tar.zst coredns-3a0c7c61532db7f8e4ce79f99129201a79729525.zip |
plugin/file: load secondary zones lazily on startup (#2944)
This fixes a long standing bug:
fixes: #1609
Load secondary zones in a go-routine; this required another mutex to
protect some fields; I think those were needded anyway because a
transfer can also happen when we're running; we just didn't have a test
for that situation.
The test had to be changed to wait for the transfer to happen at this is
async now.
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/file/lookup.go')
-rw-r--r-- | plugin/file/lookup.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/plugin/file/lookup.go b/plugin/file/lookup.go index 52b78114c..3a72a6163 100644 --- a/plugin/file/lookup.go +++ b/plugin/file/lookup.go @@ -44,7 +44,9 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string) // If z is a secondary zone we might not have transferred it, meaning we have // all zone context setup, except the actual record. This means (for one thing) the apex // is empty and we don't have a SOA record. + z.apexMu.RLock() soa := z.Apex.SOA + z.apexMu.RUnlock() if soa == nil { return nil, nil, nil, ServerFailure } |