1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-27 03:21:32 +03:00

core/cgroup: ignore kernel cgroup.events when thawing

The `frozen` state can be `0` while the processes are indeed frozen (see
last commit). Therefore do not respect cgroup.events when checking
whether thawing is necessary.
This commit is contained in:
msizanoen1 2022-12-07 23:09:33 +07:00
parent 3d19e122cf
commit 7fcd269784

View File

@ -4167,7 +4167,7 @@ int compare_job_priority(const void *a, const void *b) {
int unit_cgroup_freezer_action(Unit *u, FreezerAction action) { int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
_cleanup_free_ char *path = NULL; _cleanup_free_ char *path = NULL;
FreezerState target, kernel = _FREEZER_STATE_INVALID; FreezerState target, kernel = _FREEZER_STATE_INVALID;
int r; int r, ret;
assert(u); assert(u);
assert(IN_SET(action, FREEZER_FREEZE, FREEZER_THAW)); assert(IN_SET(action, FREEZER_FREEZE, FREEZER_THAW));
@ -4200,8 +4200,11 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
if (target == kernel) { if (target == kernel) {
u->freezer_state = target; u->freezer_state = target;
return 0; if (action == FREEZER_FREEZE)
} return 0;
ret = 0;
} else
ret = 1;
r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, "cgroup.freeze", &path); r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, "cgroup.freeze", &path);
if (r < 0) if (r < 0)
@ -4209,16 +4212,18 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
log_unit_debug(u, "%s unit.", action == FREEZER_FREEZE ? "Freezing" : "Thawing"); log_unit_debug(u, "%s unit.", action == FREEZER_FREEZE ? "Freezing" : "Thawing");
if (action == FREEZER_FREEZE) if (target != kernel) {
u->freezer_state = FREEZER_FREEZING; if (action == FREEZER_FREEZE)
else u->freezer_state = FREEZER_FREEZING;
u->freezer_state = FREEZER_THAWING; else
u->freezer_state = FREEZER_THAWING;
}
r = write_string_file(path, one_zero(action == FREEZER_FREEZE), WRITE_STRING_FILE_DISABLE_BUFFER); r = write_string_file(path, one_zero(action == FREEZER_FREEZE), WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0) if (r < 0)
return r; return r;
return 1; return ret;
} }
int unit_get_cpuset(Unit *u, CPUSet *cpus, const char *name) { int unit_get_cpuset(Unit *u, CPUSet *cpus, const char *name) {