mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
overlay: fix data race in map access
Signed-off-by: Alexander Morozov <lk4d4math@gmail.com>
This commit is contained in:
parent
0229451f3d
commit
09da6a6f59
1 changed files with 4 additions and 4 deletions
|
@ -664,17 +664,17 @@ func (d *driver) deleteNetwork(nid string) {
|
||||||
|
|
||||||
func (d *driver) network(nid string) *network {
|
func (d *driver) network(nid string) *network {
|
||||||
d.Lock()
|
d.Lock()
|
||||||
networks := d.networks
|
n, ok := d.networks[nid]
|
||||||
d.Unlock()
|
d.Unlock()
|
||||||
|
|
||||||
n, ok := networks[nid]
|
|
||||||
if !ok {
|
if !ok {
|
||||||
n = d.getNetworkFromStore(nid)
|
n = d.getNetworkFromStore(nid)
|
||||||
if n != nil {
|
if n != nil {
|
||||||
n.driver = d
|
n.driver = d
|
||||||
n.endpoints = endpointTable{}
|
n.endpoints = endpointTable{}
|
||||||
n.once = &sync.Once{}
|
n.once = &sync.Once{}
|
||||||
networks[nid] = n
|
d.Lock()
|
||||||
|
d.networks[nid] = n
|
||||||
|
d.Unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue