summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_api.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go
index ee060ad6a..09bc46905 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -685,6 +685,11 @@ func (c *Container) Batch(batchFunc func(*Container) error) error {
// Running a manual Sync() ensures that container state will be correct in
// such situations.
func (c *Container) Sync() error {
+ if !c.batched {
+ c.lock.Lock()
+ defer c.lock.Unlock()
+ }
+
// If runtime knows about the container, update its status in runtime
// And then save back to disk
if (c.state.State != ContainerStateUnknown) &&