daemon.cleanupContainer: nullify container RWLayer upon release

ReleaseRWLayer can and should only be called once (unless it returns
an error), but might be called twice in case of a failure from
`system.EnsureRemoveAll(container.Root)`. This results in the
following error:

> Error response from daemon: driver "XXX" failed to remove root filesystem for YYY: layer not retained

The obvious fix is to set container.RWLayer to nil as soon as
ReleaseRWLayer() succeeds.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit e9b9e4ace294230c6b8eb010eda564a2541c4564)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Kir Kolyshkin
2018-02-20 15:41:42 -08:00
parent e634ffeb95
commit deff200c90
+1
View File
@@ -124,6 +124,7 @@ func (daemon *Daemon) cleanupContainer(container *container.Container, forceRemo
container.SetRemovalError(e)
return e
}
container.RWLayer = nil
}
if err := system.EnsureRemoveAll(container.Root); err != nil {