]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/unit.c
pid1: fix collection of cycles of units which reference one another
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 13 Feb 2018 13:37:11 +0000 (14:37 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 15 Feb 2018 12:32:53 +0000 (13:32 +0100)
commit2641f02e23ac7d5385db7f932aff221a063f245e
treee68d6072de34463dffe8ea3bf2db3f9533a0a34a
parent7f7d01ed5804afef220ebdb29f22d8177d0d3a5c
pid1: fix collection of cycles of units which reference one another

A .socket will reference a .service unit, by registering a UnitRef with the
.service unit. If this .service unit has the .socket unit listed in Wants or
Sockets or such, a cycle will be created. We would not free this cycle
properly, because we treated any unit with non-empty refs as uncollectable. To
solve this issue, treats refs with UnitRef in u->refs_by_target similarly to
the refs in u->dependencies, and check if the "other" unit is known to be
needed. If it is not needed, do not treat the reference from it as preventing
the unit we are looking at from being freed.
src/core/manager.c
src/core/unit.c