dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From c7edf2dabc1cc3fc5298c872babf60a3001dfc2f Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Mon, 7 Nov 2016 11:58:20 +0100
Subject: [PATCH 154/154] MONITOR: Do not set up watchdog for monitor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It makes little sense to set up watchdog for monitor because there is no
entity that would restart the monitor. Therefore we should disable the
watchdog for monitor process.

Resolves:
https://fedorahosted.org/sssd/ticket/3232

Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
(cherry picked from commit fbe6644aa28d93f492434950680c5618eb567712)
---
 src/monitor/monitor.c |  2 ++
 src/util/server.c     | 11 +++++++----
 src/util/util.h       |  1 +
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 89dd0a91d1fbd41dd853cf8745de732b7059d02b..0f01580e01b6a0a9ab507a54183e5813133be5a9 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -2880,6 +2880,8 @@ int main(int argc, const char *argv[])
 
     /* we want a pid file check */
     flags |= FLAGS_PID_FILE;
+    /* the monitor should not run a watchdog on itself */
+    flags |= FLAGS_NO_WATCHDOG;
 
     /* Open before server_setup() does to have logging
      * during configuration checking */
diff --git a/src/util/server.c b/src/util/server.c
index 953cd3d6171bf2fbcefd9b9138c679100d5153c3..013e572e6284b16534910088f7801219251896d8 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -666,10 +666,13 @@ int server_setup(const char *name, int flags,
                                      ret, strerror(ret));
         return ret;
     }
-    ret = setup_watchdog(ctx->event_ctx, watchdog_interval);
-    if (ret != EOK) {
-        DEBUG(SSSDBG_CRIT_FAILURE, "Watchdog setup failed.\n");
-        return ret;
+
+    if ((flags & FLAGS_NO_WATCHDOG) == 0) {
+        ret = setup_watchdog(ctx->event_ctx, watchdog_interval);
+        if (ret != EOK) {
+            DEBUG(SSSDBG_CRIT_FAILURE, "Watchdog setup failed.\n");
+            return ret;
+        }
     }
 
     sss_log(SSS_LOG_INFO, "Starting up");
diff --git a/src/util/util.h b/src/util/util.h
index 4449315f8b1a79ec915bc340b46188c440a27fa3..0cbd88bd5bdb7741148dcc40aeb5ee2abaa4ff98 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -84,6 +84,7 @@
 #define FLAGS_INTERACTIVE 0x0002
 #define FLAGS_PID_FILE 0x0004
 #define FLAGS_GEN_CONF 0x0008
+#define FLAGS_NO_WATCHDOG 0x0010
 
 #define PIPE_INIT { -1, -1 }
 
-- 
2.7.4