cgroups: always create device cgroup on systemd
This is the same behavior as fs does. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
3fbf185602
commit
c4821b6f3e
|
@ -128,11 +128,9 @@ func Apply(c *cgroups.Cgroup, pid int) (map[string]string, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if !c.AllowAllDevices {
|
||||
if err := joinDevices(c, pid); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// -1 disables memorySwap
|
||||
if c.MemorySwap >= 0 && (c.Memory != 0 || c.MemorySwap > 0) {
|
||||
|
@ -272,6 +270,7 @@ func joinDevices(c *cgroups.Cgroup, pid int) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if !c.AllowAllDevices {
|
||||
if err := writeFile(path, "devices.deny", "a"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -281,6 +280,7 @@ func joinDevices(c *cgroups.Cgroup, pid int) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue