multipathd: print error message if checkint is not initialized
authorMartin Wilck <mwilck@suse.com>
Fri, 2 Nov 2018 12:23:58 +0000 (13:23 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 14 Nov 2018 07:22:23 +0000 (08:22 +0100)
This is just a safety measure in case I overlooked something wrt
the checkint initialization. It could be reverted once we know the
error message isn't triggered.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
libmultipath/defaults.h
libmultipath/dict.c
libmultipath/structs.c
multipathd/main.c

index 7f3839f..6576939 100644 (file)
@@ -46,6 +46,7 @@
 #define DEFAULT_UNKNOWN_FIND_MULTIPATHS_TIMEOUT 1
 #define DEFAULT_ALL_TG_PT ALL_TG_PT_OFF
 
+#define CHECKINT_UNDEF         (~0U)
 #define DEFAULT_CHECKINT       5
 #define MAX_CHECKINT(a)                (a << 2)
 
index c3f5a6e..a81c051 100644 (file)
@@ -264,7 +264,17 @@ snprint_mp_ ## option (struct config *conf, char * buff, int len,  \
        return function (buff, len, mpe->option);                       \
 }
 
-declare_def_handler(checkint, set_int)
+static int checkint_handler(struct config *conf, vector strvec)
+{
+       int rc = set_int(strvec, &conf->checkint);
+
+       if (rc)
+               return rc;
+       if (conf->checkint == CHECKINT_UNDEF)
+               conf->checkint--;
+       return 0;
+}
+
 declare_def_snprint(checkint, print_int)
 
 declare_def_handler(max_checkint, set_int)
@@ -1563,7 +1573,7 @@ init_keywords(vector keywords)
 {
        install_keyword_root("defaults", NULL);
        install_keyword("verbosity", &def_verbosity_handler, &snprint_def_verbosity);
-       install_keyword("polling_interval", &def_checkint_handler, &snprint_def_checkint);
+       install_keyword("polling_interval", &checkint_handler, &snprint_def_checkint);
        install_keyword("max_polling_interval", &def_max_checkint_handler, &snprint_def_max_checkint);
        install_keyword("reassign_maps", &def_reassign_maps_handler, &snprint_def_reassign_maps);
        install_keyword("multipath_dir", &def_multipath_dir_handler, &snprint_def_multipath_dir);
index caa178a..fee899b 100644 (file)
@@ -100,6 +100,7 @@ alloc_path (void)
                pp->fd = -1;
                pp->tpgs = TPGS_UNDEF;
                pp->priority = PRIO_UNDEF;
+               pp->checkint = CHECKINT_UNDEF;
                checker_clear(&pp->checker);
                dm_path_to_gen(pp)->ops = &dm_gen_path_ops;
                pp->hwe = vector_alloc();
index dfc10e5..a022bdb 100644 (file)
@@ -1842,6 +1842,12 @@ check_path (struct vectors * vecs, struct path * pp, int ticks)
        max_checkint = conf->max_checkint;
        verbosity = conf->verbosity;
        put_multipath_config(conf);
+
+       if (pp->checkint == CHECKINT_UNDEF) {
+               condlog(0, "%s: BUG: checkint is not set", pp->dev);
+               pp->checkint = checkint;
+       };
+
        if (!pp->mpp && pp->initialized == INIT_MISSING_UDEV) {
                if (pp->retriggers < retrigger_tries) {
                        condlog(2, "%s: triggering change event to reinitialize",