multipathd: use local variable for watchdog configuration
authorHannes Reinecke <hare@suse.de>
Wed, 3 Sep 2014 06:21:15 +0000 (08:21 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Sun, 29 Mar 2015 16:16:12 +0000 (18:16 +0200)
The 'watchdog' setting in struct config needs to be a local
variable in multipathd/main.c, as the config will be freed
during reconfiguration and the checkerloop might then
access an invalid structure.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath/config.h
multipathd/main.c

index 0149ad3..0183969 100644 (file)
@@ -116,7 +116,6 @@ struct config {
        int ignore_wwids;
        int checker_timeout;
        int daemon;
-       int watchdog;
        int flush_on_last_del;
        int attribute_flags;
        int fast_io_fail;
index fd3514f..f876258 100644 (file)
  */
 #include <checkers.h>
 
+#ifdef USE_SYSTEMD
+static int use_watchdog;
+#endif
+
 /*
  * libmultipath
  */
@@ -1400,7 +1404,7 @@ checkerloop (void *ap)
                pthread_testcancel();
                condlog(4, "tick");
 #ifdef USE_SYSTEMD
-               if (conf->watchdog)
+               if (use_watchdog)
                        sd_notify(0, "WATCHDOG=1");
 #endif
                if (vecs->pathvec) {
@@ -1830,7 +1834,7 @@ child (void * param)
                        conf->checkint = conf->max_checkint / 4;
                condlog(3, "enabling watchdog, interval %d max %d",
                        conf->checkint, conf->max_checkint);
-               conf->watchdog = conf->checkint;
+               use_watchdog = conf->checkint;
        }
 #endif
        /*