From: Lennart Poettering Date: Fri, 11 Feb 2022 12:18:58 +0000 (+0100) Subject: cgroup: downgrade warning if we can't get ID off cgroup X-Git-Tag: v251-rc1~307^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1b42022388f7c87929dfa37717a14b7c25fac965;p=thirdparty%2Fsystemd.git cgroup: downgrade warning if we can't get ID off cgroup The cgroupid feature was not available in old cgroupvs2 kernels, hence try to get it but if we can't because it's not supported, then only debug log about it and proceed. (We only needs this for cgroup bpf stuff, but that isn't available on such old kernels anyway) Fixes: #22483 --- diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 316e8f571da..f2044c2ffc0 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -2134,7 +2134,6 @@ static int unit_update_cgroup( bool created, is_root_slice; CGroupMask migrate_mask = 0; _cleanup_free_ char *cgroup_full_path = NULL; - uint64_t cgroup_id = 0; int r; assert(u); @@ -2154,11 +2153,14 @@ static int unit_update_cgroup( created = r; if (cg_unified_controller(SYSTEMD_CGROUP_CONTROLLER) > 0) { + uint64_t cgroup_id = 0; + r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, NULL, &cgroup_full_path); if (r == 0) { r = cg_path_get_cgroupid(cgroup_full_path, &cgroup_id); if (r < 0) - log_unit_warning_errno(u, r, "Failed to get cgroup ID on cgroup %s, ignoring: %m", cgroup_full_path); + log_unit_full_errno(u, ERRNO_IS_NOT_SUPPORTED(r) ? LOG_DEBUG : LOG_WARNING, r, + "Failed to get cgroup ID of cgroup %s, ignoring: %m", cgroup_full_path); } else log_unit_warning_errno(u, r, "Failed to get full cgroup path on cgroup %s, ignoring: %m", empty_to_root(u->cgroup_path)); @@ -2169,7 +2171,6 @@ static int unit_update_cgroup( (void) unit_watch_cgroup(u); (void) unit_watch_cgroup_memory(u); - /* For v2 we preserve enabled controllers in delegated units, adjust others, * for v1 we figure out which controller hierarchies need migration. */ if (created || !u->cgroup_realized || !unit_cgroup_delegate(u)) {