|
|
45d01a |
---
|
|
|
45d01a |
libmultipath/config.c | 4 +
|
|
|
45d01a |
libmultipath/config.h | 3 +
|
|
|
45d01a |
libmultipath/defaults.h | 1
|
|
|
45d01a |
libmultipath/devmapper.c | 19 ++++++--
|
|
|
45d01a |
libmultipath/dict.c | 104 +++++++++++++++++++++++++++++++++++++++++++++
|
|
|
45d01a |
libmultipath/propsel.c | 26 +++++++++++
|
|
|
45d01a |
libmultipath/propsel.h | 1
|
|
|
45d01a |
libmultipath/structs.h | 7 +++
|
|
|
45d01a |
multipath/multipath.conf.5 | 13 +++++
|
|
|
45d01a |
multipath/multipath.rules | 1
|
|
|
45d01a |
multipathd/main.c | 27 +++++++++++
|
|
|
45d01a |
11 files changed, 202 insertions(+), 4 deletions(-)
|
|
|
45d01a |
|
|
|
45d01a |
Index: multipath-tools-130222/libmultipath/config.c
|
|
|
45d01a |
===================================================================
|
|
|
45d01a |
--- multipath-tools-130222.orig/libmultipath/config.c
|
|
|
45d01a |
+++ multipath-tools-130222/libmultipath/config.c
|
|
|
45d01a |
@@ -348,6 +348,7 @@ merge_hwe (struct hwentry * dst, struct
|
|
|
45d01a |
merge_num(skip_kpartx);
|
|
|
45d01a |
merge_num(max_sectors_kb);
|
|
|
45d01a |
merge_num(unpriv_sgio);
|
|
|
45d01a |
+ merge_num(ghost_delay);
|
|
|
45d01a |
|
|
|
45d01a |
/*
|
|
|
45d01a |
* Make sure features is consistent with
|
|
|
45d01a |
@@ -412,6 +413,7 @@ overwrite_hwe (struct hwentry * dst, str
|
|
|
45d01a |
overwrite_num(skip_kpartx);
|
|
|
45d01a |
overwrite_num(max_sectors_kb);
|
|
|
45d01a |
overwrite_num(unpriv_sgio);
|
|
|
45d01a |
+ overwrite_num(ghost_delay);
|
|
|
45d01a |
|
|
|
45d01a |
/*
|
|
|
45d01a |
* Make sure features is consistent with
|
|
|
45d01a |
@@ -482,6 +484,7 @@ store_hwe (vector hwtable, struct hwentr
|
|
|
45d01a |
hwe->retain_hwhandler = dhwe->retain_hwhandler;
|
|
|
45d01a |
hwe->detect_prio = dhwe->detect_prio;
|
|
|
45d01a |
hwe->detect_checker = dhwe->detect_checker;
|
|
|
45d01a |
+ hwe->ghost_delay = dhwe->ghost_delay;
|
|
|
45d01a |
|
|
|
45d01a |
if (dhwe->bl_product && !(hwe->bl_product = set_param_str(dhwe->bl_product)))
|
|
|
45d01a |
goto out;
|
|
|
45d01a |
@@ -694,6 +697,7 @@ load_config (char * file, struct udev *u
|
|
|
45d01a |
conf->disable_changed_wwids = 0;
|
|
|
45d01a |
conf->max_sectors_kb = DEFAULT_MAX_SECTORS_KB;
|
|
|
45d01a |
conf->unpriv_sgio = DEFAULT_UNPRIV_SGIO;
|
|
|
45d01a |
+ conf->ghost_delay = DEFAULT_GHOST_DELAY;
|
|
|
45d01a |
|
|
|
45d01a |
/*
|
|
|
45d01a |
* preload default hwtable
|
|
|
45d01a |
Index: multipath-tools-130222/libmultipath/config.h
|
|
|
45d01a |
===================================================================
|
|
|
45d01a |
--- multipath-tools-130222.orig/libmultipath/config.h
|
|
|
45d01a |
+++ multipath-tools-130222/libmultipath/config.h
|
|
|
45d01a |
@@ -70,6 +70,7 @@ struct hwentry {
|
|
|
45d01a |
int skip_kpartx;
|
|
|
45d01a |
int max_sectors_kb;
|
|
|
45d01a |
int unpriv_sgio;
|
|
|
45d01a |
+ int ghost_delay;
|
|
|
45d01a |
char * bl_product;
|
|
|
45d01a |
};
|
|
|
45d01a |
|
|
|
45d01a |
@@ -100,6 +101,7 @@ struct mpentry {
|
|
|
45d01a |
int skip_kpartx;
|
|
|
45d01a |
int max_sectors_kb;
|
|
|
45d01a |
int unpriv_sgio;
|
|
|
45d01a |
+ int ghost_delay;
|
|
|
45d01a |
uid_t uid;
|
|
|
45d01a |
gid_t gid;
|
|
|
45d01a |
mode_t mode;
|
|
|
45d01a |
@@ -159,6 +161,7 @@ struct config {
|
|
|
45d01a |
int disable_changed_wwids;
|
|
|
45d01a |
int max_sectors_kb;
|
|
|
45d01a |
int unpriv_sgio;
|
|
|
45d01a |
+ int ghost_delay;
|
|
|
45d01a |
unsigned int version[3];
|
|
|
45d01a |
|
|
|
45d01a |
char * dev;
|
|
|
45d01a |
Index: multipath-tools-130222/libmultipath/defaults.h
|
|
|
45d01a |
===================================================================
|
|
|
45d01a |
--- multipath-tools-130222.orig/libmultipath/defaults.h
|
|
|
45d01a |
+++ multipath-tools-130222/libmultipath/defaults.h
|
|
|
45d01a |
@@ -28,6 +28,7 @@
|
|
|
45d01a |
#define DEFAULT_SKIP_KPARTX SKIP_KPARTX_OFF
|
|
|
45d01a |
#define DEFAULT_MAX_SECTORS_KB MAX_SECTORS_KB_UNDEF
|
|
|
45d01a |
#define DEFAULT_UNPRIV_SGIO UNPRIV_SGIO_OFF
|
|
|
45d01a |
+#define DEFAULT_GHOST_DELAY GHOST_DELAY_OFF
|
|
|
45d01a |
|
|
|
45d01a |
#define DEFAULT_CHECKINT 5
|
|
|
45d01a |
#define MAX_CHECKINT(a) (a << 2)
|
|
|
45d01a |
Index: multipath-tools-130222/libmultipath/devmapper.c
|
|
|
45d01a |
===================================================================
|
|
|
45d01a |
--- multipath-tools-130222.orig/libmultipath/devmapper.c
|
|
|
45d01a |
+++ multipath-tools-130222/libmultipath/devmapper.c
|
|
|
45d01a |
@@ -23,6 +23,7 @@
|
|
|
45d01a |
#include "sysfs.h"
|
|
|
45d01a |
#include "discovery.h"
|
|
|
45d01a |
#include "log_pthread.h"
|
|
|
45d01a |
+#include "propsel.h"
|
|
|
45d01a |
#include <sys/types.h>
|
|
|
45d01a |
#include <time.h>
|
|
|
45d01a |
|
|
|
45d01a |
@@ -334,7 +335,7 @@ static uint16_t build_udev_flags(const s
|
|
|
45d01a |
/* DM_UDEV_DISABLE_LIBRARY_FALLBACK is added in dm_addmap */
|
|
|
45d01a |
return (mpp->skip_kpartx == SKIP_KPARTX_ON ?
|
|
|
45d01a |
MPATH_UDEV_NO_KPARTX_FLAG : 0) |
|
|
|
45d01a |
- (mpp->nr_active == 0 ?
|
|
|
45d01a |
+ ((mpp->nr_active == 0 || mpp->ghost_delay_tick > 0)?
|
|
|
45d01a |
MPATH_UDEV_NO_PATHS_FLAG : 0) |
|
|
|
45d01a |
(reload && !mpp->force_udev_reload ?
|
|
|
45d01a |
MPATH_UDEV_RELOAD_FLAG : 0);
|
|
|
45d01a |
@@ -343,8 +344,16 @@ static uint16_t build_udev_flags(const s
|
|
|
45d01a |
extern int
|
|
|
45d01a |
dm_addmap_create (struct multipath *mpp, char * params) {
|
|
|
45d01a |
int ro;
|
|
|
45d01a |
- uint16_t udev_flags = build_udev_flags(mpp, 0);
|
|
|
45d01a |
+ uint16_t udev_flags;
|
|
|
45d01a |
|
|
|
45d01a |
+ select_ghost_delay(mpp);
|
|
|
45d01a |
+ if (conf->daemon && mpp->ghost_delay > 0 && mpp->nr_active &&
|
|
|
45d01a |
+ pathcount(mpp, PATH_GHOST) == mpp->nr_active)
|
|
|
45d01a |
+ mpp->ghost_delay_tick = mpp->ghost_delay;
|
|
|
45d01a |
+ else
|
|
|
45d01a |
+ mpp->ghost_delay = 0;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ udev_flags = build_udev_flags(mpp, 0);
|
|
|
45d01a |
sysfs_set_max_sectors_kb(mpp, 0);
|
|
|
45d01a |
for (ro = 0; ro <= 1; ro++) {
|
|
|
45d01a |
int err;
|
|
|
45d01a |
@@ -373,7 +382,11 @@ dm_addmap_create (struct multipath *mpp,
|
|
|
45d01a |
extern int
|
|
|
45d01a |
dm_addmap_reload (struct multipath *mpp, char *params, int flush) {
|
|
|
45d01a |
int r = 0;
|
|
|
45d01a |
- uint16_t udev_flags = build_udev_flags(mpp, 1);
|
|
|
45d01a |
+ uint16_t udev_flags;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ if (mpp->ghost_delay_tick > 0 && pathcount(mpp, PATH_UP))
|
|
|
45d01a |
+ mpp->ghost_delay_tick = mpp->ghost_delay = 0;
|
|
|
45d01a |
+ udev_flags = build_udev_flags(mpp, 1);
|
|
|
45d01a |
|
|
|
45d01a |
sysfs_set_max_sectors_kb(mpp, 1);
|
|
|
45d01a |
if (!mpp->force_readonly)
|
|
|
45d01a |
Index: multipath-tools-130222/libmultipath/dict.c
|
|
|
45d01a |
===================================================================
|
|
|
45d01a |
--- multipath-tools-130222.orig/libmultipath/dict.c
|
|
|
45d01a |
+++ multipath-tools-130222/libmultipath/dict.c
|
|
|
45d01a |
@@ -1032,6 +1032,25 @@ def_unpriv_sgio_handler(vector strvec)
|
|
|
45d01a |
return 0;
|
|
|
45d01a |
}
|
|
|
45d01a |
|
|
|
45d01a |
+static int
|
|
|
45d01a |
+def_ghost_delay_handler(vector strvec)
|
|
|
45d01a |
+{
|
|
|
45d01a |
+ char * buff;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ buff = set_value(strvec);
|
|
|
45d01a |
+ if (!buff)
|
|
|
45d01a |
+ return 1;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
|
|
|
45d01a |
+ (strlen(buff) == 1 && !strcmp(buff, "0")))
|
|
|
45d01a |
+ conf->ghost_delay = GHOST_DELAY_OFF;
|
|
|
45d01a |
+ if ((conf->ghost_delay = atoi(buff)) < 0)
|
|
|
45d01a |
+ conf->ghost_delay = DEFAULT_GHOST_DELAY;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ FREE(buff);
|
|
|
45d01a |
+ return 0;
|
|
|
45d01a |
+}
|
|
|
45d01a |
+
|
|
|
45d01a |
/*
|
|
|
45d01a |
* blacklist block handlers
|
|
|
45d01a |
*/
|
|
|
45d01a |
@@ -1895,6 +1914,29 @@ hw_unpriv_sgio_handler(vector strvec)
|
|
|
45d01a |
return 0;
|
|
|
45d01a |
}
|
|
|
45d01a |
|
|
|
45d01a |
+static int
|
|
|
45d01a |
+hw_ghost_delay_handler(vector strvec)
|
|
|
45d01a |
+{
|
|
|
45d01a |
+ struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable);
|
|
|
45d01a |
+ char * buff;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ if (!hwe)
|
|
|
45d01a |
+ return 1;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ buff = set_value(strvec);
|
|
|
45d01a |
+ if (!buff)
|
|
|
45d01a |
+ return 1;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
|
|
|
45d01a |
+ (strlen(buff) == 1 && !strcmp(buff, "0")))
|
|
|
45d01a |
+ hwe->ghost_delay = GHOST_DELAY_OFF;
|
|
|
45d01a |
+ if ((hwe->ghost_delay = atoi(buff)) < 0)
|
|
|
45d01a |
+ hwe->ghost_delay = DEFAULT_GHOST_DELAY;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ FREE(buff);
|
|
|
45d01a |
+ return 0;
|
|
|
45d01a |
+}
|
|
|
45d01a |
+
|
|
|
45d01a |
/*
|
|
|
45d01a |
* multipaths block handlers
|
|
|
45d01a |
*/
|
|
|
45d01a |
@@ -2474,6 +2516,29 @@ mp_unpriv_sgio_handler(vector strvec)
|
|
|
45d01a |
return 0;
|
|
|
45d01a |
}
|
|
|
45d01a |
|
|
|
45d01a |
+static int
|
|
|
45d01a |
+mp_ghost_delay_handler(vector strvec)
|
|
|
45d01a |
+{
|
|
|
45d01a |
+ struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
|
|
|
45d01a |
+ char * buff;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ if (!mpe)
|
|
|
45d01a |
+ return 1;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ buff = set_value(strvec);
|
|
|
45d01a |
+ if (!buff)
|
|
|
45d01a |
+ return 1;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
|
|
|
45d01a |
+ (strlen(buff) == 1 && !strcmp(buff, "0")))
|
|
|
45d01a |
+ mpe->ghost_delay = GHOST_DELAY_OFF;
|
|
|
45d01a |
+ if ((mpe->ghost_delay = atoi(buff)) < 0)
|
|
|
45d01a |
+ mpe->ghost_delay = DEFAULT_GHOST_DELAY;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ FREE(buff);
|
|
|
45d01a |
+ return 0;
|
|
|
45d01a |
+}
|
|
|
45d01a |
+
|
|
|
45d01a |
/*
|
|
|
45d01a |
* config file keywords printing
|
|
|
45d01a |
*/
|
|
|
45d01a |
@@ -2788,6 +2853,19 @@ snprint_mp_unpriv_sgio (char * buff, int
|
|
|
45d01a |
}
|
|
|
45d01a |
|
|
|
45d01a |
static int
|
|
|
45d01a |
+snprint_mp_ghost_delay (char * buff, int len, void * data)
|
|
|
45d01a |
+{
|
|
|
45d01a |
+ struct mpentry * mpe = (struct mpentry *)data;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ if (mpe->ghost_delay == GHOST_DELAY_UNDEF)
|
|
|
45d01a |
+ return 0;
|
|
|
45d01a |
+ else if (mpe->ghost_delay == GHOST_DELAY_OFF)
|
|
|
45d01a |
+ return snprintf(buff, len, "no");
|
|
|
45d01a |
+ else
|
|
|
45d01a |
+ return snprintf(buff, len, "%d", mpe->ghost_delay);
|
|
|
45d01a |
+}
|
|
|
45d01a |
+
|
|
|
45d01a |
+static int
|
|
|
45d01a |
snprint_hw_fast_io_fail(char * buff, int len, void * data)
|
|
|
45d01a |
{
|
|
|
45d01a |
struct hwentry * hwe = (struct hwentry *)data;
|
|
|
45d01a |
@@ -3202,6 +3280,19 @@ snprint_hw_unpriv_sgio(char * buff, int
|
|
|
45d01a |
}
|
|
|
45d01a |
|
|
|
45d01a |
static int
|
|
|
45d01a |
+snprint_hw_ghost_delay (char * buff, int len, void * data)
|
|
|
45d01a |
+{
|
|
|
45d01a |
+ struct hwentry * hwe = (struct hwentry *)data;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ if (hwe->ghost_delay == GHOST_DELAY_UNDEF)
|
|
|
45d01a |
+ return 0;
|
|
|
45d01a |
+ else if (hwe->ghost_delay == GHOST_DELAY_OFF)
|
|
|
45d01a |
+ return snprintf(buff, len, "no");
|
|
|
45d01a |
+ else
|
|
|
45d01a |
+ return snprintf(buff, len, "%d", hwe->ghost_delay);
|
|
|
45d01a |
+}
|
|
|
45d01a |
+
|
|
|
45d01a |
+static int
|
|
|
45d01a |
snprint_def_polling_interval (char * buff, int len, void * data)
|
|
|
45d01a |
{
|
|
|
45d01a |
return snprintf(buff, len, "%i", conf->checkint);
|
|
|
45d01a |
@@ -3696,6 +3787,16 @@ snprint_def_unpriv_sgio(char * buff, int
|
|
|
45d01a |
}
|
|
|
45d01a |
|
|
|
45d01a |
static int
|
|
|
45d01a |
+snprint_def_ghost_delay (char * buff, int len, void * data)
|
|
|
45d01a |
+{
|
|
|
45d01a |
+ if (conf->ghost_delay == GHOST_DELAY_OFF ||
|
|
|
45d01a |
+ conf->ghost_delay == GHOST_DELAY_UNDEF)
|
|
|
45d01a |
+ return snprintf(buff, len, "no");
|
|
|
45d01a |
+ else
|
|
|
45d01a |
+ return snprintf(buff, len, "%d", conf->ghost_delay);
|
|
|
45d01a |
+}
|
|
|
45d01a |
+
|
|
|
45d01a |
+static int
|
|
|
45d01a |
snprint_ble_simple (char * buff, int len, void * data)
|
|
|
45d01a |
{
|
|
|
45d01a |
struct blentry * ble = (struct blentry *)data;
|
|
|
45d01a |
@@ -3792,6 +3893,7 @@ init_keywords(void)
|
|
|
45d01a |
install_keyword("disable_changed_wwids", &def_disable_changed_wwids_handler, &snprint_def_disable_changed_wwids);
|
|
|
45d01a |
install_keyword("max_sectors_kb", &def_max_sectors_kb_handler, &snprint_def_max_sectors_kb);
|
|
|
45d01a |
install_keyword("unpriv_sgio", &def_unpriv_sgio_handler, &snprint_def_unpriv_sgio);
|
|
|
45d01a |
+ install_keyword("ghost_delay", &def_ghost_delay_handler, &snprint_def_ghost_delay);
|
|
|
45d01a |
__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
|
|
|
45d01a |
__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
|
|
|
45d01a |
__deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL);
|
|
|
45d01a |
@@ -3863,6 +3965,7 @@ init_keywords(void)
|
|
|
45d01a |
install_keyword("skip_kpartx", &hw_skip_kpartx_handler, &snprint_hw_skip_kpartx);
|
|
|
45d01a |
install_keyword("max_sectors_kb", &hw_max_sectors_kb_handler, &snprint_hw_max_sectors_kb);
|
|
|
45d01a |
install_keyword("unpriv_sgio", &hw_unpriv_sgio_handler, &snprint_hw_unpriv_sgio);
|
|
|
45d01a |
+ install_keyword("ghost_delay", &hw_ghost_delay_handler, &snprint_hw_ghost_delay);
|
|
|
45d01a |
install_sublevel_end();
|
|
|
45d01a |
|
|
|
45d01a |
install_keyword_root("overrides", &nop_handler);
|
|
|
45d01a |
@@ -3923,5 +4026,6 @@ init_keywords(void)
|
|
|
45d01a |
install_keyword("skip_kpartx", &mp_skip_kpartx_handler, &snprint_mp_skip_kpartx);
|
|
|
45d01a |
install_keyword("max_sectors_kb", &mp_max_sectors_kb_handler, &snprint_mp_max_sectors_kb);
|
|
|
45d01a |
install_keyword("unpriv_sgio", &mp_unpriv_sgio_handler, &snprint_mp_unpriv_sgio);
|
|
|
45d01a |
+ install_keyword("ghost_delay", &mp_ghost_delay_handler, &snprint_mp_ghost_delay);
|
|
|
45d01a |
install_sublevel_end();
|
|
|
45d01a |
}
|
|
|
45d01a |
Index: multipath-tools-130222/libmultipath/propsel.c
|
|
|
45d01a |
===================================================================
|
|
|
45d01a |
--- multipath-tools-130222.orig/libmultipath/propsel.c
|
|
|
45d01a |
+++ multipath-tools-130222/libmultipath/propsel.c
|
|
|
45d01a |
@@ -966,3 +966,29 @@ select_unpriv_sgio (struct multipath * m
|
|
|
45d01a |
condlog(3, "unpriv_sgio = DISABLED (internal default)");
|
|
|
45d01a |
return 0;
|
|
|
45d01a |
}
|
|
|
45d01a |
+
|
|
|
45d01a |
+extern int
|
|
|
45d01a |
+select_ghost_delay (struct multipath * mp)
|
|
|
45d01a |
+{
|
|
|
45d01a |
+ if (mp->mpe && mp->mpe->ghost_delay != GHOST_DELAY_UNDEF) {
|
|
|
45d01a |
+ mp->ghost_delay = mp->mpe->ghost_delay;
|
|
|
45d01a |
+ condlog(3, "ghost_delay = %i (multipath setting)",
|
|
|
45d01a |
+ mp->ghost_delay);
|
|
|
45d01a |
+ return 0;
|
|
|
45d01a |
+ }
|
|
|
45d01a |
+ if (mp->hwe && mp->hwe->ghost_delay != GHOST_DELAY_UNDEF) {
|
|
|
45d01a |
+ mp->ghost_delay = mp->hwe->ghost_delay;
|
|
|
45d01a |
+ condlog(3, "ghost_delay = %i (controler setting)",
|
|
|
45d01a |
+ mp->ghost_delay);
|
|
|
45d01a |
+ return 0;
|
|
|
45d01a |
+ }
|
|
|
45d01a |
+ if (conf->ghost_delay != GHOST_DELAY_UNDEF) {
|
|
|
45d01a |
+ mp->ghost_delay = conf->ghost_delay;
|
|
|
45d01a |
+ condlog(3, "ghost_delay = %i (config file default)",
|
|
|
45d01a |
+ mp->ghost_delay);
|
|
|
45d01a |
+ return 0;
|
|
|
45d01a |
+ }
|
|
|
45d01a |
+ mp->ghost_delay = DEFAULT_GHOST_DELAY;
|
|
|
45d01a |
+ condlog(3, "ghost_delay = DISABLED (internal default)");
|
|
|
45d01a |
+ return 0;
|
|
|
45d01a |
+}
|
|
|
45d01a |
Index: multipath-tools-130222/libmultipath/propsel.h
|
|
|
45d01a |
===================================================================
|
|
|
45d01a |
--- multipath-tools-130222.orig/libmultipath/propsel.h
|
|
|
45d01a |
+++ multipath-tools-130222/libmultipath/propsel.h
|
|
|
45d01a |
@@ -27,3 +27,4 @@ int select_delay_wait_checks (struct mul
|
|
|
45d01a |
int select_skip_kpartx (struct multipath * mp);
|
|
|
45d01a |
int select_max_sectors_kb (struct multipath * mp);
|
|
|
45d01a |
int select_unpriv_sgio (struct multipath * mp);
|
|
|
45d01a |
+int select_ghost_delay (struct multipath * mp);
|
|
|
45d01a |
Index: multipath-tools-130222/libmultipath/structs.h
|
|
|
45d01a |
===================================================================
|
|
|
45d01a |
--- multipath-tools-130222.orig/libmultipath/structs.h
|
|
|
45d01a |
+++ multipath-tools-130222/libmultipath/structs.h
|
|
|
45d01a |
@@ -176,6 +176,11 @@ enum prkey_sources {
|
|
|
45d01a |
PRKEY_SOURCE_FILE,
|
|
|
45d01a |
};
|
|
|
45d01a |
|
|
|
45d01a |
+enum ghost_delay_states {
|
|
|
45d01a |
+ GHOST_DELAY_OFF = -1,
|
|
|
45d01a |
+ GHOST_DELAY_UNDEF = 0,
|
|
|
45d01a |
+};
|
|
|
45d01a |
+
|
|
|
45d01a |
struct sg_id {
|
|
|
45d01a |
int host_no;
|
|
|
45d01a |
int channel;
|
|
|
45d01a |
@@ -273,6 +278,8 @@ struct multipath {
|
|
|
45d01a |
int max_sectors_kb;
|
|
|
45d01a |
int force_readonly;
|
|
|
45d01a |
int unpriv_sgio;
|
|
|
45d01a |
+ int ghost_delay;
|
|
|
45d01a |
+ int ghost_delay_tick;
|
|
|
45d01a |
unsigned int dev_loss;
|
|
|
45d01a |
uid_t uid;
|
|
|
45d01a |
gid_t gid;
|
|
|
45d01a |
Index: multipath-tools-130222/multipathd/main.c
|
|
|
45d01a |
===================================================================
|
|
|
45d01a |
--- multipath-tools-130222.orig/multipathd/main.c
|
|
|
45d01a |
+++ multipath-tools-130222/multipathd/main.c
|
|
|
45d01a |
@@ -195,6 +195,8 @@ sync_map_state(struct multipath *mpp)
|
|
|
45d01a |
pp->state == PATH_WILD ||
|
|
|
45d01a |
pp->state == PATH_DELAYED)
|
|
|
45d01a |
continue;
|
|
|
45d01a |
+ if (mpp->ghost_delay_tick > 0)
|
|
|
45d01a |
+ continue;
|
|
|
45d01a |
if ((pp->dmstate == PSTATE_FAILED ||
|
|
|
45d01a |
pp->dmstate == PSTATE_UNDEF) &&
|
|
|
45d01a |
(pp->state == PATH_UP || pp->state == PATH_GHOST))
|
|
|
45d01a |
@@ -535,7 +537,7 @@ ev_add_path (struct path * pp, struct ve
|
|
|
45d01a |
if (mpp && mpp->wait_for_udev) {
|
|
|
45d01a |
if (pathcount(mpp, PATH_UP) == 0 &&
|
|
|
45d01a |
(pathcount(mpp, PATH_GHOST) == 0 ||
|
|
|
45d01a |
- pp->tpgs == TPGS_IMPLICIT))
|
|
|
45d01a |
+ mpp->ghost_delay_tick > 0 || pp->tpgs == TPGS_IMPLICIT))
|
|
|
45d01a |
mpp->force_udev_reload = 1;
|
|
|
45d01a |
else {
|
|
|
45d01a |
condlog(2, "%s [%s]: delaying path addition until %s is fully initialized", pp->dev, pp->dev_t, mpp->alias);
|
|
|
45d01a |
@@ -1215,6 +1217,28 @@ missing_uev_wait_tick(struct vectors *ve
|
|
|
45d01a |
}
|
|
|
45d01a |
|
|
|
45d01a |
static void
|
|
|
45d01a |
+ghost_delay_tick(struct vectors *vecs)
|
|
|
45d01a |
+{
|
|
|
45d01a |
+ struct multipath * mpp;
|
|
|
45d01a |
+ unsigned int i;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ vector_foreach_slot (vecs->mpvec, mpp, i) {
|
|
|
45d01a |
+ if (mpp->ghost_delay_tick <= 0)
|
|
|
45d01a |
+ continue;
|
|
|
45d01a |
+ if (--mpp->ghost_delay_tick <= 0) {
|
|
|
45d01a |
+ condlog(0, "%s: timed out waiting for active path",
|
|
|
45d01a |
+ mpp->alias);
|
|
|
45d01a |
+ if (update_map(mpp, vecs) != 0) {
|
|
|
45d01a |
+ /* update_map removed map */
|
|
|
45d01a |
+ i--;
|
|
|
45d01a |
+ continue;
|
|
|
45d01a |
+ }
|
|
|
45d01a |
+ mpp->ghost_delay = mpp->ghost_delay_tick = 0;
|
|
|
45d01a |
+ }
|
|
|
45d01a |
+ }
|
|
|
45d01a |
+}
|
|
|
45d01a |
+
|
|
|
45d01a |
+static void
|
|
|
45d01a |
defered_failback_tick (vector mpvec)
|
|
|
45d01a |
{
|
|
|
45d01a |
struct multipath * mpp;
|
|
|
45d01a |
@@ -1560,6 +1584,7 @@ checkerloop (void *ap)
|
|
|
45d01a |
defered_failback_tick(vecs->mpvec);
|
|
|
45d01a |
retry_count_tick(vecs->mpvec);
|
|
|
45d01a |
missing_uev_wait_tick(vecs);
|
|
|
45d01a |
+ ghost_delay_tick(vecs);
|
|
|
45d01a |
}
|
|
|
45d01a |
if (count)
|
|
|
45d01a |
count--;
|
|
|
45d01a |
Index: multipath-tools-130222/multipath/multipath.rules
|
|
|
45d01a |
===================================================================
|
|
|
45d01a |
--- multipath-tools-130222.orig/multipath/multipath.rules
|
|
|
45d01a |
+++ multipath-tools-130222/multipath/multipath.rules
|
|
|
45d01a |
@@ -55,6 +55,7 @@ ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO=
|
|
|
45d01a |
ENV{DM_ACTIVATION}=="1", ENV{DM_MULTIPATH_NEED_KPARTX}="1"
|
|
|
45d01a |
ENV{DM_SUSPENDED}=="1", GOTO="end_mpath"
|
|
|
45d01a |
ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath"
|
|
|
45d01a |
+ENV{DM_NOSCAN}=="1", GOTO="end_mpath"
|
|
|
45d01a |
ENV{DM_ACTIVATION}!="1", ENV{DM_MULTIPATH_NEED_KPARTX}!="1", GOTO="end_mpath"
|
|
|
45d01a |
RUN+="$env{MPATH_SBIN_PATH}/kpartx -an $tempnode", \
|
|
|
45d01a |
ENV{DM_MULTIPATH_NEED_KPARTX}=""
|
|
|
45d01a |
Index: multipath-tools-130222/multipath/multipath.conf.5
|
|
|
45d01a |
===================================================================
|
|
|
45d01a |
--- multipath-tools-130222.orig/multipath/multipath.conf.5
|
|
|
45d01a |
+++ multipath-tools-130222/multipath/multipath.conf.5
|
|
|
45d01a |
@@ -601,6 +601,15 @@ device to the specified value. Default i
|
|
|
45d01a |
If set to \fIyes\fR, multipath will set upriv_sgio on the multipath device and
|
|
|
45d01a |
all its paths, when it is created or reloaded. The default is
|
|
|
45d01a |
.I no
|
|
|
45d01a |
+.TP
|
|
|
45d01a |
+.B ghost_delay
|
|
|
45d01a |
+Sets the number of seconds that multipath will wait after creating a device
|
|
|
45d01a |
+with only ghost paths before marking it ready for use in systemd. This gives
|
|
|
45d01a |
+the active paths time to appear before the multipath runs the hardware handler
|
|
|
45d01a |
+to switch the ghost paths to active ones. Setting this to \fI0\fR or \fIoff\fR
|
|
|
45d01a |
+makes multipath immediately mark a device with only ghost paths as ready. The
|
|
|
45d01a |
+default is
|
|
|
45d01a |
+.I off
|
|
|
45d01a |
.
|
|
|
45d01a |
.SH "blacklist section"
|
|
|
45d01a |
The
|
|
|
45d01a |
@@ -716,6 +725,8 @@ section:
|
|
|
45d01a |
.B max_sectors_kb
|
|
|
45d01a |
.TP
|
|
|
45d01a |
.B unpriv_sgio
|
|
|
45d01a |
+.TP
|
|
|
45d01a |
+.B ghost_delay
|
|
|
45d01a |
.RE
|
|
|
45d01a |
.PD
|
|
|
45d01a |
.LP
|
|
|
45d01a |
@@ -820,6 +831,8 @@ section:
|
|
|
45d01a |
.B max_sectors_kb
|
|
|
45d01a |
.TP
|
|
|
45d01a |
.B unpriv_sgio
|
|
|
45d01a |
+.TP
|
|
|
45d01a |
+.B ghost_delay
|
|
|
45d01a |
.RE
|
|
|
45d01a |
.PD
|
|
|
45d01a |
.LP
|