diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-06-11 16:00:22 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-07-17 18:14:33 +0200 |
commit | b1ed7e6749541f03c2a35f05a91c5d950908e71f (patch) | |
tree | 70b206117bc39fca8c72d833ec0f960d8ac272db /src/shared | |
parent | sleep: also log about errno when getenv_bool fails (diff) | |
download | systemd-b1ed7e6749541f03c2a35f05a91c5d950908e71f.tar.xz systemd-b1ed7e6749541f03c2a35f05a91c5d950908e71f.zip |
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.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/bus-unit-util.c | 19 | ||||
-rw-r--r-- | src/shared/bus-unit-util.h | 2 |
2 files changed, 0 insertions, 21 deletions
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index 751cb29c62..259fbeaf5c 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -3025,22 +3025,3 @@ int unit_freezer_freeze(UnitFreezer *f) { int unit_freezer_thaw(UnitFreezer *f) { return unit_freezer_action(f, false); } - -int unit_freezer_new_freeze(const char *name, UnitFreezer **ret) { - _cleanup_(unit_freezer_freep) UnitFreezer *f = NULL; - int r; - - assert(name); - assert(ret); - - r = unit_freezer_new(name, &f); - if (r < 0) - return r; - - r = unit_freezer_freeze(f); - if (r < 0) - return r; - - *ret = TAKE_PTR(f); - return 0; -} diff --git a/src/shared/bus-unit-util.h b/src/shared/bus-unit-util.h index ea4056c691..6f0d55971c 100644 --- a/src/shared/bus-unit-util.h +++ b/src/shared/bus-unit-util.h @@ -45,5 +45,3 @@ int unit_freezer_new(const char *name, UnitFreezer **ret); int unit_freezer_freeze(UnitFreezer *f); int unit_freezer_thaw(UnitFreezer *f); - -int unit_freezer_new_freeze(const char *name, UnitFreezer **ret); |