Skip to content

Commit 84b8f18

Browse files
Concurrentmap Iteration
1 parent a789839 commit 84b8f18

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/volume/plugins.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,12 @@ func (pm *VolumePluginMgr) FindPluginBySpec(spec *Spec) (VolumePlugin, error) {
653653
}
654654
}
655655

656+
pm.mutex.RUnlock()
657+
pm.mutex.Lock()
656658
pm.refreshProbedPlugins()
659+
pm.mutex.Unlock()
660+
pm.mutex.RLock()
661+
657662
for _, plugin := range pm.probedPlugins {
658663
if plugin.CanSupport(spec) {
659664
match = plugin
@@ -681,7 +686,11 @@ func (pm *VolumePluginMgr) FindPluginByName(name string) (VolumePlugin, error) {
681686
match = v
682687
}
683688

689+
pm.mutex.RUnlock()
690+
pm.mutex.Lock()
684691
pm.refreshProbedPlugins()
692+
pm.mutex.Unlock()
693+
pm.mutex.RLock()
685694
if plugin, found := pm.probedPlugins[name]; found {
686695
if match != nil {
687696
return nil, fmt.Errorf("multiple volume plugins matched: %s and %s", match.GetPluginName(), plugin.GetPluginName())

0 commit comments

Comments
 (0)