mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-16 04:06:06 +00:00
Backport #10250: fix pvr deadlock
Co-authored-by: kaovilai <11228024+kaovilai@users.noreply.github.com>
This commit is contained in:
co-authored by
kaovilai
parent
843a3b4696
commit
636be631a4
@@ -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