chiark / gitweb /
service: flush the start counter in "systemctl reset-failed"
authorLennart Poettering <lennart@poettering.net>
Tue, 3 Jul 2012 22:23:42 +0000 (00:23 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 3 Jul 2012 22:23:42 +0000 (00:23 +0200)
man/systemd.service.xml
src/core/service.c
src/shared/ratelimit.h

index 60155e68cbd239ba3910109fc6af023009fbaf7f..fcd3a7dd383511395f165878941e39b85ded8823 100644 (file)
                                 however they may still be restarted
                                 manually at a later point from which
                                 point on the restart logic is again
-                                activated.</para></listitem>
+                                activated. Note that
+                                <command>systemctl
+                                reset-failed</command> will cause the
+                                restart rate counter for a service to
+                                be flushed, which is useful if the
+                                administrator wants to manually start
+                                a service and the start limit
+                                interferes with
+                                that.</para></listitem>
                         </varlistentry>
 
                         <varlistentry>
index d82803db2b634cc4b82322d3e925c27f3c321ed1..0c29d4aefa2729e66f0f85fe3e0b0fb6d76a848c 100644 (file)
@@ -3655,6 +3655,8 @@ static void service_reset_failed(Unit *u) {
 
         s->result = SERVICE_SUCCESS;
         s->reload_result = SERVICE_SUCCESS;
+
+        RATELIMIT_RESET(s->start_limit);
 }
 
 static int service_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError *error) {
index 07e8205c816e09669d8f2b771dfdab3a0ab73381..ad00267a6e5c3c0181d62c9c684bd8be635d9b5e 100644 (file)
@@ -48,6 +48,13 @@ typedef struct RateLimit {
                 _r->begin = 0;                           \
         } while (false)
 
+#define RATELIMIT_RESET(v)                               \
+        do {                                             \
+                RateLimit *_r = &(v);                    \
+                _r->num = 0;                             \
+                _r->begin = 0;                           \
+        } while (false)
+
 bool ratelimit_test(RateLimit *r);
 
 #endif