From 5a63eb61a379d76ef01aef424bc91c00c9c9998a Mon Sep 17 00:00:00 2001 From: Ville Vesilehto Date: Mon, 16 Mar 2026 23:08:03 +0200 Subject: [PATCH] fix(file): protect Zone.Expired with mutex (#7940) --- plugin/file/secondary.go | 2 ++ plugin/file/zone.go | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugin/file/secondary.go b/plugin/file/secondary.go index ef85d5b7c..43be88bfa 100644 --- a/plugin/file/secondary.go +++ b/plugin/file/secondary.go @@ -140,7 +140,9 @@ Restart: if !retryActive { break } + z.Lock() z.Expired = true + z.Unlock() case <-retryTicker.C: if !retryActive { diff --git a/plugin/file/zone.go b/plugin/file/zone.go index 4cb1a1f6b..53a53ee41 100644 --- a/plugin/file/zone.go +++ b/plugin/file/zone.go @@ -56,9 +56,12 @@ func NewZone(name, file string) *Zone { func (z *Zone) Copy() *Zone { z1 := NewZone(z.origin, z.file) z1.TransferFrom = z.TransferFrom - z1.Expired = z.Expired + z.RLock() + z1.Expired = z.Expired z1.Apex = z.Apex + z.RUnlock() + return z1 } @@ -66,7 +69,10 @@ func (z *Zone) Copy() *Zone { func (z *Zone) CopyWithoutApex() *Zone { z1 := NewZone(z.origin, z.file) z1.TransferFrom = z.TransferFrom + + z.RLock() z1.Expired = z.Expired + z.RUnlock() return z1 }