mirror of https://github.com/containers/podman.git
cgroup: fix regression when running systemd
commit 223fe64dc0
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>
This commit is contained in:
parent
b5618d9e35
commit
69727abdf6
|
@ -471,9 +471,9 @@ func (c *Container) setupSystemd(mounts []spec.Mount, g generate.Generator) erro
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if unified {
|
||||||
g.RemoveMount("/sys/fs/cgroup")
|
g.RemoveMount("/sys/fs/cgroup")
|
||||||
|
|
||||||
if unified {
|
|
||||||
sourcePath := filepath.Join("/sys/fs/cgroup")
|
sourcePath := filepath.Join("/sys/fs/cgroup")
|
||||||
systemdMnt := spec.Mount{
|
systemdMnt := spec.Mount{
|
||||||
Destination: "/sys/fs/cgroup",
|
Destination: "/sys/fs/cgroup",
|
||||||
|
@ -483,32 +483,14 @@ func (c *Container) setupSystemd(mounts []spec.Mount, g generate.Generator) erro
|
||||||
}
|
}
|
||||||
g.AddMount(systemdMnt)
|
g.AddMount(systemdMnt)
|
||||||
} else {
|
} 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{
|
systemdMnt := spec.Mount{
|
||||||
Destination: "/sys/fs/cgroup",
|
Destination: "/sys/fs/cgroup/systemd",
|
||||||
Type: "bind",
|
Type: "bind",
|
||||||
Source: sourcePath,
|
Source: "/sys/fs/cgroup/systemd",
|
||||||
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"},
|
Options: []string{"bind", "nodev", "noexec", "nosuid"},
|
||||||
}
|
}
|
||||||
g.AddMount(systemdMnt)
|
g.AddMount(systemdMnt)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue