[systemd-commits] man/systemd.service.xml src/core src/shared

Lennart Poettering lennart at kemper.freedesktop.org
Tue Jul 3 15:24:07 PDT 2012


 man/systemd.service.xml |   10 +++++++++-
 src/core/service.c      |    2 ++
 src/shared/ratelimit.h  |    7 +++++++
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 451b34cc1d74960ee0262eef970a6346ec814f31
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 4 00:23:42 2012 +0200

    service: flush the start counter in "systemctl reset-failed"

diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index 60155e6..fcd3a7d 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -768,7 +768,15 @@
                                 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>
diff --git a/src/core/service.c b/src/core/service.c
index d82803d..0c29d4a 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -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) {
diff --git a/src/shared/ratelimit.h b/src/shared/ratelimit.h
index 07e8205..ad00267 100644
--- a/src/shared/ratelimit.h
+++ b/src/shared/ratelimit.h
@@ -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



More information about the systemd-commits mailing list