1
0
mirror of https://github.com/systemd/systemd synced 2025-12-27 19:34:47 +01:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Franck Bui
e9eec8b5d2 scope: on unified, make sure to unwatch all PIDs once they've been moved to the cgroup scope
Commit 428a9f6f1d0396b9eacde2b38d667cbe3f15eb55 freed u->pids which is
problematic since the references to this unit in m->watch_pids were no more
removed when the unit was freed.

This patch makes sure to clean all this refs up before freeing u->pids by
calling unit_unwatch_all_pids().
2020-12-01 09:33:14 +01:00
Vito Caputo
cb9d621ebb
sd-event: fix delays assert brain-o (#17790)
s/sizeof/ELEMENTSOF/

Bug introduced in 34b87517749caa4142b19eb3c63bdf349fafbc49.
2020-12-01 09:26:54 +01:00
2 changed files with 8 additions and 6 deletions

View File

@ -375,10 +375,6 @@ static int scope_start(Unit *u) {
return r;
}
/* Now u->pids have been moved into the scope cgroup, it's not needed
* anymore. */
u->pids = set_free(u->pids);
s->result = SCOPE_SUCCESS;
scope_set_state(s, SCOPE_RUNNING);
@ -386,7 +382,13 @@ static int scope_start(Unit *u) {
/* Set the maximum runtime timeout. */
scope_arm_timer(s, usec_add(UNIT(s)->active_enter_timestamp.monotonic, s->runtime_max_usec));
/* Start watching the PIDs currently in the scope */
/* On unified we use proper notifications hence we can unwatch the PIDs
* we just attached to the scope. This can also be done on legacy as
* we're going to update the list of the processes we watch with the
* PIDs currently in the scope anyway. */
unit_unwatch_all_pids(u);
/* Start watching the PIDs currently in the scope (legacy hierarchy only) */
(void) unit_enqueue_rewatch_pids(u);
return 1;
}

View File

@ -3725,7 +3725,7 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
this_run = now(CLOCK_MONOTONIC);
l = u64log2(this_run - e->last_run);
assert(l < sizeof(e->delays));
assert(l < ELEMENTSOF(e->delays));
e->delays[l]++;
if (this_run - e->last_log >= 5*USEC_PER_SEC) {