1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #29895 from cpuguy83/cherry_pick_29893

[1.13.x] Fix race accessing plugin storage map
This commit is contained in:
Sebastiaan van Stijn 2017-01-07 13:03:34 +01:00 committed by GitHub
commit 1dded0dee4

View file

@ -221,6 +221,10 @@ func loadWithRetry(name string, retry bool) (*Plugin, error) {
}
storage.Lock()
if pl, exists := storage.plugins[name]; exists {
storage.Unlock()
return pl, pl.activate()
}
storage.plugins[name] = pl
storage.Unlock()
@ -298,7 +302,10 @@ func GetAll(imp string) ([]*Plugin, error) {
chPl := make(chan *plLoad, len(pluginNames))
var wg sync.WaitGroup
for _, name := range pluginNames {
if pl, ok := storage.plugins[name]; ok {
storage.Lock()
pl, ok := storage.plugins[name]
storage.Unlock()
if ok {
chPl <- &plLoad{pl, nil}
continue
}