mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-16 20:26:06 +00:00
Merge pull request #10262 from velero-io/copilot/backport-10250-again
[release-1.17] Backport #10250: Fix pod volume restore deadlock
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Fix a potential deadlock when resultsLock is held by the informer but blocked on resChan because the early quit of RestorePodVolumes
|
||||
@@ -106,9 +106,9 @@ func newRestorer(
|
||||
|
||||
if pvr.Status.Phase == velerov1api.PodVolumeRestorePhaseCompleted || pvr.Status.Phase == velerov1api.PodVolumeRestorePhaseFailed || pvr.Status.Phase == velerov1api.PodVolumeRestorePhaseCanceled {
|
||||
r.resultsLock.Lock()
|
||||
defer r.resultsLock.Unlock()
|
||||
|
||||
resChan, ok := r.results[resultsKey(pvr.Spec.Pod.Namespace, pvr.Spec.Pod.Name)]
|
||||
r.resultsLock.Unlock()
|
||||
|
||||
if !ok {
|
||||
log.Errorf("No results channel found for pod %s/%s to send pod volume restore %s/%s on", pvr.Spec.Pod.Namespace, pvr.Spec.Pod.Name, pvr.Namespace, pvr.Name)
|
||||
return
|
||||
@@ -147,7 +147,7 @@ func (r *restorer) RestorePodVolumes(data RestoreData, tracker *volume.RestoreVo
|
||||
r.repoLocker.Lock(repo.Name)
|
||||
defer r.repoLocker.Unlock(repo.Name)
|
||||
|
||||
resultsChan := make(chan *velerov1api.PodVolumeRestore)
|
||||
resultsChan := make(chan *velerov1api.PodVolumeRestore, len(volumesToRestore))
|
||||
|
||||
r.resultsLock.Lock()
|
||||
r.results[resultsKey(data.Pod.Namespace, data.Pod.Name)] = resultsChan
|
||||
|
||||
Reference in New Issue
Block a user