summaryrefslogtreecommitdiff
path: root/libpod/runtime.go
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2020-12-02 10:05:34 -0500
committerMatthew Heon <mheon@redhat.com>2020-12-02 14:18:37 -0500
commitab886328357184cd0a8375a5dedf816ba91789f9 (patch)
tree3d1d5f58931ab6c6c1f0a5a74b3e263e616d64ee /libpod/runtime.go
parentce45b71dcfe7e5e0fd7ab43b9eeb4834317e6443 (diff)
downloadpodman-ab886328357184cd0a8375a5dedf816ba91789f9.tar.gz
podman-ab886328357184cd0a8375a5dedf816ba91789f9.tar.bz2
podman-ab886328357184cd0a8375a5dedf816ba91789f9.zip
Use Libpod tmpdir for pause path
Previously, we always computed pause path from the Rootless runtime directory. Problem: this does not match the behavior of Libpod when the directory changes. Libpod will continue to use the previous directory, cached in the database; Pause pidfiles will swap to the new path. This is problematic when the directory needs to exist to write the pidfile, and Libpod is what creates the directory. There are two potential solutions - allow the pause pidfile to move and just make the directory when we want to write it, or use the cached Libpod paths for a guaranteed location. This patch does the second, because it seems safer - we will never miss a previously-existing pidfile because the location is now consistent. Fixes #8539 Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r--libpod/runtime.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index df3dfae2b..cdf66a4d0 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -472,7 +472,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
// we will need to access the storage.
if os.Geteuid() != 0 {
aliveLock.Unlock() // Unlock to avoid deadlock as BecomeRootInUserNS will reexec.
- pausePid, err := util.GetRootlessPauseProcessPidPath()
+ pausePid, err := util.GetRootlessPauseProcessPidPathGivenDir(runtime.config.Engine.TmpDir)
if err != nil {
return errors.Wrapf(err, "could not get pause process pid file path")
}
@@ -538,6 +538,15 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
return nil
}
+// TmpDir gets the current Libpod temporary files directory.
+func (r *Runtime) TmpDir() (string, error) {
+ if !r.valid {
+ return "", define.ErrRuntimeStopped
+ }
+
+ return r.config.Engine.TmpDir, nil
+}
+
// GetConfig returns a copy of the configuration used by the runtime
func (r *Runtime) GetConfig() (*config.Config, error) {
r.lock.RLock()