diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2021-10-19 10:45:48 +0100 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2021-10-30 22:13:45 +0100 |
commit | ce2146f5256659c7fb53a7d5b9dc551252e27e7e (patch) | |
tree | 73be1a39ff54d1e8c83cb3599861353b508e9181 /src | |
parent | 5f37c1a955e399756c4137d22f7f0f45a619f425 (diff) | |
download | systemd-ce2146f5256659c7fb53a7d5b9dc551252e27e7e.tar.gz |
core: Delay start rate limit check when starting a unit
Doing start rate limit checks before doing condition checks made
condition check failures count towards the start rate limit which
broke existing assumptions (see #21025). Run the rate limit checks
after the condition checks again to restore the previous behaviour.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/unit.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/unit.c b/src/core/unit.c index a2944c1917..a6403002a6 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -1855,13 +1855,6 @@ int unit_start(Unit *u) { assert(u); - /* Check start rate limiting early so that failure conditions don't cause us to enter a busy loop. */ - if (UNIT_VTABLE(u)->test_start_limit) { - r = UNIT_VTABLE(u)->test_start_limit(u); - if (r < 0) - return r; - } - /* If this is already started, then this will succeed. Note that this will even succeed if this unit * is not startable by the user. This is relied on to detect when we need to wait for units and when * waiting is finished. */ @@ -1911,6 +1904,13 @@ int unit_start(Unit *u) { return unit_start(following); } + /* Check start rate limiting early so that failure conditions don't cause us to enter a busy loop. */ + if (UNIT_VTABLE(u)->test_start_limit) { + r = UNIT_VTABLE(u)->test_start_limit(u); + if (r < 0) + return r; + } + /* If it is stopped, but we cannot start it, then fail */ if (!UNIT_VTABLE(u)->start) return -EBADR; |