From c531e2eb0e594ef35971ed3dcb4918d4447cabaf Mon Sep 17 00:00:00 2001 From: coffeecloudgit <168399738+coffeecloudgit@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:05:47 +0800 Subject: [PATCH] Update disk_location_ec.go (#6359) Add lock for l.ecVolumes --- weed/storage/disk_location_ec.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go index bb5738897..ac8d52fb7 100644 --- a/weed/storage/disk_location_ec.go +++ b/weed/storage/disk_location_ec.go @@ -195,6 +195,10 @@ func (l *DiskLocation) loadAllEcShards() (err error) { } func (l *DiskLocation) deleteEcVolumeById(vid needle.VolumeId) (e error) { + // Add write lock since we're modifying the ecVolumes map + l.ecVolumesLock.Lock() + defer l.ecVolumesLock.Unlock() + ecVolume, ok := l.ecVolumes[vid] if !ok { return