Browse code

verifyVolumesInfo needs a container lock

It operates on containers that have already been registered on the
daemon, and are visible to other goroutines.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>

Fabio Kung authored on 2017/03/28 01:04:52
Showing 1 changed files
... ...
@@ -137,6 +137,9 @@ func migrateVolume(id, vfs string) error {
137 137
 // verifyVolumesInfo ports volumes configured for the containers pre docker 1.7.
138 138
 // It reads the container configuration and creates valid mount points for the old volumes.
139 139
 func (daemon *Daemon) verifyVolumesInfo(container *container.Container) error {
140
+	container.Lock()
141
+	defer container.Unlock()
142
+
140 143
 	// Inspect old structures only when we're upgrading from old versions
141 144
 	// to versions >= 1.7 and the MountPoints has not been populated with volumes data.
142 145
 	type volumes struct {