diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-08-06 09:11:47 +0200 |
---|---|---|
committer | Giuseppe Scrivano <giuseppe@scrivano.org> | 2019-08-06 19:46:34 +0200 |
commit | 69727abdf6e7583fc5018dc9a724c6e10bfb4e8f (patch) | |
tree | 40324122023a80221eacc18d972c9888b928c5f3 /libpod/container_internal_linux.go | |
parent | b5618d9e354a565fb8e472208c835a36373e4fbb (diff) | |
download | podman-69727abdf6e7583fc5018dc9a724c6e10bfb4e8f.tar.gz podman-69727abdf6e7583fc5018dc9a724c6e10bfb4e8f.tar.bz2 podman-69727abdf6e7583fc5018dc9a724c6e10bfb4e8f.zip |
cgroup: fix regression when running systemd
commit 223fe64dc0a592fd44e0c9fde9f9e0ca087d566f introduced the
regression.
When running on cgroups v1, bind mount only /sys/fs/cgroup/systemd as
rw, as the code did earlier.
Also, simplify the rootless code as it doesn't require any special
handling when using --systemd.
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1737554
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod/container_internal_linux.go')
-rw-r--r-- | libpod/container_internal_linux.go | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 047b73d65..5aa4ee9a9 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -471,9 +471,9 @@ func (c *Container) setupSystemd(mounts []spec.Mount, g generate.Generator) erro return err } - g.RemoveMount("/sys/fs/cgroup") - if unified { + g.RemoveMount("/sys/fs/cgroup") + sourcePath := filepath.Join("/sys/fs/cgroup") systemdMnt := spec.Mount{ Destination: "/sys/fs/cgroup", @@ -483,31 +483,13 @@ func (c *Container) setupSystemd(mounts []spec.Mount, g generate.Generator) erro } g.AddMount(systemdMnt) } else { - // rootless containers have no write access to /sys/fs/cgroup, so don't - // add any mount into the container. - if !rootless.IsRootless() { - cgroupPath, err := c.CGroupPath() - if err != nil { - return err - } - sourcePath := filepath.Join("/sys/fs/cgroup", cgroupPath) - - systemdMnt := spec.Mount{ - Destination: "/sys/fs/cgroup", - Type: "bind", - Source: sourcePath, - Options: []string{"bind", "private"}, - } - g.AddMount(systemdMnt) - } else { - systemdMnt := spec.Mount{ - Destination: "/sys/fs/cgroup", - Type: "bind", - Source: "/sys/fs/cgroup", - Options: []string{"bind", "nodev", "noexec", "nosuid"}, - } - g.AddMount(systemdMnt) + systemdMnt := spec.Mount{ + Destination: "/sys/fs/cgroup/systemd", + Type: "bind", + Source: "/sys/fs/cgroup/systemd", + Options: []string{"bind", "nodev", "noexec", "nosuid"}, } + g.AddMount(systemdMnt) } return nil |