From a69ffb5953f3058cb109adcb88f49a42edece5f6 Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Mon, 28 Nov 2022 11:31:01 -0800 Subject: [PATCH] config: acquire write lock when overwriting the map Previously, by mistake we were acquiring a read lock even though we do write operations in `PurgeZoneConfigCache`. Release note: None --- pkg/config/system.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/config/system.go b/pkg/config/system.go index 29e256ca9b30..0fc410029746 100644 --- a/pkg/config/system.go +++ b/pkg/config/system.go @@ -408,8 +408,8 @@ func (s *SystemConfig) GetZoneConfigForObject( // requested. Note, this function is only intended to be called during test // execution, such as logic tests. func (s *SystemConfig) PurgeZoneConfigCache() { - s.mu.RLock() - defer s.mu.RUnlock() + s.mu.Lock() + defer s.mu.Unlock() if len(s.mu.zoneCache) != 0 { s.mu.zoneCache = map[ObjectID]zoneEntry{} }