diff options
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r-- | libpod/container_internal.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 928be52ae..cc4c36bc9 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -401,7 +401,10 @@ func resetState(state *containerState) error { return nil } -// Refresh refreshes the container's state after a restart +// Refresh refreshes the container's state after a restart. +// Refresh cannot perform any operations that would lock another container. +// We cannot guarantee any other container has a valid lock at the time it is +// running. func (c *Container) refresh() error { // Don't need a full sync, but we do need to update from the database to // pick up potentially-missing container state @@ -447,6 +450,13 @@ func (c *Container) refresh() error { c.state.DestinationRunDir = filepath.Join(c.state.UserNSRoot, "rundir") } + // We need to pick up a new lock + lock, err := c.runtime.lockManager.RetrieveLock(c.config.LockID) + if err != nil { + return errors.Wrapf(err, "error acquiring lock for container %s", c.ID()) + } + c.lock = lock + if err := c.save(); err != nil { return errors.Wrapf(err, "error refreshing state for container %s", c.ID()) } @@ -748,6 +758,10 @@ func (c *Container) initAndStart(ctx context.Context) (err error) { // Internal, non-locking function to start a container func (c *Container) start() error { + if c.config.Spec.Process != nil { + logrus.Debugf("Starting container %s with command %v", c.ID(), c.config.Spec.Process.Args) + } + if err := c.runtime.ociRuntime.startContainer(c); err != nil { return err } |