From 33086f32cd5baafe4fe536a25f91d91176179cb2 Mon Sep 17 00:00:00 2001 From: Fabio Kung Date: Tue, 21 Feb 2017 15:55:59 -0800 Subject: [PATCH] Grab a lock to read container.RemovalInProgress Signed-off-by: Fabio Kung Upstream-commit: 481a92cb4111ebc1b7d4de5eeff84f570e4ba5dd Component: engine --- components/engine/daemon/daemon.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/engine/daemon/daemon.go b/components/engine/daemon/daemon.go index 56474a49f0..aee0a59679 100644 --- a/components/engine/daemon/daemon.go +++ b/components/engine/daemon/daemon.go @@ -271,6 +271,7 @@ func (daemon *Daemon) restore() error { } } + c.Lock() if c.RemovalInProgress { // We probably crashed in the middle of a removal, reset // the flag. @@ -281,10 +282,11 @@ func (daemon *Daemon) restore() error { // be removed. So we put the container in the "dead" // state and leave further processing up to them. logrus.Debugf("Resetting RemovalInProgress flag from %v", c.ID) - c.ResetRemovalInProgress() - c.SetDead() + c.RemovalInProgress = false + c.Dead = true c.ToDisk() } + c.Unlock() }(c) } wg.Wait()