1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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>
This commit is contained in:
Anusha Ragunathan 2017-03-16 15:17:11 -07:00
parent d376b18caf
commit 70b76266b5

View file

@ -131,15 +131,6 @@ func (pm *Manager) StateChanged(id string, e libcontainerd.StateInfo) error {
return err 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)) os.RemoveAll(filepath.Join(pm.config.ExecRoot, id))
if p.PropagatedMount != "" { 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 { if restart {
pm.enable(p, c, true) pm.enable(p, c, true)
} }