/
systemd-208-count-only-restarts.patch
46 lines (39 loc) · 1.53 KB
/
systemd-208-count-only-restarts.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From e24b4c602f3e70ee36bf749fd0d51b2740992e0f Mon Sep 17 00:00:00 2001
From: Pekka Lundstrom <pekka.lundstrom@jollamobile.com>
Date: Tue, 29 Apr 2014 09:34:07 +0300
Subject: [PATCH] Count restarts when doing restart, not in start
Signed-off-by: Pekka Lundstrom <pekka.lundstrom@jollamobile.com>
---
src/core/service.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/core/service.c b/src/core/service.c
index 35053be..9d5f4c6 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2065,6 +2065,13 @@ static void service_enter_restart(Servic
return;
}
+ /* Make sure we don't enter a busy loop of some kind. */
+ r = unit_start_limit_test(UNIT(s));
+ if (r < 0) {
+ service_enter_dead(s, SERVICE_FAILURE_START_LIMIT_HIT, false);
+ return;
+ }
+
/* Any units that are bound to this service must also be
* restarted. We use JOB_RESTART (instead of the more obvious
* JOB_START) here so that those dependency jobs will be added
@@ -2250,13 +2257,6 @@ static int service_start(Unit *u) {
assert(IN_SET(s->state, SERVICE_DEAD, SERVICE_FAILED));
- /* Make sure we don't enter a busy loop of some kind. */
- r = unit_start_limit_test(u);
- if (r < 0) {
- service_enter_dead(s, SERVICE_FAILURE_START_LIMIT_HIT, false);
- return r;
- }
-
r = unit_acquire_invocation_id(u);
if (r < 0)
return r;
--
1.7.9.5