mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-10-22 06:13:00 +00:00
BackupVolumesInformation lives on the shared backupRequest and every ItemBlock worker goroutine reaches pvcPvMap.insert via addVolumeInfo whenever it backs up a PersistentVolume. The map had no synchronization, so with --item-block-worker-count greater than 1 and a backup containing multiple PVs, two workers could write the map concurrently. That is an unrecoverable Go runtime fatal error, which kills the Velero server and abandons the in-flight backup. Guard pvcPvMap.data with an RWMutex so insert and retrieve are safe for concurrent use, and guard the lazy initialization in InsertPVMap so concurrent callers cannot each install their own map and lose entries. The restore-side RestoreVolumeInfoTracker already locks around pvPvc.insert. This brings the backup path in line. Adds a regression test that reproduces the crash under -race without the fix. Fixes #10634 Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>