From: Mike Yuan Date: Sat, 17 May 2025 14:59:32 +0000 (+0200) Subject: core/manager: do not pop gc_unit_queue before unit_gc_sweep() X-Git-Tag: v258-rc1~575 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=741a184a31127305fb4363833ca9d97a1057fc68;p=thirdparty%2Fsystemd.git core/manager: do not pop gc_unit_queue before unit_gc_sweep() Follow-up for 52e3671bf7e6321c58c6d3a6c8ad8e167259a569 unit_gc_sweep() might try to add the unit to gc queue again. While that becomes no-op as Unit.in_gc_queue is not cleared yet, it induces minor inconsistency of states. --- diff --git a/src/core/manager.c b/src/core/manager.c index 4f6232e8ad8..ebad062bd3f 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -1367,7 +1367,6 @@ good: static unsigned manager_dispatch_gc_unit_queue(Manager *m) { unsigned n = 0, gc_marker; - Unit *u; assert(m); @@ -1379,11 +1378,13 @@ static unsigned manager_dispatch_gc_unit_queue(Manager *m) { gc_marker = m->gc_marker; - while ((u = LIST_POP(gc_queue, m->gc_unit_queue))) { + Unit *u; + while ((u = m->gc_unit_queue)) { assert(u->in_gc_queue); unit_gc_sweep(u, gc_marker); + LIST_REMOVE(gc_queue, m->gc_unit_queue, u); u->in_gc_queue = false; n++;