Skip to content

Commit f0fdde7

Browse files
committed
libct/cg/systemd/v1: fix err check in enableKmem
Commit 27d3dd3 ("don't fail when subsystem not mounted") added ignoring "not found" error to enableKmem, and as a result the function now tries to call Mkdir with an empty path, which results in a weird error message. For example, this is a failure from a libcontainer/integration test: > === RUN TestRunWithKernelMemorySystemd > exec_test.go:704: runContainer failed with kernel memory limit: container_linux.go:370: starting container process caused: process_linux.go:327: applying cgroup configuration for process caused: mkdir : no such file or directory I am not entirely sure if it is a good idea to silently ignore set limits, but at least let's fix the error handling. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent c1bba72 commit f0fdde7

File tree

1 file changed

+4
-1
lines changed
  • libcontainer/cgroups/systemd

1 file changed

+4
-1
lines changed

libcontainer/cgroups/systemd/v1.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,10 @@ func (m *legacyManager) Set(container *configs.Config) error {
406406

407407
func enableKmem(c *configs.Cgroup) error {
408408
path, err := getSubsystemPath(c, "memory")
409-
if err != nil && !cgroups.IsNotFound(err) {
409+
if err != nil {
410+
if cgroups.IsNotFound(err) {
411+
return nil
412+
}
410413
return err
411414
}
412415

0 commit comments

Comments
 (0)