mirror of
https://github.com/systemd/systemd.git
synced 2025-08-24 09:49:49 +03:00
cg_unified_cached: return ENOMEDIUM if we cannot find a known hierarchy
When the test suite is being run in a foreign environment, /sys/fs/cgroup might not be set up in a way that we recognize. Returning ENOMEDIUM causes the tests to be skipped in this case. Bug: https://bugs.gentoo.org/771819
This commit is contained in:
committed by
Lennart Poettering
parent
fa92d38428
commit
2156061fb3
@ -2052,8 +2052,14 @@ int cg_unified_cached(bool flush) {
|
|||||||
unified_cache = CGROUP_UNIFIED_SYSTEMD;
|
unified_cache = CGROUP_UNIFIED_SYSTEMD;
|
||||||
unified_systemd_v232 = false;
|
unified_systemd_v232 = false;
|
||||||
} else {
|
} else {
|
||||||
if (statfs("/sys/fs/cgroup/systemd/", &fs) < 0)
|
if (statfs("/sys/fs/cgroup/systemd/", &fs) < 0) {
|
||||||
|
if (errno == ENOENT) {
|
||||||
|
/* Some other software may have set up /sys/fs/cgroup in a configuration we do not recognize. */
|
||||||
|
log_debug_errno(errno, "Unsupported cgroupsv1 setup detected: name=systemd hierarchy not found.");
|
||||||
|
return -ENOMEDIUM;
|
||||||
|
}
|
||||||
return log_debug_errno(errno, "statfs(\"/sys/fs/cgroup/systemd\" failed: %m");
|
return log_debug_errno(errno, "statfs(\"/sys/fs/cgroup/systemd\" failed: %m");
|
||||||
|
}
|
||||||
|
|
||||||
if (F_TYPE_EQUAL(fs.f_type, CGROUP2_SUPER_MAGIC)) {
|
if (F_TYPE_EQUAL(fs.f_type, CGROUP2_SUPER_MAGIC)) {
|
||||||
log_debug("Found cgroup2 on /sys/fs/cgroup/systemd, unified hierarchy for systemd controller (v232 variant)");
|
log_debug("Found cgroup2 on /sys/fs/cgroup/systemd, unified hierarchy for systemd controller (v232 variant)");
|
||||||
|
Reference in New Issue
Block a user