mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
Add locking to Sync() on containers
Previously not needed as it only worked inside of Batch(), but now that it can be called anywhere we need to add mutual exclusion on its config changes. Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
@ -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) &&
|
||||
|
Reference in New Issue
Block a user