mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 00:51:24 +03:00
core: when we cannot add PID to a scope cgroup, log about it
Also, place the scope unit in failed state.
This commit is contained in:
parent
373a99e489
commit
dd305ec9c6
@ -1809,6 +1809,7 @@ static int exec_child(
|
|||||||
log_close();
|
log_close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
execve(command->path, final_argv, final_env);
|
execve(command->path, final_argv, final_env);
|
||||||
*exit_status = EXIT_EXEC;
|
*exit_status = EXIT_EXEC;
|
||||||
return -errno;
|
return -errno;
|
||||||
@ -1903,7 +1904,7 @@ int exec_spawn(ExecCommand *command,
|
|||||||
* sure that when we kill the cgroup the process will be
|
* sure that when we kill the cgroup the process will be
|
||||||
* killed too). */
|
* killed too). */
|
||||||
if (params->cgroup_path)
|
if (params->cgroup_path)
|
||||||
cg_attach(SYSTEMD_CGROUP_CONTROLLER, params->cgroup_path, pid);
|
(void) cg_attach(SYSTEMD_CGROUP_CONTROLLER, params->cgroup_path, pid);
|
||||||
|
|
||||||
exec_status_start(&command->exec_status, pid);
|
exec_status_start(&command->exec_status, pid);
|
||||||
|
|
||||||
|
@ -277,6 +277,7 @@ static int scope_start(Unit *u) {
|
|||||||
if (s->state == SCOPE_FAILED)
|
if (s->state == SCOPE_FAILED)
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
|
/* We can't fulfill this right now, please try again later */
|
||||||
if (s->state == SCOPE_STOP_SIGTERM ||
|
if (s->state == SCOPE_STOP_SIGTERM ||
|
||||||
s->state == SCOPE_STOP_SIGKILL)
|
s->state == SCOPE_STOP_SIGKILL)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
@ -290,8 +291,11 @@ static int scope_start(Unit *u) {
|
|||||||
(void) unit_reset_cpu_usage(u);
|
(void) unit_reset_cpu_usage(u);
|
||||||
|
|
||||||
r = unit_attach_pids_to_cgroup(u);
|
r = unit_attach_pids_to_cgroup(u);
|
||||||
if (r < 0)
|
if (r < 0) {
|
||||||
|
log_unit_warning_errno(UNIT(s)->id, r, "%s: Failed to add PIDs to scope's control group: %m", UNIT(s)->id);
|
||||||
|
scope_enter_dead(s, SERVICE_FAILURE_RESOURCES);
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
s->result = SCOPE_SUCCESS;
|
s->result = SCOPE_SUCCESS;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user