]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgroup-util: check for SYSFS_MAGIC when detecting cgroup format
authorDan Streetman <ddstreet@canonical.com>
Sat, 21 Mar 2020 15:19:44 +0000 (11:19 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 25 Apr 2020 08:00:43 +0000 (10:00 +0200)
When nothing at all is mounted at /sys/fs/cgroup, the fs.f_type is
SYSFS_MAGIC (0x62656572) which results in the confusing debug log:

"Unknown filesystem type 62656572 mounted on /sys/fs/cgroup."

Instead, if the f_type is SYSFS_MAGIC, a more accurate message is:

"No filesystem is currently mounted on /sys/fs/cgroup."

src/basic/cgroup-util.c

index be73cfa3f0d475d7a3c423380214b11c6384a3cf..33575e65ef1efe57b8d646aeadba2899a34aacb5 100644 (file)
@@ -2010,6 +2010,9 @@ int cg_unified_cached(bool flush) {
                                 unified_cache = CGROUP_UNIFIED_NONE;
                         }
                 }
+        } else if (F_TYPE_EQUAL(fs.f_type, SYSFS_MAGIC)) {
+                return log_debug_errno(SYNTHETIC_ERRNO(ENOMEDIUM),
+                                       "No filesystem is currently mounted on /sys/fs/cgroup.");
         } else
                 return log_debug_errno(SYNTHETIC_ERRNO(ENOMEDIUM),
                                        "Unknown filesystem type %llx mounted on /sys/fs/cgroup.",