mirror of
https://github.com/systemd/systemd.git
synced 2025-01-21 22:04:01 +03:00
machine: GC machine when no leader PID is set
After d8854ff1aca4434db0d7d6dcaf9fcf2f38105fb4, if a serialized leader PID of a machine is already dead when deserialized, then the leader PID and PIDFD are unset for the machine, and subsequent machine_start() -> machine_watch_pidfd() will trigger an assertion. This makes a Machine object without leader PID GCed. Fixes a bug introduced by the combination of d8854ff1aca4434db0d7d6dcaf9fcf2f38105fb4 (v255) and 1762c2c045d3a78d3cad54c6b1e5ee9624b32b00 (v257). Fixes #35602.
This commit is contained in:
parent
8bc4a6e5cd
commit
51a0a3b049
@ -610,6 +610,9 @@ bool machine_may_gc(Machine *m, bool drop_not_started) {
|
||||
if (m->class == MACHINE_HOST)
|
||||
return false;
|
||||
|
||||
if (!pidref_is_set(&m->leader))
|
||||
return true;
|
||||
|
||||
if (drop_not_started && !m->started)
|
||||
return true;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user