]> git.ipfire.org Git - thirdparty/systemd.git/commit
sleep,home: always initialize UnitFreezer if used 33092/head
authorMike Yuan <me@yhndnzj.com>
Tue, 11 Jun 2024 14:00:22 +0000 (16:00 +0200)
committerMike Yuan <me@yhndnzj.com>
Wed, 17 Jul 2024 16:14:33 +0000 (18:14 +0200)
commitb1ed7e6749541f03c2a35f05a91c5d950908e71f
tree70b206117bc39fca8c72d833ec0f960d8ac272db
parent1b5caddfeeaee678d5568db38faaae82a922e19e
sleep,home: always initialize UnitFreezer if used

Previously, unit_freezer_new_freeze() would only return
UnitFreezer object if FreezeUnit() succeeds. This is not
ideal though, as a failed bus call doesn't mean the action
actually failed. E.g. a timeout might occur because pid1
is waiting for cgroup event from kernel, while the bus call
timeout was exceeded (#33269). In such a case, ThawUnit()
will never be called, resulting in frozen units remain that
way after resuming from sleep.

Therefore, let's get rid of unit_freezer_new_freeze(),
and make sure as long as unit freezer is involved, we'll
call ThawUnit() when we're done. This should make things
a lot more robust.
src/home/homework.c
src/shared/bus-unit-util.c
src/shared/bus-unit-util.h
src/sleep/sleep.c