]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
limits-util: suppress noisy debug message when reading tasks in top-level cgroup
authorLennart Poettering <lennart@poettering.net>
Wed, 11 Oct 2023 09:09:09 +0000 (11:09 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 11 Oct 2023 09:30:53 +0000 (11:30 +0200)
We have the "tasks.max" cgroup attribute only if we run in a cgroup
namespace, but not on the host. Hence let's handle ENODATA silently
simply to reduce the debug noise generated.

src/basic/limits-util.c

index dc0a2a6c94bfcda0d3d83f92e2ffaffcb0b0a13c..9597c4c41cb586a97856afc3d908030eae65112e 100644 (file)
@@ -156,8 +156,11 @@ uint64_t system_tasks_max(void) {
         if (r < 0)
                 log_debug_errno(r, "Failed to determine cgroup root path, ignoring: %m");
         else {
+                /* We'll have the "pids.max" attribute on the our root cgroup only if we are in a
+                 * CLONE_NEWCGROUP namespace. On the top-level namespace this attribute is missing, hence
+                 * suppress any message about that */
                 r = cg_get_attribute_as_uint64("pids", root, "pids.max", &c);
-                if (r < 0)
+                if (r < 0 && r != -ENODATA)
                         log_debug_errno(r, "Failed to read pids.max attribute of root cgroup, ignoring: %m");
         }