Blame SOURCES/0154-MONITOR-Do-not-set-up-watchdog-for-monitor.patch

45d81b
From c7edf2dabc1cc3fc5298c872babf60a3001dfc2f Mon Sep 17 00:00:00 2001
45d81b
From: Jakub Hrozek <jhrozek@redhat.com>
45d81b
Date: Mon, 7 Nov 2016 11:58:20 +0100
45d81b
Subject: [PATCH 154/154] MONITOR: Do not set up watchdog for monitor
45d81b
MIME-Version: 1.0
45d81b
Content-Type: text/plain; charset=UTF-8
45d81b
Content-Transfer-Encoding: 8bit
45d81b
45d81b
It makes little sense to set up watchdog for monitor because there is no
45d81b
entity that would restart the monitor. Therefore we should disable the
45d81b
watchdog for monitor process.
45d81b
45d81b
Resolves:
45d81b
https://fedorahosted.org/sssd/ticket/3232
45d81b
45d81b
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
45d81b
(cherry picked from commit fbe6644aa28d93f492434950680c5618eb567712)
45d81b
---
45d81b
 src/monitor/monitor.c |  2 ++
45d81b
 src/util/server.c     | 11 +++++++----
45d81b
 src/util/util.h       |  1 +
45d81b
 3 files changed, 10 insertions(+), 4 deletions(-)
45d81b
45d81b
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
45d81b
index 89dd0a91d1fbd41dd853cf8745de732b7059d02b..0f01580e01b6a0a9ab507a54183e5813133be5a9 100644
45d81b
--- a/src/monitor/monitor.c
45d81b
+++ b/src/monitor/monitor.c
45d81b
@@ -2880,6 +2880,8 @@ int main(int argc, const char *argv[])
45d81b
 
45d81b
     /* we want a pid file check */
45d81b
     flags |= FLAGS_PID_FILE;
45d81b
+    /* the monitor should not run a watchdog on itself */
45d81b
+    flags |= FLAGS_NO_WATCHDOG;
45d81b
 
45d81b
     /* Open before server_setup() does to have logging
45d81b
      * during configuration checking */
45d81b
diff --git a/src/util/server.c b/src/util/server.c
45d81b
index 953cd3d6171bf2fbcefd9b9138c679100d5153c3..013e572e6284b16534910088f7801219251896d8 100644
45d81b
--- a/src/util/server.c
45d81b
+++ b/src/util/server.c
45d81b
@@ -666,10 +666,13 @@ int server_setup(const char *name, int flags,
45d81b
                                      ret, strerror(ret));
45d81b
         return ret;
45d81b
     }
45d81b
-    ret = setup_watchdog(ctx->event_ctx, watchdog_interval);
45d81b
-    if (ret != EOK) {
45d81b
-        DEBUG(SSSDBG_CRIT_FAILURE, "Watchdog setup failed.\n");
45d81b
-        return ret;
45d81b
+
45d81b
+    if ((flags & FLAGS_NO_WATCHDOG) == 0) {
45d81b
+        ret = setup_watchdog(ctx->event_ctx, watchdog_interval);
45d81b
+        if (ret != EOK) {
45d81b
+            DEBUG(SSSDBG_CRIT_FAILURE, "Watchdog setup failed.\n");
45d81b
+            return ret;
45d81b
+        }
45d81b
     }
45d81b
 
45d81b
     sss_log(SSS_LOG_INFO, "Starting up");
45d81b
diff --git a/src/util/util.h b/src/util/util.h
45d81b
index 4449315f8b1a79ec915bc340b46188c440a27fa3..0cbd88bd5bdb7741148dcc40aeb5ee2abaa4ff98 100644
45d81b
--- a/src/util/util.h
45d81b
+++ b/src/util/util.h
45d81b
@@ -84,6 +84,7 @@
45d81b
 #define FLAGS_INTERACTIVE 0x0002
45d81b
 #define FLAGS_PID_FILE 0x0004
45d81b
 #define FLAGS_GEN_CONF 0x0008
45d81b
+#define FLAGS_NO_WATCHDOG 0x0010
45d81b
 
45d81b
 #define PIPE_INIT { -1, -1 }
45d81b
 
45d81b
-- 
45d81b
2.7.4
45d81b