mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 06:30:30 +00:00
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
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user