Wait to unmount propagatedmount before marking plugin as disabled.

TestPluginTrustedInstall revealed a race in the plugin shutdown logic,
where the exit channel signal was sent even before the propagated mounts
were unmounted. If the same plugin was enabled, it would try to setup
propagated mounts *before* it was unmounted resulting in errors.

This change fixes the behavior by waiting until the unmount completes on
disable before marking the plugin as disabled.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: 70b76266b586d193c333aa37dcda031f3d89f108
Component: engine
This commit is contained in:
Anusha Ragunathan
2017-03-16 15:25:41 -07:00
parent bdbc2fdcab
commit 48ffb5882e
+8 -9
View File
@@ -131,15 +131,6 @@ func (pm *Manager) StateChanged(id string, e libcontainerd.StateInfo) error {
return err
}
pm.mu.RLock()
c := pm.cMap[p]
if c.exitChan != nil {
close(c.exitChan)
}
restart := c.restart
pm.mu.RUnlock()
os.RemoveAll(filepath.Join(pm.config.ExecRoot, id))
if p.PropagatedMount != "" {
@@ -152,6 +143,14 @@ func (pm *Manager) StateChanged(id string, e libcontainerd.StateInfo) error {
}
}
pm.mu.RLock()
c := pm.cMap[p]
if c.exitChan != nil {
close(c.exitChan)
}
restart := c.restart
pm.mu.RUnlock()
if restart {
pm.enable(p, c, true)
}