diff options
author | Matthew Heon <mheon@redhat.com> | 2020-10-12 15:10:52 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2020-10-12 17:08:26 -0400 |
commit | 83e6e4ccdd925fa25500cff9e4b631b2c5d157cb (patch) | |
tree | 5dcbaee6ea381925c0258f95d7b134750c7adbb6 /libpod/runtime_ctr.go | |
parent | 8381f3feeebbbeef269909e4abba83191c8d9590 (diff) | |
download | podman-83e6e4ccdd925fa25500cff9e4b631b2c5d157cb.tar.gz podman-83e6e4ccdd925fa25500cff9e4b631b2c5d157cb.tar.bz2 podman-83e6e4ccdd925fa25500cff9e4b631b2c5d157cb.zip |
Enable masking stop signals within container creation
Expand the use of the Shutdown package such that we now use it
to handle signals any time we run Libpod. From there, add code to
container creation to use the Inhibit function to prevent a
shutdown from occuring during the critical parts of container
creation.
We also need to turn off signal handling when --sig-proxy is
invoked - we don't want to catch the signals ourselves then, but
instead to forward them into the container via the existing
sig-proxy handler.
Fixes #7941
Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r-- | libpod/runtime_ctr.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 51b4c5f03..de73a9ff3 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -12,6 +12,7 @@ import ( "github.com/containers/common/pkg/config" "github.com/containers/podman/v2/libpod/define" "github.com/containers/podman/v2/libpod/events" + "github.com/containers/podman/v2/libpod/shutdown" "github.com/containers/podman/v2/pkg/cgroups" "github.com/containers/podman/v2/pkg/rootless" "github.com/containers/storage" @@ -149,6 +150,10 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai return nil, err } + // Inhibit shutdown until creation succeeds + shutdown.Inhibit() + defer shutdown.Uninhibit() + // Allocate a lock for the container lock, err := r.lockManager.AllocateLock() if err != nil { |