Browse Source

Merge pull request #21400 from LK4D4/fix_volumes_race

volume/local: fix race in List
David Calavera 9 years ago
parent
commit
2ec1764d45
1 changed files with 2 additions and 0 deletions
  1. 2 0
      volume/local/local.go

+ 2 - 0
volume/local/local.go

@@ -121,9 +121,11 @@ type Root struct {
 // List lists all the volumes
 func (r *Root) List() ([]volume.Volume, error) {
 	var ls []volume.Volume
+	r.m.Lock()
 	for _, v := range r.volumes {
 		ls = append(ls, v)
 	}
+	r.m.Unlock()
 	return ls, nil
 }