diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-10-18 18:14:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-18 18:14:45 +0200 |
commit | 8ce1c625db1169cf3b178d111bcbc8d79fdec5aa (patch) | |
tree | 30452575f0500c8370ce6a5ed16f845d7f9a36e4 /libpod | |
parent | 0144f46ac5067196019225430847691502d74da7 (diff) | |
parent | d0f7b99c6dfb8dcbdc4a36e765cc8eb7fcde4798 (diff) | |
download | podman-8ce1c625db1169cf3b178d111bcbc8d79fdec5aa.tar.gz podman-8ce1c625db1169cf3b178d111bcbc8d79fdec5aa.tar.bz2 podman-8ce1c625db1169cf3b178d111bcbc8d79fdec5aa.zip |
Merge pull request #12009 from flouthoc/rootfs-overlay-cleanup-leak
rootfs-overlay: fix overlaybase path for cleanups
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal.go | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 3f9738411..4e8074840 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1690,9 +1690,23 @@ func (c *Container) cleanupStorage() error { var cleanupErr error + markUnmounted := func() { + c.state.Mountpoint = "" + c.state.Mounted = false + + if c.valid { + if err := c.save(); err != nil { + if cleanupErr != nil { + logrus.Errorf("Unmounting container %s: %v", c.ID(), cleanupErr) + } + cleanupErr = err + } + } + } + // umount rootfs overlay if it was created if c.config.RootfsOverlay { - overlayBasePath := c.runtime.store.GraphRoot() + overlayBasePath := filepath.Dir(c.config.StaticDir) overlayBasePath = filepath.Join(overlayBasePath, "rootfs") if err := overlay.Unmount(overlayBasePath); err != nil { // If the container can't remove content report the error @@ -1717,6 +1731,7 @@ func (c *Container) cleanupStorage() error { } if c.config.Rootfs != "" { + markUnmounted() return cleanupErr } @@ -1761,17 +1776,7 @@ func (c *Container) cleanupStorage() error { } } - c.state.Mountpoint = "" - c.state.Mounted = false - - if c.valid { - if err := c.save(); err != nil { - if cleanupErr != nil { - logrus.Errorf("Unmounting container %s: %v", c.ID(), cleanupErr) - } - cleanupErr = err - } - } + markUnmounted() return cleanupErr } |