diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-05-08 13:49:07 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-05-17 20:48:24 +0200 |
commit | 791d53a21421fba249156ea3a503e9e04a4912e4 (patch) | |
tree | d56e5f5ec94837075fb006b79891c9eabbe3b651 /pkg/util | |
parent | 2e0fef51b3928337ef46629b4627ff1700a918d1 (diff) | |
download | podman-791d53a21421fba249156ea3a503e9e04a4912e4.tar.gz podman-791d53a21421fba249156ea3a503e9e04a4912e4.tar.bz2 podman-791d53a21421fba249156ea3a503e9e04a4912e4.zip |
rootless: use a pause process
use a pause process to keep the user and mount namespace alive.
The pause process is created immediately on reload, and all successive
Podman processes will refer to it for joining the user&mount
namespace.
This solves all the race conditions we had on joining the correct
namespaces using the conmon processes.
As a fallback if the join fails for any reason (e.g. the pause process
was killed), then we try to join the running containers as we were
doing before.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg/util')
-rw-r--r-- | pkg/util/utils_supported.go | 10 | ||||
-rw-r--r-- | pkg/util/utils_windows.go | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/pkg/util/utils_supported.go b/pkg/util/utils_supported.go index 8b98658c2..3d9140a23 100644 --- a/pkg/util/utils_supported.go +++ b/pkg/util/utils_supported.go @@ -82,3 +82,13 @@ func GetRootlessRuntimeDir() (string, error) { } return rootlessRuntimeDir, nil } + +// GetRootlessPauseProcessPidPath returns the path to the file that holds the pid for +// the pause process +func GetRootlessPauseProcessPidPath() (string, error) { + runtimeDir, err := GetRootlessRuntimeDir() + if err != nil { + return "", err + } + return filepath.Join(runtimeDir, "libpod", "pause.pid"), nil +} diff --git a/pkg/util/utils_windows.go b/pkg/util/utils_windows.go index b33733da9..3faa6f10c 100644 --- a/pkg/util/utils_windows.go +++ b/pkg/util/utils_windows.go @@ -15,3 +15,9 @@ func GetRootlessRuntimeDir() (string, error) { func IsCgroup2UnifiedMode() (bool, error) { return false, errors.New("this function is not implemented for windows") } + +// GetRootlessPauseProcessPidPath returns the path to the file that holds the pid for +// the pause process +func GetRootlessPauseProcessPidPath() (string, error) { + return "", errors.New("this function is not implemented for windows") +} |