fix(file): protect Zone.Expired with mutex (#7940)

This commit is contained in:
Ville Vesilehto
2026-03-16 23:08:03 +02:00
committed by GitHub
parent 30ab93b5be
commit 5a63eb61a3
2 changed files with 9 additions and 1 deletions

View File

@@ -140,7 +140,9 @@ Restart:
if !retryActive { if !retryActive {
break break
} }
z.Lock()
z.Expired = true z.Expired = true
z.Unlock()
case <-retryTicker.C: case <-retryTicker.C:
if !retryActive { if !retryActive {

View File

@@ -56,9 +56,12 @@ func NewZone(name, file string) *Zone {
func (z *Zone) Copy() *Zone { func (z *Zone) Copy() *Zone {
z1 := NewZone(z.origin, z.file) z1 := NewZone(z.origin, z.file)
z1.TransferFrom = z.TransferFrom z1.TransferFrom = z.TransferFrom
z1.Expired = z.Expired
z.RLock()
z1.Expired = z.Expired
z1.Apex = z.Apex z1.Apex = z.Apex
z.RUnlock()
return z1 return z1
} }
@@ -66,7 +69,10 @@ func (z *Zone) Copy() *Zone {
func (z *Zone) CopyWithoutApex() *Zone { func (z *Zone) CopyWithoutApex() *Zone {
z1 := NewZone(z.origin, z.file) z1 := NewZone(z.origin, z.file)
z1.TransferFrom = z.TransferFrom z1.TransferFrom = z.TransferFrom
z.RLock()
z1.Expired = z.Expired z1.Expired = z.Expired
z.RUnlock()
return z1 return z1
} }