mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
volume/store: fix couple of races with accessing maps
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
parent
d33480474f
commit
e6d87c0706
1 changed files with 6 additions and 1 deletions
|
@ -267,7 +267,9 @@ func (s *VolumeStore) create(name, driverName string, opts, labels map[string]st
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
s.globalLock.Lock()
|
||||||
s.labels[name] = labels
|
s.labels[name] = labels
|
||||||
|
s.globalLock.Unlock()
|
||||||
|
|
||||||
if s.db != nil {
|
if s.db != nil {
|
||||||
metadata := &volumeMetadata{
|
metadata := &volumeMetadata{
|
||||||
|
@ -362,7 +364,10 @@ func (s *VolumeStore) getVolume(name string) (volume.Volume, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.Debugf("Getting volume reference for name: %s", name)
|
logrus.Debugf("Getting volume reference for name: %s", name)
|
||||||
if v, exists := s.names[name]; exists {
|
s.globalLock.Lock()
|
||||||
|
v, exists := s.names[name]
|
||||||
|
s.globalLock.Unlock()
|
||||||
|
if exists {
|
||||||
vd, err := volumedrivers.GetDriver(v.DriverName())
|
vd, err := volumedrivers.GetDriver(v.DriverName())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue