Update disk_location_ec.go (#6359)

Add lock for l.ecVolumes
This commit is contained in:
coffeecloudgit 2024-12-16 14:05:47 +08:00 committed by GitHub
parent 7eb8257126
commit c531e2eb0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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