From 10d68a92b2a0027d5468cf76656692f34f6dbc54 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Mon, 1 Feb 2010 09:46:57 +0100 Subject: [PATCH] Add 'max_polling_interval' config variable We should be able to set the 'max_polling_interval' variable manually. Especially systems requiring precise failover timing will want to disable the automatic polling interval increase. Signed-off-by: Hannes Reinecke --- libmultipath/dict.c | 20 ++++++++++++++++++++ multipath/multipath.conf.5 | 9 +++++++-- multipathd/main.c | 22 ++++++++++++---------- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/libmultipath/dict.c b/libmultipath/dict.c index 299ec82..07aa9d0 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -77,6 +77,17 @@ verbosity_handler(vector strvec) } static int +max_polling_interval_handler(vector strvec) +{ + char *buff; + + buff = VECTOR_SLOT(strvec, 1); + conf->max_checkint = atoi(buff); + + return 0; +} + +static int udev_dir_handler(vector strvec) { conf->udev_dir = set_value(strvec); @@ -1977,6 +1988,14 @@ snprint_def_verbosity (char * buff, int len, void * data) } static int +snprint_def_max_polling_interval (char * buff, int len, void * data) +{ + if (conf->max_checkint == MAX_CHECKINT(conf->checkint)) + return 0; + return snprintf(buff, len, "%i", conf->max_checkint); +} + +static int snprint_def_udev_dir (char * buff, int len, void * data) { if (!conf->udev_dir) @@ -2259,6 +2278,7 @@ init_keywords(void) install_keyword_root("defaults", NULL); install_keyword("verbosity", &verbosity_handler, &snprint_def_verbosity); install_keyword("polling_interval", &polling_interval_handler, &snprint_def_polling_interval); + install_keyword("max_polling_interval", &max_polling_interval_handler, &snprint_def_max_polling_interval); install_keyword("udev_dir", &udev_dir_handler, &snprint_def_udev_dir); install_keyword("multipath_dir", &multipath_dir_handler, &snprint_def_multipath_dir); install_keyword("path_selector", &def_selector_handler, &snprint_def_selector); diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 index 43a0c27..cfc67fd 100644 --- a/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5 @@ -68,11 +68,16 @@ The section recognizes the following keywords: .TP 17 .B polling_interval -interval between two path checks in seconds For properly functioning paths, -the interval between checks will gradually increase to (4 * polling_interval); +interval between two path checks in seconds. For properly functioning paths, +the interval between checks will gradually increase to +.B max_polling_interval; default is .I 5 .TP +.B max_polling_interval +maximal interval between two path checks in seconds; default is +.I 4 * polling_interval +.TP .B udev_dir directory where udev creates its device nodes; default is .I /dev diff --git a/multipathd/main.c b/multipathd/main.c index 1723ddc..71d2bb3 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1060,18 +1060,20 @@ check_path (struct vectors * vecs, struct path * pp) } else if (newstate == PATH_UP || newstate == PATH_GHOST) { LOG_MSG(4, checker_message(&pp->checker)); - /* - * double the next check delay. - * max at conf->max_checkint - */ - if (pp->checkint < (conf->max_checkint / 2)) - pp->checkint = 2 * pp->checkint; - else - pp->checkint = conf->max_checkint; + if (pp->checkint != conf->max_checkint) { + /* + * double the next check delay. + * max at conf->max_checkint + */ + if (pp->checkint < (conf->max_checkint / 2)) + pp->checkint = 2 * pp->checkint; + else + pp->checkint = conf->max_checkint; - pp->tick = pp->checkint; - condlog(4, "%s: delay next check %is", + pp->tick = pp->checkint; + condlog(4, "%s: delay next check %is", pp->dev_t, pp->tick); + } } else if (newstate == PATH_DOWN) LOG_MSG(2, checker_message(&pp->checker)); -- 2.7.4