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 60155e6..fcd3a7d 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 d82803d..0c29d4a 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 07e8205..ad00267 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