Skip to contentSkip to conversation

multipath: default fast_io_fail to 5 seconds

PATCH In review Benjamin Marzinski 4 participants 21 messages Jan 12, 2013 – Jan 21, 2013 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

PATCH v3 1/18 multipath: default fast_io_fail to 5 seconds

This patch sets fast_io_fail to 5 seconds in the defaults section.

---
 libmultipath/config.c   | 1 +
 libmultipath/defaults.h | 1 +
 2 files changed, 2 insertions(+)
libmultipath/config.c +1 -0
index 0a56cd1..51b4f45 100644
@@ -516,6 +516,7 @@ load_config (char * file)
 	conf->reassign_maps = DEFAULT_REASSIGN_MAPS;
 	conf->checkint = DEFAULT_CHECKINT;
 	conf->max_checkint = MAX_CHECKINT(conf->checkint);
+	conf->fast_io_fail = DEFAULT_FAST_IO_FAIL;
 
 	/*
 	 * preload default hwtable
libmultipath/defaults.h +1 -0
index 74b236f..f647ee0 100644
@@ -15,6 +15,7 @@
 #define DEFAULT_USER_FRIENDLY_NAMES    0
 #define DEFAULT_VERBOSITY	2
 #define DEFAULT_REASSIGN_MAPS	1
+#define DEFAULT_FAST_IO_FAIL	5
 
 #define DEFAULT_CHECKINT	5
 #define MAX_CHECKINT(a)		(a << 2)
Signature · 1 line
1.8.0
author maintainer
#1 lore raw

PATCH v3 2/18 multipath: remove default options from built-in

Since changing the path_selector, rr_min_io and rr_min_io_rq options won't actually break the device configs, there's no reason to set them equal to the defaults values. They can just inherit them from the defaults section.

---
 libmultipath/hwtable.c | 171 -------------------------------------------------
 1 file changed, 171 deletions(-)
libmultipath/hwtable.c +0 -171
index 668ccec..595edba 100644
@@ -28,13 +28,10 @@ static struct hwentry default_hw[] = {
 		.product       = "Compellent Vol",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_QUEUE,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -50,13 +47,10 @@ static struct hwentry default_hw[] = {
 		.product       = "Xserve RAID ",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = DEFAULT_CHECKER,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -72,13 +66,10 @@ static struct hwentry default_hw[] = {
 		.product       = "VV",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = DEFAULT_CHECKER,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -88,13 +79,10 @@ static struct hwentry default_hw[] = {
 		.product       = "HSG80",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = "1 hp_sw",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = HP_SW,
 		.prio_name     = PRIO_HP_SW,
 		.prio_args     = NULL,
@@ -104,13 +92,10 @@ static struct hwentry default_hw[] = {
 		.product       = "A6189A",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 12,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = DIRECTIO,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -121,7 +106,6 @@ static struct hwentry default_hw[] = {
 		.product       = "(MSA|HSV)1.0.*",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = "1 hp_sw",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
@@ -137,7 +121,6 @@ static struct hwentry default_hw[] = {
 		.product       = "MSA VOLUME",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
@@ -153,7 +136,6 @@ static struct hwentry default_hw[] = {
 		.product       = "HSV1[01]1|HSV2[01]0|HSV300|HSV4[05]0",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
@@ -169,7 +151,6 @@ static struct hwentry default_hw[] = {
 		.product       = "MSA2[02]12fc|MSA2012i",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
@@ -185,7 +166,6 @@ static struct hwentry default_hw[] = {
 		.product       = "MSA2012sa|MSA23(12|24)(fc|i|sa)|MSA2000s VOLUME",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
@@ -202,7 +182,6 @@ static struct hwentry default_hw[] = {
 		.product       = "HSVX700",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 alua",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
@@ -219,13 +198,10 @@ static struct hwentry default_hw[] = {
 		.product       = "LOGICAL VOLUME.*",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 12,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -236,13 +212,11 @@ static struct hwentry default_hw[] = {
 		.product       = "P2000 G3 FC|P2000G3 FC/iSCSI|P2000 G3 SAS|P2000 G3 iSCSI",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 18,
 		.minio         = 100,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = PRIO_ALUA,
 		.prio_args     = NULL,
@@ -258,13 +232,10 @@ static struct hwentry default_hw[] = {
 		.product       = "SAN DataDirector",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = DIRECTIO,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -280,13 +251,10 @@ static struct hwentry default_hw[] = {
 		.product       = "SYMMETRIX",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 6,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -297,13 +265,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "LUNZ",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = "1 emc",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = (300 / DEFAULT_CHECKINT),
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = EMC_CLARIION,
 		.prio_name     = PRIO_EMC,
 		.prio_args     = NULL,
@@ -314,13 +279,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "LUNZ",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 5,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -336,13 +298,10 @@ static struct hwentry default_hw[] = {
 		.product       = "CentricStor",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_SERIAL,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = DIRECTIO,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -352,12 +311,10 @@ static struct hwentry default_hw[] = {
 		.product       = "ETERNUS_DX(L|400|8000)",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 10,
-		.minio         = DEFAULT_MINIO,
 		.checker_name  = TUR,
 		.prio_name     = PRIO_ALUA,
 		.prio_args     = NULL,
@@ -373,13 +330,10 @@ static struct hwentry default_hw[] = {
 		.product       = "OPEN-.*",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -389,13 +343,10 @@ static struct hwentry default_hw[] = {
 		.product       = "DF.*",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = PRIO_HDS,
 		.prio_args     = NULL,
@@ -411,13 +362,10 @@ static struct hwentry default_hw[] = {
 		.product       = "ProFibre 4000R",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = DIRECTIO,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -429,13 +377,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 300,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -447,13 +392,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 300,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -465,13 +407,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 300,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -483,13 +422,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_QUEUE,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -500,13 +436,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = "2 pg_init_retries 50",
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 15,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -518,13 +451,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_QUEUE,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -536,13 +466,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_QUEUE,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -554,13 +481,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_QUEUE,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -572,13 +496,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_QUEUE,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -589,13 +510,10 @@ static struct hwentry default_hw[] = {
 		.product       = "^3542",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_SERIAL,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -606,13 +524,10 @@ static struct hwentry default_hw[] = {
 		.product       = "^2105800",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_SERIAL,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -623,13 +538,10 @@ static struct hwentry default_hw[] = {
 		.product       = "^2105F20",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_SERIAL,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -640,13 +552,10 @@ static struct hwentry default_hw[] = {
 		.product       = "^1750500",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = PRIO_ALUA,
 		.prio_args     = NULL,
@@ -657,13 +566,10 @@ static struct hwentry default_hw[] = {
 		.product       = "^2107900",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -674,13 +580,10 @@ static struct hwentry default_hw[] = {
 		.product       = "^2145",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = PRIO_ALUA,
 		.prio_args     = NULL,
@@ -693,13 +596,10 @@ static struct hwentry default_hw[] = {
 		.uid_attribute = "ID_UID",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = DIRECTIO,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -712,13 +612,10 @@ static struct hwentry default_hw[] = {
 		.uid_attribute = "ID_UID",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = DIRECTIO,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -729,13 +626,10 @@ static struct hwentry default_hw[] = {
 		.product       = "^IPR.*",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = "1 alua",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = PRIO_ALUA,
 		.prio_args     = NULL,
@@ -746,13 +640,11 @@ static struct hwentry default_hw[] = {
 		.product       = "1820N00",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_QUEUE,
 		.minio         = 100,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = PRIO_ALUA,
 		.prio_args     = NULL,
@@ -763,13 +655,11 @@ static struct hwentry default_hw[] = {
 		.product       = "2810XIV",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = 15,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
 		.minio         = 15,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -786,13 +676,10 @@ static struct hwentry default_hw[] = {
 		.product       = "VDASD",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = (300 / DEFAULT_CHECKINT),
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = DIRECTIO,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -803,13 +690,10 @@ static struct hwentry default_hw[] = {
 		.product       = "3303      NVDISK",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = FAILOVER,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = (300 / DEFAULT_CHECKINT),
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -820,13 +704,10 @@ static struct hwentry default_hw[] = {
 		.product       = "NVDISK",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 alua",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = (300 / DEFAULT_CHECKINT),
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = PRIO_ALUA,
 		.prio_args     = NULL,
@@ -838,13 +719,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = "2 pg_init_retries 50",
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 15,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -856,13 +734,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = "2 pg_init_retries 50",
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 15,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -874,13 +749,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = "2 pg_init_retries 50",
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 15,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -892,13 +764,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = "2 pg_init_retries 50",
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 15,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -914,7 +783,6 @@ static struct hwentry default_hw[] = {
 		.product       = "LUN.*",
 		.features      = "3 queue_if_no_path pg_init_retries 50",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.flush_on_last_del = FLUSH_ENABLED,
@@ -936,7 +804,6 @@ static struct hwentry default_hw[] = {
 		.product       = "COMSTAR",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_SERIAL,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
@@ -957,7 +824,6 @@ static struct hwentry default_hw[] = {
 		.product       = "Nseries.*",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
@@ -978,13 +844,10 @@ static struct hwentry default_hw[] = {
 		.product       = "Axiom.*",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = PRIO_ALUA,
 		.prio_args     = NULL,
@@ -1001,13 +864,10 @@ static struct hwentry default_hw[] = {
 		.product       = "TP9[13]00",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = DIRECTIO,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -1018,13 +878,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_QUEUE,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -1035,13 +892,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = "2 pg_init_retries 50",
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 15,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -1052,13 +906,10 @@ static struct hwentry default_hw[] = {
 		.product       = "DISK ARRAY",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 alua",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = PRIO_ALUA,
 		.prio_args     = NULL,
@@ -1075,13 +926,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = TUR,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -1097,13 +945,10 @@ static struct hwentry default_hw[] = {
 		.product       = "(StorEdge 3510|T4)",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = DIRECTIO,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -1113,13 +958,10 @@ static struct hwentry default_hw[] = {
 		.product       = "FC2502",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = DEFAULT_CHECKER,
 		.prio_name     = DEFAULT_PRIO,
 		.prio_args     = NULL,
@@ -1135,7 +977,6 @@ static struct hwentry default_hw[] = {
 		.product       = "RAIGE VOLUME",
 		.features      = "1 queue_if_no_path",
 		.hwhandler     = DEFAULT_HWHANDLER,
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = MULTIBUS,
 		.pgfailback    = FAILBACK_UNDEF,
 		.rr_weight     = RR_WEIGHT_NONE,
@@ -1151,13 +992,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_QUEUE,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -1169,13 +1007,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_QUEUE,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -1187,13 +1022,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = "2 pg_init_retries 50",
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = 15,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
@@ -1204,13 +1036,10 @@ static struct hwentry default_hw[] = {
 		.bl_product    = "Universal Xport",
 		.features      = DEFAULT_FEATURES,
 		.hwhandler     = "1 rdac",
-		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
 		.pgfailback    = -FAILBACK_IMMEDIATE,
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_QUEUE,
-		.minio         = DEFAULT_MINIO,
-		.minio_rq      = DEFAULT_MINIO_RQ,
 		.checker_name  = RDAC,
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
Signature · 1 line
1.8.0
author maintainer
#2 lore raw

PATCH v3 3/18 multipath: change default path_selector to

In reply to Benjamin Marzinski

My testing has showed service-time to be as good and occassionally noticeably better than round-robin. So the patch switches the default selector to give better performance out of the box.

---
 libmultipath/defaults.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/defaults.h +1 -1
index f647ee0..097c66f 100644
@@ -1,7 +1,7 @@
 #define DEFAULT_UID_ATTRIBUTE	"ID_SERIAL"
 #define DEFAULT_UDEVDIR		"/dev"
 #define DEFAULT_MULTIPATHDIR	"/" LIB_STRING "/multipath"
-#define DEFAULT_SELECTOR	"round-robin 0"
+#define DEFAULT_SELECTOR	"service-time 0"
 #define DEFAULT_ALIAS_PREFIX	"mpath"
 #define DEFAULT_FEATURES	"0"
 #define DEFAULT_HWHANDLER	"0"
Signature · 1 line
1.8.0
author maintainer
#3 lore raw

PATCH v3 4/18 multipath: make devt2devname use lstat to check

In reply to Benjamin Marzinski

dm_reassign wasn't working correctly for me because devt2devname used stat() to check if /sys/dev/block/major:minor was a symlink. But stat() never returns a symlink, if follows it. It needs to use lstat() instead. Also, I made multipath log a message when a dm device gets reassigned to use multipath.

---
 libmultipath/devmapper.c | 4 +++-
 libmultipath/sysfs.c     | 6 ++++--
 libmultipath/util.c      | 3 ++-
 3 files changed, 9 insertions(+), 4 deletions(-)
libmultipath/devmapper.c +3 -1
index a6e7150..89615b0 100644
@@ -1394,8 +1394,10 @@ int dm_reassign(const char *mapname)
 		return 1;
 	}
 
-	if (!(dmt = dm_task_create(DM_DEVICE_DEPS)))
+	if (!(dmt = dm_task_create(DM_DEVICE_DEPS))) {
+		condlog(3, "%s: couldn't make dm task", mapname);
 		return 0;
+	}
 
 	if (!dm_task_set_name(dmt, mapname))
 		goto out;
libmultipath/sysfs.c +4 -2
index 9c554dd..d33747f 100644
@@ -125,8 +125,10 @@ int sysfs_check_holders(char * check_devt, char * new_devt)
 		return 0;
 	}
 
-	if (devt2devname(check_dev, PATH_SIZE, check_devt))
+	if (devt2devname(check_dev, PATH_SIZE, check_devt)) {
+		condlog(1, "can't get devname for %s", check_devt);
 		return 0;
+	}
 
 	condlog(3, "%s: checking holder", check_dev);
 
@@ -153,7 +155,7 @@ int sysfs_check_holders(char * check_devt, char * new_devt)
 		}
 		table_name = dm_mapname(major, table_minor);
 
-		condlog(3, "%s: reassign table %s old %s new %s", check_dev,
+		condlog(0, "%s: reassign table %s old %s new %s", check_dev,
 			table_name, check_devt, new_devt);
 
 		dm_reassign_table(table_name, check_devt, new_devt);
libmultipath/util.c +2 -1
index 7cdfd28..3ac018c 100644
@@ -161,6 +161,7 @@ devt2devname (char *devname, int devname_len, char *devt)
 	struct stat statbuf;
 
 	memset(block_path, 0, sizeof(block_path));
+	memset(dev, 0, sizeof(dev));
 	if (sscanf(devt, "%u:%u", &major, &minor) != 2) {
 		condlog(0, "Invalid device number %s", devt);
 		return 1;
@@ -172,7 +173,7 @@ devt2devname (char *devname, int devname_len, char *devt)
 	if (stat("/sys/dev/block", &statbuf) == 0) {
 		/* Newer kernels have /sys/dev/block */
 		sprintf(block_path,"/sys/dev/block/%u:%u", major, minor);
-		if (stat(block_path, &statbuf) == 0) {
+		if (lstat(block_path, &statbuf) == 0) {
 			if (S_ISLNK(statbuf.st_mode) &&
 			    readlink(block_path, dev, FILE_NAME_SIZE) > 0) {
 				char *p = strrchr(dev, '/');
Signature · 1 line
1.8.0
author maintainer
#4 lore raw

PATCH v3 5/18 multipath: add support for

In reply to Benjamin Marzinski

This adds support for the retain_attached_hw_handler. When this is set to "yes", if the kernel has already attached a hardware handler to the multipath path devices, multipath will use that one, instead of its configured one. If no hardware handler is already attached, multipath use its configured one, if any. To properly ignore this on older kernels, I had to makes some changes to the version checking code.

---
 libmultipath/config.c    |  5 +++-
 libmultipath/config.h    |  4 ++-
 libmultipath/configure.c |  7 +++--
 libmultipath/defaults.h  |  1 +
 libmultipath/devmapper.c | 34 ++++------------------
 libmultipath/devmapper.h |  8 +++++-
 libmultipath/dict.c      | 74 ++++++++++++++++++++++++++++++++++++++++++++++++
 libmultipath/dmparser.c  |  3 ++
 libmultipath/propsel.c   | 29 ++++++++++++++++++-
 libmultipath/propsel.h   |  1 +
 libmultipath/structs.h   |  7 +++++
 11 files changed, 138 insertions(+), 35 deletions(-)
libmultipath/config.c +4 -1
index 51b4f45..5b26298 100644
@@ -326,6 +326,7 @@ merge_hwe (struct hwentry * dst, struct hwentry * src)
 	merge_num(fast_io_fail);
 	merge_num(dev_loss);
 	merge_num(user_friendly_names);
+	merge_num(retain_hwhandler);
 
 	return 0;
 }
@@ -385,6 +386,7 @@ store_hwe (vector hwtable, struct hwentry * dhwe)
 	hwe->fast_io_fail = dhwe->fast_io_fail;
 	hwe->dev_loss = dhwe->dev_loss;
 	hwe->user_friendly_names = dhwe->user_friendly_names;
+	hwe->retain_hwhandler = dhwe->retain_hwhandler;
 
 	if (dhwe->bl_product && !(hwe->bl_product = set_param_str(dhwe->bl_product)))
 		goto out;
@@ -501,7 +503,7 @@ load_config (char * file)
 		conf->verbosity = DEFAULT_VERBOSITY;
 
 	conf->udev = udev_new();
-	conf->dmrq = dm_drv_get_rq();
+	dm_drv_version(conf->version, TGT_MPATH);
 	conf->dev_type = DEV_NONE;
 	conf->minio = DEFAULT_MINIO;
 	conf->minio_rq = DEFAULT_MINIO_RQ;
@@ -517,6 +519,7 @@ load_config (char * file)
 	conf->checkint = DEFAULT_CHECKINT;
 	conf->max_checkint = MAX_CHECKINT(conf->checkint);
 	conf->fast_io_fail = DEFAULT_FAST_IO_FAIL;
+	conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER;
 
 	/*
 	 * preload default hwtable
libmultipath/config.h +3 -1
index 51fc492..7a1409f 100644
@@ -46,6 +46,7 @@ struct hwentry {
 	int fast_io_fail;
 	unsigned int dev_loss;
 	int user_friendly_names;
+	int retain_hwhandler;
 	char * bl_product;
 };
 
@@ -75,7 +76,6 @@ struct mpentry {
 };
 
 struct config {
-	int dmrq;
 	int verbosity;
 	int dry_run;
 	int list;
@@ -109,6 +109,8 @@ struct config {
 	mode_t mode;
 	uint32_t cookie;
 	int reassign_maps;
+	int retain_hwhandler;
+	unsigned int version[3];
 
 	char * dev;
 	struct udev * udev;
libmultipath/configure.c +5 -2
index 0f1fe43..131b5ad 100644
@@ -76,6 +76,7 @@ setup_map (struct multipath * mpp, char * params, int params_size)
 	select_fast_io_fail(mpp);
 	select_dev_loss(mpp);
 	select_reservation_key(mpp);
+	select_retain_hwhandler(mpp);
 
 	sysfs_set_scsi_tmo(mpp);
 	/*
@@ -217,8 +218,10 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
 			mpp->alias);
 		return;
 	}
-	if (!cmpp->selector || strncmp(cmpp->hwhandler, mpp->hwhandler,
-		    strlen(mpp->hwhandler))) {
+	if (mpp->retain_hwhandler != RETAIN_HWHANDLER_ON &&
+            (strlen(cmpp->hwhandler) != strlen(mpp->hwhandler) ||
+	     strncmp(cmpp->hwhandler, mpp->hwhandler,
+		    strlen(mpp->hwhandler)))) {
 		mpp->action = ACT_RELOAD;
 		condlog(3, "%s: set ACT_RELOAD (hwhandler change)",
 			mpp->alias);
libmultipath/defaults.h +1 -0
index 097c66f..f8a8774 100644
@@ -16,6 +16,7 @@
 #define DEFAULT_VERBOSITY	2
 #define DEFAULT_REASSIGN_MAPS	1
 #define DEFAULT_FAST_IO_FAIL	5
+#define DEFAULT_RETAIN_HWHANDLER RETAIN_HWHANDLER_OFF
 
 #define DEFAULT_CHECKINT	5
 #define MAX_CHECKINT(a)		(a << 2)
libmultipath/devmapper.c +5 -29
index 89615b0..f474e97 100644
@@ -98,12 +98,6 @@ dm_init(void) {
 	dm_log_init_verbose(conf ? conf->verbosity + 3 : 0);
 }
 
-#define VERSION_GE(v, minv) ( \
- (v[0] > minv[0]) || \
- ((v[0] == minv[0]) && (v[1] > minv[1])) || \
- ((v[0] == minv[0]) && (v[1] == minv[1]) && (v[2] >= minv[2])) \
-)
-
 static int
 dm_lib_prereq (void)
 {
@@ -126,7 +120,7 @@ dm_lib_prereq (void)
 	return 1;
 }
 
-static int
+int
 dm_drv_version (unsigned int * version, char * str)
 {
 	int r = 2;
@@ -135,6 +129,10 @@ dm_drv_version (unsigned int * version, char * str)
 	struct dm_versions *last_target;
 	unsigned int *v;
 
+	version[0] = 0;
+	version[1] = 0;
+	version[2] = 0;
+
 	if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS)))
 		return 1;
 
@@ -169,28 +167,6 @@ out:
 	return r;
 }
 
-int
-dm_drv_get_rq (void)
-{
-	unsigned int minv_dmrq[3] = {1, 1, 0};
-	unsigned int version[3] = {0, 0, 0};
-        unsigned int * v = version;
-
-	if (dm_drv_version(v, TGT_MPATH)) {
-		/* in doubt return least capable */
-		return 0;
-	}
-
-	/* test request based multipath capability */
-	if VERSION_GE(v, minv_dmrq) {
-		condlog(3, "activate request-based multipathing mode "
-			   "(driver >= v%u.%u.%u)",
-			minv_dmrq[0], minv_dmrq[1], minv_dmrq[2]);
-		return 1;
-	}
-	return 0;
-}
-
 static int
 dm_drv_prereq (void)
 {
libmultipath/devmapper.h +7 -1
index b08aa31..bf8ee91 100644
@@ -8,7 +8,7 @@
 
 void dm_init(void);
 int dm_prereq (void);
-int dm_drv_get_rq (void);
+int dm_drv_version (unsigned int * version, char * str);
 int dm_simplecmd_flush (int, const char *, int);
 int dm_simplecmd_noflush (int, const char *);
 int dm_addmap_create (struct multipath *mpp, char *params);
@@ -47,4 +47,10 @@ int dm_setgeometry(struct multipath *mpp);
 void udev_wait(unsigned int c);
 void udev_set_sync_support(int c);
 
+#define VERSION_GE(v, minv) ( \
+ (v[0] > minv[0]) || \
+ ((v[0] == minv[0]) && (v[1] > minv[1])) || \
+ ((v[0] == minv[0]) && (v[1] == minv[1]) && (v[2] >= minv[2])) \
+)
+
 #endif /* _DEVMAPPER_H */
libmultipath/dict.c +74 -0

110 lines not on this page · raw message

libmultipath/dmparser.c +3 -0
index 5184c41..2562ba1 100644
@@ -56,6 +56,7 @@ assemble_map (struct multipath * mp, char * params, int len)
 	int nr_priority_groups, initial_pg_nr;
 	char * p, * f;
 	char no_path_retry[] = "queue_if_no_path";
+	char retain_hwhandler[] = "retain_attached_hw_handler";
 	struct pathgroup * pgp;
 	struct path * pp;
 
@@ -81,6 +82,8 @@ assemble_map (struct multipath * mp, char * params, int len)
 	} else {
 		add_feature(&f, no_path_retry);
 	}
+	if (mp->retain_hwhandler == RETAIN_HWHANDLER_ON)
+		add_feature(&f, retain_hwhandler);
 
 	shift = snprintf(p, freechar, "%s %s %i %i",
 			 f, mp->hwhandler,
libmultipath/propsel.c +28 -1
index b8c6b08..c03926a 100644
@@ -513,7 +513,9 @@ select_minio_bio (struct multipath * mp)
 extern int
 select_minio (struct multipath * mp)
 {
-	if (conf->dmrq)
+	unsigned int minv_dmrq[3] = {1, 1, 0};
+
+	if (VERSION_GE(conf->version, minv_dmrq))
 		return select_minio_rq(mp);
 	else
 		return select_minio_bio(mp);
@@ -679,3 +681,28 @@ select_reservation_key (struct multipath * mp)
 	return 0;
 }
 
+extern int
+select_retain_hwhandler (struct multipath * mp)
+{
+	unsigned int minv_dm_retain[3] = {1, 5, 0};
+
+	if (!VERSION_GE(conf->version, minv_dm_retain)) {
+		mp->retain_hwhandler = RETAIN_HWHANDLER_OFF;
+		condlog(3, "%s: retain_attached_hw_hander disabled (requires kernel version >= 1.5.0)", mp->alias);
+		return 0;
+	}
+
+	if (mp->hwe && mp->hwe->retain_hwhandler) {
+		mp->retain_hwhandler = mp->hwe->retain_hwhandler;
+		condlog(3, "%s: retain_attached_hw_handler = %d (controller default)", mp->alias, mp->retain_hwhandler);
+		return 0;
+	}
+	if (conf->retain_hwhandler) {
+		mp->retain_hwhandler = conf->retain_hwhandler;
+		condlog(3, "%s: retain_attached_hw_handler = %d (config file default)", mp->alias, mp->retain_hwhandler);
+		return 0;
+	}
+	mp->retain_hwhandler = 0;
+	condlog(3, "%s: retain_attached_hw_handler = %d (compiled in default)", mp->alias, mp->retain_hwhandler);
+	return 0;
+}
libmultipath/propsel.h +1 -0
index 4e931d4..1bf6e45 100644
@@ -18,3 +18,4 @@ int select_gid(struct multipath *mp);
 int select_fast_io_fail(struct multipath *mp);
 int select_dev_loss(struct multipath *mp);
 int select_reservation_key(struct multipath *mp);
+int select_retain_hwhandler (struct multipath * mp);
libmultipath/structs.h +7 -0
index 16e940b..92cd2e4 100644
@@ -101,6 +101,12 @@ enum user_friendly_names_states {
 	USER_FRIENDLY_NAMES_ON,
 };
 
+enum retain_hwhandler_states {
+	RETAIN_HWHANDLER_UNDEF,
+	RETAIN_HWHANDLER_OFF,
+	RETAIN_HWHANDLER_ON,
+};
+
 struct scsi_idlun {
 	int dev_id;
 	int host_unique_id;
@@ -192,6 +198,7 @@ struct multipath {
 	int flush_on_last_del;
 	int attribute_flags;
 	int fast_io_fail;
+	int retain_hwhandler;
 	unsigned int dev_loss;
 	uid_t uid;
 	gid_t gid;
Signature · 1 line
1.8.0
author maintainer
#5 lore raw

PATCH v3 6/18 multipath: remove duplicates from multipath

In reply to Benjamin Marzinski

Added code to remove duplcate entries in the devices section, and the blacklist devices section of the builtin configuration table. The only change to setup_default_blist is the addition of _blacklist_device() to check if the device's bl_product entry already exists.

---
 libmultipath/blacklist.c | 91 +++++++++++++++++++++++++-----------------------
 libmultipath/config.c    | 19 ++++++++--
 2 files changed, 63 insertions(+), 47 deletions(-)
libmultipath/blacklist.c +47 -44
index f369517..49a40f9 100644
@@ -96,50 +96,6 @@ set_ble_device (vector blist, char * vendor, char * product, int origin)
 }
 
 int
-setup_default_blist (struct config * conf)
-{
-	struct blentry * ble;
-	struct hwentry *hwe;
-	char * str;
-	int i;
-
-	str = STRDUP("^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*");
-	if (!str)
-		return 1;
-	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
-		return 1;
-
-	str = STRDUP("^hd[a-z]");
-	if (!str)
-		return 1;
-	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
-		return 1;
-
-	str = STRDUP("^dcssblk[0-9]*");
-	if (!str)
-		return 1;
-	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
-		return 1;
-
-	vector_foreach_slot (conf->hwtable, hwe, i) {
-		if (hwe->bl_product) {
-			if (alloc_ble_device(conf->blist_device))
-				return 1;
-			ble = VECTOR_SLOT(conf->blist_device,
-					  VECTOR_SIZE(conf->blist_device) -1);
-			if (set_ble_device(conf->blist_device,
-					   STRDUP(hwe->vendor),
-					   STRDUP(hwe->bl_product),
-					   ORIGIN_DEFAULT)) {
-				FREE(ble);
-				return 1;
-			}
-		}
-	}
-	return 0;
-}
-
-int
 _blacklist_exceptions (vector elist, char * str)
 {
 	int i;
@@ -193,6 +149,53 @@ _blacklist_device (vector blist, char * vendor, char * product)
 	return 0;
 }
 
+int
+setup_default_blist (struct config * conf)
+{
+	struct blentry * ble;
+	struct hwentry *hwe;
+	char * str;
+	int i;
+
+	str = STRDUP("^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*");
+	if (!str)
+		return 1;
+	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
+		return 1;
+
+	str = STRDUP("^hd[a-z]");
+	if (!str)
+		return 1;
+	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
+		return 1;
+
+	str = STRDUP("^dcssblk[0-9]*");
+	if (!str)
+		return 1;
+	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
+		return 1;
+
+	vector_foreach_slot (conf->hwtable, hwe, i) {
+		if (hwe->bl_product) {
+			if (_blacklist_device(conf->blist_device, hwe->vendor,
+					      hwe->bl_product))
+				continue;
+			if (alloc_ble_device(conf->blist_device))
+				return 1;
+			ble = VECTOR_SLOT(conf->blist_device,
+					  VECTOR_SIZE(conf->blist_device) -1);
+			if (set_ble_device(conf->blist_device,
+					   STRDUP(hwe->vendor),
+					   STRDUP(hwe->bl_product),
+					   ORIGIN_DEFAULT)) {
+				FREE(ble);
+				return 1;
+			}
+		}
+	}
+	return 0;
+}
+
 #define LOG_BLIST(M) \
 	if (vendor && product)						 \
 		condlog(3, "%s: (%s:%s) %s", dev, vendor, product, (M)); \
libmultipath/config.c +16 -3
index 5b26298..50863b2 100644
@@ -25,13 +25,19 @@
 static int
 hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2)
 {
-	if (hwe1->vendor && hwe2->vendor && strcmp(hwe1->vendor, hwe2->vendor))
+	if ((hwe2->vendor && !hwe1->vendor) ||
+	    (hwe1->vendor && (!hwe2->vendor ||
+			      strcmp(hwe1->vendor, hwe2->vendor))))
 		return 1;
 
-	if (hwe1->product && hwe2->product && strcmp(hwe1->product, hwe2->product))
+	if ((hwe2->product && !hwe1->product) ||
+	    (hwe1->product && (!hwe2->product ||
+			      strcmp(hwe1->product, hwe2->product))))
 		return 1;
 
-	if (hwe1->revision && hwe2->revision && strcmp(hwe1->revision, hwe2->revision))
+	if ((hwe2->revision && !hwe1->revision) ||
+	    (hwe1->revision && (!hwe2->revision ||
+			      strcmp(hwe1->revision, hwe2->revision))))
 		return 1;
 
 	return 0;
@@ -416,6 +422,13 @@ factorize_hwtable (vector hw, int n)
 				continue;
 			/* dup */
 			merge_hwe(hwe2, hwe1);
+			if (hwe_strmatch(hwe2, hwe1) == 0) {
+				vector_del_slot(hw, i);
+				free_hwe(hwe1);
+				n -= 1;
+				i -= 1;
+				break;
+			}
 		}
 	}
 	return 0;
Signature · 1 line
1.8.0
author maintainer
#6 lore raw

PATCH v3 7/18 multipath: add detect_prio option to autodetect

In reply to Benjamin Marzinski

This patch adds a new multipath.conf option, detect_prio. If set to yes, multipathd will try to determine the correct prioritizer for the device. If it finds one, that will be used instead of its configured prioritizer. If none is found, the configured prioritizer will be used. It can currently only detect ALUA devices.

Also fixed and issue with select_prio where in the devices section, it was passing in the prio name string instead of the prio args string to prio_get()

---
 libmultipath/Makefile    |  2 +-
 libmultipath/config.c    |  3 ++
 libmultipath/config.h    |  2 ++
 libmultipath/defaults.h  |  1 +
 libmultipath/dict.c      | 74 ++++++++++++++++++++++++++++++++++++++++++++++++
 libmultipath/discovery.c |  1 +
 libmultipath/propsel.c   | 39 ++++++++++++++++++++++++-
 libmultipath/propsel.h   |  1 +
 libmultipath/structs.h   |  7 +++++
 9 files changed, 128 insertions(+), 2 deletions(-)
libmultipath/Makefile +1 -1
index 0395602..22d3844 100644
@@ -15,7 +15,7 @@ OBJS = memory.o parser.o vector.o devmapper.o \
        pgpolicies.o debug.o regex.o defaults.o uevent.o \
        switchgroup.o uxsock.o print.o alias.o log_pthread.o \
        log.o configure.o structs_vec.o sysfs.o prio.o checkers.o \
-       lock.o waiter.o file.o wwids.o
+       lock.o waiter.o file.o wwids.o prioritizers/alua_rtpg.o
 
 LIBDM_API_FLUSH = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_no_flush' /usr/include/libdevmapper.h)
 
libmultipath/config.c +3 -0
index 50863b2..b317e32 100644
@@ -333,6 +333,7 @@ merge_hwe (struct hwentry * dst, struct hwentry * src)
 	merge_num(dev_loss);
 	merge_num(user_friendly_names);
 	merge_num(retain_hwhandler);
+	merge_num(detect_prio);
 
 	return 0;
 }
@@ -393,6 +394,7 @@ store_hwe (vector hwtable, struct hwentry * dhwe)
 	hwe->dev_loss = dhwe->dev_loss;
 	hwe->user_friendly_names = dhwe->user_friendly_names;
 	hwe->retain_hwhandler = dhwe->retain_hwhandler;
+	hwe->detect_prio = dhwe->detect_prio;
 
 	if (dhwe->bl_product && !(hwe->bl_product = set_param_str(dhwe->bl_product)))
 		goto out;
@@ -533,6 +535,7 @@ load_config (char * file)
 	conf->max_checkint = MAX_CHECKINT(conf->checkint);
 	conf->fast_io_fail = DEFAULT_FAST_IO_FAIL;
 	conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER;
+	conf->detect_prio = DEFAULT_DETECT_PRIO;
 
 	/*
 	 * preload default hwtable
libmultipath/config.h +2 -0
index 7a1409f..4ade355 100644
@@ -47,6 +47,7 @@ struct hwentry {
 	unsigned int dev_loss;
 	int user_friendly_names;
 	int retain_hwhandler;
+	int detect_prio;
 	char * bl_product;
 };
 
@@ -110,6 +111,7 @@ struct config {
 	uint32_t cookie;
 	int reassign_maps;
 	int retain_hwhandler;
+	int detect_prio;
 	unsigned int version[3];
 
 	char * dev;
libmultipath/defaults.h +1 -0
index f8a8774..32948d8 100644
@@ -17,6 +17,7 @@
 #define DEFAULT_REASSIGN_MAPS	1
 #define DEFAULT_FAST_IO_FAIL	5
 #define DEFAULT_RETAIN_HWHANDLER RETAIN_HWHANDLER_OFF
+#define DEFAULT_DETECT_PRIO DETECT_PRIO_OFF
 
 #define DEFAULT_CHECKINT	5
 #define MAX_CHECKINT(a)		(a << 2)
libmultipath/dict.c +74 -0

110 lines not on this page · raw message

libmultipath/discovery.c +1 -0
index 3ffdc62..45570dc 100644
@@ -782,6 +782,7 @@ get_prio (struct path * pp)
 	struct prio * p = &pp->prio;
 
 	if (!prio_selected(p)) {
+		select_detect_prio(pp);
 		select_prio(pp);
 		if (!prio_selected(p)) {
 			condlog(3, "%s: no prio selected", pp->dev);
libmultipath/propsel.c +38 -1
index c03926a..a7e1fc2 100644
@@ -17,6 +17,7 @@
 #include "devmapper.h"
 #include "prio.h"
 #include "discovery.h"
+#include "prioritizers/alua_rtpg.h"
 #include <inttypes.h>
 
 pgpolicyfn *pgpolicies[] = {
@@ -382,12 +383,30 @@ select_getuid (struct path * pp)
 	return 0;
 }
 
+void
+detect_prio(struct path * pp)
+{
+	struct prio *p = &pp->prio;
+
+	if (get_target_port_group_support(pp->fd) > 0)
+		prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS);
+}
+
 extern int
 select_prio (struct path * pp)
 {
 	struct mpentry * mpe;
 	struct prio * p = &pp->prio;
 
+	if (pp->detect_prio == DETECT_PRIO_ON) {
+		detect_prio(pp);
+		if (prio_selected(p)) {
+			condlog(3, "%s: prio = %s (detected setting)",
+				pp->dev, prio_name(p));
+			return 0;
+		}
+	}
+
 	if ((mpe = find_mpe(pp->wwid))) {
 		if (mpe->prio_name) {
 			prio_get(p, mpe->prio_name, mpe->prio_args);
@@ -398,7 +417,7 @@ select_prio (struct path * pp)
 	}
 
 	if (pp->hwe && pp->hwe->prio_name) {
-		prio_get(p, pp->hwe->prio_name, pp->hwe->prio_name);
+		prio_get(p, pp->hwe->prio_name, pp->hwe->prio_args);
 		condlog(3, "%s: prio = %s (controller setting)",
 			pp->dev, pp->hwe->prio_name);
 		condlog(3, "%s: prio args = %s (controller setting)",
@@ -706,3 +725,21 @@ select_retain_hwhandler (struct multipath * mp)
 	condlog(3, "%s: retain_attached_hw_handler = %d (compiled in default)", mp->alias, mp->retain_hwhandler);
 	return 0;
 }
+
+extern int
+select_detect_prio (struct path * pp)
+{
+	if (pp->hwe && pp->hwe->detect_prio) {
+		pp->detect_prio = pp->hwe->detect_prio;
+		condlog(3, "%s: detect_prio = %d (controller default)", pp->dev, pp->detect_prio);
+		return 0;
+	}
+	if (conf->detect_prio) {
+		pp->detect_prio = conf->detect_prio;
+		condlog(3, "%s: detect_prio = %d (config file default)", pp->dev, pp->detect_prio);
+		return 0;
+	}
+	pp->detect_prio = 0;
+	condlog(3, "%s: detect_prio = %d (compiled in default)", pp->dev, pp->detect_prio);
+	return 0;
+}
libmultipath/propsel.h +1 -0
index 1bf6e45..eb1e534 100644
@@ -19,3 +19,4 @@ int select_fast_io_fail(struct multipath *mp);
 int select_dev_loss(struct multipath *mp);
 int select_reservation_key(struct multipath *mp);
 int select_retain_hwhandler (struct multipath * mp);
+int select_detect_prio(struct path * pp);
libmultipath/structs.h +7 -0
index 92cd2e4..2beccb3 100644
@@ -107,6 +107,12 @@ enum retain_hwhandler_states {
 	RETAIN_HWHANDLER_ON,
 };
 
+enum detect_prio_states {
+	DETECT_PRIO_UNDEF,
+	DETECT_PRIO_OFF,
+	DETECT_PRIO_ON,
+};
+
 struct scsi_idlun {
 	int dev_id;
 	int host_unique_id;
@@ -165,6 +171,7 @@ struct path {
 	int failcount;
 	int priority;
 	int pgindex;
+	int detect_prio;
 	char * uid_attribute;
 	struct prio prio;
 	char * prio_args;
Signature · 1 line
1.8.0
author maintainer
#7 lore raw

PATCH v3 8/18 multipath: update netapp config

In reply to Benjamin Marzinski

The netapp config now used the retain_attached_hwhandler and detect_prio options to automatically configure correctly for both ALUA and non-ALUA setups. They also requested that dev_loss_tmo be set to the maximum for netapp devices.

---
 libmultipath/hwtable.c | 3 +++
 1 file changed, 3 insertions(+)
libmultipath/hwtable.c +3 -0
index 595edba..6a8dfe3 100644
@@ -789,9 +789,12 @@ static struct hwentry default_hw[] = {
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
 		.minio         = 128,
+		.dev_loss      = MAX_DEV_LOSS_TMO,
 		.checker_name  = TUR,
 		.prio_name     = PRIO_ONTAP,
 		.prio_args     = NULL,
+		.retain_hwhandler = RETAIN_HWHANDLER_ON,
+		.detect_prio   = DETECT_PRIO_ON,
 	},
 	/*
 	 * NEXENTA/COMSTAR controller family
Signature · 1 line
1.8.0
author maintainer
#8 lore raw

PATCH v3 9/18 multipath: fix set_oom_adj

In reply to Benjamin Marzinski

Fix set_oom_adj() to work correclty if OOM_ADJUST_MIN isn't defined.

---
 multipathd/main.c | 4 ++++
 1 file changed, 4 insertions(+)
multipathd/main.c +4 -0
index 8917499..a6afebb 100644
@@ -1542,8 +1542,12 @@ set_oom_adj (void)
 				strerror(errno));
 			return;
 		}
+#ifdef OOM_ADJUST_MIN
 		file = "/proc/self/oom_adj";
 		score = OOM_ADJUST_MIN;
+#else
+		retry = 0;
+#endif
 	} while (retry--);
 	condlog(0, "couldn't adjust oom score");
 }
Signature · 1 line
1.8.0
author maintainer
#9 lore raw

PATCH v3 10/18 multipath: rely on udev device creation for kpartx

In reply to Benjamin Marzinski

Since kpartx and multipathd don't wait on udev creating the device, there was a race between libdevmapper and udev to create the device. This meant that sometimes the /dev/mapper/ devices were devnodes, and sometimes they were symlinks. Now, for multipathd and kpartx called without -s, libdevmapper won't create the device nodes, so that udev will always be responsible for it.

---
 kpartx/devmapper.c       | 4 ++--
 kpartx/devmapper.h       | 2 ++
 kpartx/kpartx.c          | 6 +++---
 libmultipath/devmapper.c | 6 +++---
 4 files changed, 10 insertions(+), 8 deletions(-)
kpartx/devmapper.c +2 -2
index 4baebd9..24a43ee 100644
@@ -78,7 +78,7 @@ dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie) {
 	if (no_flush)
 		dm_task_no_flush(dmt);
 
-	if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, 0))
+	if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, (udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK))
 		goto out;
 	r = dm_task_run(dmt);
 
@@ -128,7 +128,7 @@ dm_addmap (int task, const char *name, const char *target,
 
 	dm_task_no_open_count(dmt);
 
-	if (task == DM_DEVICE_CREATE && !dm_task_set_cookie(dmt, cookie, 0))
+	if (task == DM_DEVICE_CREATE && !dm_task_set_cookie(dmt, cookie, (udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK))
 		goto addout;
 	r = dm_task_run (dmt);
 
kpartx/devmapper.h +2 -0
index 8e350a0..0edc063 100644
@@ -2,6 +2,8 @@
 #define MINOR(dev)      ((dev & 0xff) | ((dev >> 12) & 0xfff00))
 #define MKDEV(ma,mi)    ((mi & 0xff) | (ma << 8) | ((mi & ~0xff) << 12))
 
+extern int udev_sync;
+
 int dm_prereq (char *, int, int, int);
 int dm_simplecmd (int, const char *, int, uint32_t *);
 int dm_addmap (int, const char *, const char *, const char *, uint64_t,
kpartx/kpartx.c +3 -3
index f359afe..dd57294 100644
@@ -56,6 +56,7 @@ struct pt {
 } pts[MAXTYPES];
 
 int ptct = 0;
+int udev_sync = 0;
 
 static void
 addpts(char *t, ptreader f)
@@ -205,7 +206,6 @@ main(int argc, char **argv){
 	int loopro = 0;
 	int hotplug = 0;
 	int loopcreated = 0;
-	int sync = 0;
 	struct stat buf;
 	uint32_t cookie = 0;
 
@@ -267,7 +267,7 @@ main(int argc, char **argv){
 			what = DELETE;
 			break;
 		case 's':
-			sync = 1;
+			udev_sync = 1;
 			break;
 		case 'u':
 			what = UPDATE;
@@ -278,7 +278,7 @@ main(int argc, char **argv){
 	}
 
 #ifdef LIBDM_API_COOKIE
-	if (!sync)
+	if (!udev_sync)
 		dm_udev_set_sync_support(0);
 #endif
 
libmultipath/devmapper.c +3 -3
index f474e97..67481c4 100644
@@ -219,7 +219,7 @@ dm_simplecmd (int task, const char *name, int no_flush, int need_sync) {
 		dm_task_no_flush(dmt);		/* for DM_DEVICE_SUSPEND/RESUME */
 #endif
 
-	if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, 0))
+	if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
 		goto out;
 	r = dm_task_run (dmt);
 
@@ -284,7 +284,7 @@ dm_addmap (int task, const char *target, struct multipath *mpp, char * params,
 	dm_task_no_open_count(dmt);
 
 	if (task == DM_DEVICE_CREATE &&
-	    !dm_task_set_cookie(dmt, &conf->cookie, 0))
+	    !dm_task_set_cookie(dmt, &conf->cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
 		goto freeout;
 	r = dm_task_run (dmt);
 
@@ -1268,7 +1268,7 @@ dm_rename (char * old, char * new)
 
 	dm_task_no_open_count(dmt);
 
-	if (!dm_task_set_cookie(dmt, &conf->cookie, 0))
+	if (!dm_task_set_cookie(dmt, &conf->cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
 		goto out;
 	if (!dm_task_run(dmt))
 		goto out;
Signature · 1 line
1.8.0
author maintainer
#10 lore raw

PATCH v3 11/18 multipath: update documentation

In reply to Benjamin Marzinski

Add some missing options to the documentation.

---
 multipath/main.c           |  1 +
 multipath/multipath.8      | 14 +++++++++++++-
 multipath/multipath.conf.5 | 31 +++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 1 deletion(-)
multipath/main.c +1 -0
index 396c4b9..e526f7c 100644
@@ -101,6 +101,7 @@ usage (char * progname)
 		"  -d      dry run, do not create or update devmaps\n" \
 		"  -t      dump internal hardware table\n" \
 		"  -r      force devmap reload\n" \
+		"  -B      treat the bindings file as read only\n" \
 		"  -p      policy failover|multibus|group_by_serial|group_by_prio\n" \
 		"  -b fil  bindings file location\n" \
 		"  -p pol  force all maps to specified path grouping policy :\n" \
multipath/multipath.8 +13 -1
index a112df7..a63a9f1 100644
@@ -5,8 +5,10 @@ multipath \- Device mapper target autoconfig
 .B multipath
 .RB [\| \-v\ \c
 .IR verbosity \|]
+.RB [\| \-b\ \c
+.IR bindings_file \|]
 .RB [\| \-d \|]
-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F \| \-B \|]
+.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r \|]
 .RB [\| \-p\ \c
 .BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
 .RB [\| device \|]
@@ -56,6 +58,16 @@ force devmap reload
 .B \-B
 treat the bindings file as read only
 .TP
+.B \-b " bindings_file"
+set user_friendly_names bindings file location.  The default is
+/etc/multipath/bindings
+.TP
+.B \-c
+check if a block device should be a path in a multipath device
+.TP
+.B \-q
+allow device tables with queue_if_no_path when multipathd is not running
+.TP
 .BI \-p " policy"
 force new maps to use the specified policy:
 .RS 1.2i
multipath/multipath.conf.5 +31 -0
index 92fb0c1..38c08f4 100644
@@ -375,6 +375,31 @@ errors are logged at level 3 until the device is restored. If set to
 .I always
 , multipathd always logs the path checker error at logging level 2. Default is
 .I always
+.TP
+.B reservation_key
+This is the service action reservation key used by mpathpersist.  It must be
+set for all multipath devices using persistent reservations, and it must be
+the same as the RESERVATION KEY field of the PERSISTENT RESERVE OUT parameter
+list which contains an 8-byte value provided by the application client to the
+device server to identify the I_T nexus. It is unset by default.
+.TP
+.B retain_attached_hw_handler
+If set to
+.I yes
+and the scsi layer has already attached a hardware_handler to the device,
+multipath will not force the device to use the hardware_handler specified by
+mutipath.conf. If the scsi layer has not attached a hardware handler,
+multipath will continue to use its configured hardware handler. Default is
+.I no
+.TP
+.B detect_prio
+If set to
+.I yes
+, multipath will try to detect if the device supports ALUA. If so, the device
+will automatically use the
+.I alua
+prioritizer. If not, the prioritizer will be selected as usual. Default is
+.I no
 .
 .SH "blacklist section"
 The
@@ -474,6 +499,8 @@ section:
 .B rr_min_io_q
 .TP
 .B features
+.TP
+.B reservation_key
 .RE
 .PD
 .LP
@@ -560,6 +587,10 @@ section:
 .B dev_loss_tmo
 .TP
 .B flush_on_last_del
+.TP
+.B retain_attached_hw_handler
+.TP
+.B detect_prio
 .RE
 .PD
 .LP
Signature · 1 line
1.8.0
author maintainer
#11 lore raw

PATCH v3 12/18 multipath: make multipathd work with new dm/lvm

In reply to Benjamin Marzinski

multipathd needs to get setup before lvm (lvm2-activation-early.service). To do this, it needs to get started in sysinit.target like the other dm services.

---
 multipathd/multipathd.service | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
multipathd/multipathd.service +4 -2
index 38189c5..d6da067 100644
@@ -1,7 +1,9 @@
 [Unit]
 Description=Device-Mapper Multipath Device Controller
-Before=iscsi.service iscsid.service
+Before=iscsi.service iscsid.service lvm2-activation-early.service
 After=syslog.target
+DefaultDependencies=no
+Conflicts=shutdown.target
 
 [Service]
 Type=forking
@@ -11,4 +13,4 @@ ExecReload=/sbin/multipathd reconfigure
 #ExecStop=/path/to/scrip delete-me if not necessary
 
 [Install]
-WantedBy=multi-user.target
+WantedBy=sysinit.target
Signature · 1 line
1.8.0
author maintainer
#12 lore raw

PATCH v3 13/18 multipath: make reservation_key print out correctly

In reply to Benjamin Marzinski

This patch fixes the reservation_key print functions, so they print it out like it was in the configuration file. Also, it keeps cli_getprstatus() from writing over random memory.

---
 libmultipath/dict.c       | 31 +++++++++++++++++++++++++++++--
 multipathd/cli_handlers.c |  2 +-
 2 files changed, 30 insertions(+), 3 deletions(-)
libmultipath/dict.c +29 -2
index 788ffae..a54dda9 100644
@@ -2052,8 +2052,22 @@ snprint_mp_prio_args(char * buff, int len, void * data)
 static int
 snprint_mp_reservation_key (char * buff, int len, void * data)
 {
+	int i;
+	unsigned char *keyp;
+	uint64_t prkey = 0;
 	struct mpentry * mpe = (struct mpentry *)data;
-	return snprintf(buff, len, "%s" , mpe->reservation_key);
+
+	if (!mpe->reservation_key)
+		return 0;
+	keyp = (unsigned char *)mpe->reservation_key;
+	for (i = 0; i < 8; i++) {
+		if (i > 0)
+			prkey <<= 8;
+		prkey |= *keyp;
+		keyp++;
+	}
+
+	return snprintf(buff, len, "0x%" PRIx64, prkey);
 }
 
 	static int
@@ -2721,7 +2735,20 @@ snprint_def_wwids_file (char * buff, int len, void * data)
 static int
 snprint_def_reservation_key(char * buff, int len, void * data)
 {
-	return snprintf(buff, len, "%s", conf->reservation_key);
+	int i;
+	unsigned char *keyp;
+	uint64_t prkey = 0;
+
+	if (!conf->reservation_key)
+		return 0;
+	keyp = (unsigned char *)conf->reservation_key;
+	for (i = 0; i < 8; i++) {
+		if (i > 0)
+			prkey <<= 8;
+		prkey |= *keyp;
+		keyp++;
+	}
+	return snprintf(buff, len, "0x%" PRIx64, prkey);
 }
 
 static int
multipathd/cli_handlers.c +1 -1
index 6053b5a..4df37fe 100644
@@ -947,7 +947,7 @@ cli_getprstatus (void * v, char ** reply, int * len, void * data)
 
 
 	sprintf(*reply,"%d",mpp->prflag);
-	*reply[1]='\0';
+	(*reply)[1]='\0';
 
 
 	condlog(3, "%s: reply = %s", param, *reply);
Signature · 1 line
1.8.0
Acked-by on v3 13/18
#13 lore raw

Re: [PATCH V3 13/18] multipath: make reservation_key print out correctly

Thanks,
Vijay

Quoted 84 lines · On January 12, 2013 11:35 AM; Benjamin Marzinski wrote:

This patch fixes the reservation_key print functions, so they print it out like it was in the configuration file. Also, it keeps cli_getprstatus() from writing over random memory.

---
libmultipath/dict.c | 31 +++++++++++++++++++++++++++++--
multipathd/cli_handlers.c | 2 +-

2 files changed, 30 insertions(+), 3 deletions(-)
libmultipath/dict.c +0 -0
index 788ffae..a54dda9 100644
@@ -2052,8 +2052,22 @@ snprint_mp_prio_args(char * buff, int len, void *
 data)

static int
snprint_mp_reservation_key (char * buff, int len, void * data) {

libmultipath/dict.c +3 -0
+	int i;
+	unsigned char *keyp;
+	uint64_t prkey = 0;
	struct mpentry * mpe = (struct mpentry *)data;
libmultipath/dict.c +12 -1
-	return snprintf(buff, len, "%s" , mpe->reservation_key);
+
+	if (!mpe->reservation_key)
+		return 0;
+	keyp = (unsigned char *)mpe->reservation_key;
+	for (i = 0; i < 8; i++) {
+		if (i > 0)
+			prkey <<= 8;
+		prkey |= *keyp;
+		keyp++;
+	}
+
+	return snprintf(buff, len, "0x%" PRIx64, prkey);

}

static int

libmultipath/dict.c +0 -0
@@ -2721,7 +2735,20 @@ snprint_def_wwids_file (char * buff, int len, void *
 data)

static int
snprint_def_reservation_key(char * buff, int len, void * data) {

libmultipath/dict.c +14 -1
-	return snprintf(buff, len, "%s", conf->reservation_key);
+	int i;
+	unsigned char *keyp;
+	uint64_t prkey = 0;
+
+	if (!conf->reservation_key)
+		return 0;
+	keyp = (unsigned char *)conf->reservation_key;
+	for (i = 0; i < 8; i++) {
+		if (i > 0)
+			prkey <<= 8;
+		prkey |= *keyp;
+		keyp++;
+	}
+	return snprintf(buff, len, "0x%" PRIx64, prkey);

}

static int

multipathd/cli_handlers.c +1 -1
index 6053b5a..4df37fe 100644
@@ -947,7 +947,7 @@ cli_getprstatus (void * v, char ** reply, int * len,
 void * data)
 
 
 	sprintf(*reply,"%d",mpp->prflag);
-	*reply[1]='\0';
+	(*reply)[1]='\0';
 
 
	condlog(3, "%s: reply = %s", param, *reply);

--
1.8.0

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

author maintainer
#14 lore raw

PATCH v3 14/18 multipath: storagetek 6180 config

In reply to Benjamin Marzinski

New StorageTek default config.

---
 libmultipath/hwtable.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
libmultipath/hwtable.c +15 -0
index 6a8dfe3..6924a61 100644
@@ -1018,6 +1018,21 @@ static struct hwentry default_hw[] = {
 		.prio_name     = PRIO_RDAC,
 		.prio_args     = NULL,
 	},
+	/* StorageTek 6180 */
+	{
+		.vendor        = "SUN",
+		.product       = "SUN_6180",
+		.features      = DEFAULT_FEATURES,
+		.hwhandler     = "1 rdac",
+		.pgpolicy      = GROUP_BY_PRIO,
+		.pgfailback    = -FAILBACK_IMMEDIATE,
+		.rr_weight     = RR_WEIGHT_NONE,
+		.no_path_retry = NO_PATH_RETRY_QUEUE,
+		.minio         = DEFAULT_MINIO,
+		.minio_rq      = DEFAULT_MINIO_RQ,
+		.checker_name  = RDAC,
+		.prio_name     = PRIO_RDAC,
+	},
 	/* LSI/Engenio/NetApp E-Series RDAC storage */
 	{
 		.vendor        = "(LSI|ENGENIO)",
Signature · 1 line
1.8.0
author maintainer
#15 lore raw

PATCH v3 15/18 multipath: Fix kpartx and udevd race

In reply to Benjamin Marzinski

Sometimes when kpartx is used to view partition data on disk image files, udev still has the loop device open when kpartx is trying to tear it down. This causes the LOOP_CLR_FD ioctl to fail with EBUSY. kpartx now retries in this case.

---
 kpartx/lopart.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
kpartx/lopart.c +12 -4
index 79d8328..b1007e1 100644
@@ -286,6 +286,7 @@ set_loop (const char *device, const char *file, int offset, int *loopro)
 extern int 
 del_loop (const char *device)
 {
+	int retries = 3;
 	int fd;
 
 	if ((fd = open (device, O_RDONLY)) < 0) {
@@ -295,10 +296,17 @@ del_loop (const char *device)
 		return 1;
 	}
 
-	if (ioctl (fd, LOOP_CLR_FD, 0) < 0) {
-		perror ("ioctl: LOOP_CLR_FD");
-		close (fd);
-		return 1;
+	while (ioctl (fd, LOOP_CLR_FD, 0) < 0) {
+		if (errno != EBUSY || retries-- <= 0) {
+			perror ("ioctl: LOOP_CLR_FD");
+			close (fd);
+			return 1;
+		}
+		fprintf(stderr,
+			"loop: device %s still in use, retrying delete\n",
+			device);
+		sleep(1);
+		continue;
 	}
 
 	close (fd);
Signature · 1 line
1.8.0
author maintainer
#16 lore raw

PATCH v3 16/18 multipath: Check blacklists as soon as possible

In reply to Benjamin Marzinski

Multipath does a lot of unnecessary work on devices blacklisted by device type or wwid before ignoring them. When dealing with a large number of devices blacklisted this way, multipath can take long time to complete. The patch makes sure that multipath is checking the blacklists as soon as it has the necessary information to do so. To do this, pathinfo() now takes another flag DI_BLACKLIST, which is only used by store_pathinfo(), that tells it to check if the device should be blacklisted. Doing this cleanly also required changing how store_pathinfo() and rlookup_binding() are called.

---
 libmultipath/alias.c      | 47 +++++++++++++++++--------------
 libmultipath/alias.h      |  2 +-
 libmultipath/configure.c  | 70 +++++++++++++++++++++++++++++++----------------
 libmultipath/configure.h  |  2 +-
 libmultipath/discovery.c  | 47 +++++++++++++++++++++++--------
 libmultipath/discovery.h  | 11 +++++---
 libmultipath/util.c       |  2 +-
 multipath/main.c          | 14 +++++-----
 multipathd/cli_handlers.c | 11 ++++----
 multipathd/main.c         | 22 +++++++--------
 10 files changed, 140 insertions(+), 88 deletions(-)
libmultipath/alias.c +26 -21
index 2b42606..d913294 100644
@@ -13,6 +13,9 @@
 #include "uxsock.h"
 #include "alias.h"
 #include "file.h"
+#include "vector.h"
+#include "checkers.h"
+#include "structs.h"
 
 
 /*
@@ -121,23 +124,23 @@ lookup_binding(FILE *f, char *map_wwid, char **map_alias, char *prefix)
 }
 
 static int
-rlookup_binding(FILE *f, char **map_wwid, char *map_alias)
+rlookup_binding(FILE *f, char *buff, char *map_alias)
 {
-	char buf[LINE_MAX];
+	char line[LINE_MAX];
 	unsigned int line_nr = 0;
 	int id = 0;
 
-	*map_wwid = NULL;
+	buff[0] = '\0';
 
-	while (fgets(buf, LINE_MAX, f)) {
+	while (fgets(line, LINE_MAX, f)) {
 		char *c, *alias, *wwid;
 		int curr_id;
 
 		line_nr++;
-		c = strpbrk(buf, "#\n\r");
+		c = strpbrk(line, "#\n\r");
 		if (c)
 			*c = '\0';
-		alias = strtok(buf, " \t");
+		alias = strtok(line, " \t");
 		if (!alias) /* blank line */
 			continue;
 		curr_id = scan_devname(alias, NULL); /* TBD: Why this call? */
@@ -150,13 +153,16 @@ rlookup_binding(FILE *f, char **map_wwid, char *map_alias)
 				line_nr);
 			continue;
 		}
+		if (strlen(wwid) > WWID_SIZE - 1) {
+			condlog(3,
+				"Ignoring too large wwid at %u in bindings file", line_nr);
+			continue;
+		}
 		if (strcmp(alias, map_alias) == 0){
 			condlog(3, "Found matching alias [%s] in bindings file."
 				"\nSetting wwid to %s", alias, wwid);
-			*map_wwid = strdup(wwid);
-			if (*map_wwid == NULL)
-				condlog(0, "Cannot copy alias from bindings "
-					"file : %s", strerror(errno));
+			strncpy(buff, wwid, WWID_SIZE);
+			buff[WWID_SIZE - 1] = '\0';
 			return id;
 		}
 	}
@@ -255,36 +261,35 @@ get_user_friendly_alias(char *wwid, char *file, char *prefix,
 	return alias;
 }
 
-char *
-get_user_friendly_wwid(char *alias, char *file)
+int
+get_user_friendly_wwid(char *alias, char *buff, char *file)
 {
-	char *wwid;
-	int fd, id, unused;
+	int fd, unused;
 	FILE *f;
 
 	if (!alias || *alias == '\0') {
 		condlog(3, "Cannot find binding for empty alias");
-		return NULL;
+		return -1;
 	}
 
 	fd = open_file(file, &unused, BINDINGS_FILE_HEADER);
 	if (fd < 0)
-		return NULL;
+		return -1;
 
 	f = fdopen(fd, "r");
 	if (!f) {
 		condlog(0, "cannot fdopen on bindings file descriptor : %s",
 			strerror(errno));
 		close(fd);
-		return NULL;
+		return -1;
 	}
 
-	id = rlookup_binding(f, &wwid, alias);
-	if (id < 0) {
+	rlookup_binding(f, buff, alias);
+	if (!strlen(buff)) {
 		fclose(f);
-		return NULL;
+		return -1;
 	}
 
 	fclose(f);
-	return wwid;
+	return 0;
 }
libmultipath/alias.h +1 -1
index c625090..8ddd0b5 100644
@@ -9,4 +9,4 @@
 
 char *get_user_friendly_alias(char *wwid, char *file, char *prefix,
 			      int bindings_readonly);
-char *get_user_friendly_wwid(char *alias, char *file);
+int get_user_friendly_wwid(char *alias, char *buff, char *file);
libmultipath/configure.c +47 -23

125 lines not on this page · raw message

libmultipath/configure.h +1 -1
index d13c0ac..650f080 100644
@@ -27,6 +27,6 @@ int setup_map (struct multipath * mpp, char * params, int params_size );
 int domap (struct multipath * mpp, char * params);
 int reinstate_paths (struct multipath *mpp);
 int coalesce_paths (struct vectors *vecs, vector curmp, char * refwwid, int force_reload);
-char * get_refwwid (char * dev, enum devtypes dev_type, vector pathvec);
+int get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid);
 int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh);
 
libmultipath/discovery.c +35 -12

93 lines not on this page · raw message

libmultipath/discovery.h +7 -4
index 17108c7..1a614ee 100644
@@ -33,8 +33,9 @@ int do_tur (char *);
 int path_offline (struct path *);
 int get_state (struct path * pp, int daemon);
 int pathinfo (struct path *, vector hwtable, int mask);
-struct path * store_pathinfo (vector pathvec, vector hwtable,
-			      struct udev_device *udevice, int flag);
+int store_pathinfo (vector pathvec, vector hwtable,
+		    struct udev_device *udevice, int flag,
+		    struct path **pp_ptr);
 int sysfs_set_scsi_tmo (struct multipath *mpp);
 int sysfs_get_timeout(struct path *pp, unsigned int *timeout);
 
@@ -46,14 +47,16 @@ enum discovery_mode {
 	__DI_SERIAL,
 	__DI_CHECKER,
 	__DI_PRIO,
-	__DI_WWID
+	__DI_WWID,
+	__DI_BLACKLIST,
 };
 
 #define DI_SYSFS	(1 << __DI_SYSFS)
 #define DI_SERIAL	(1 << __DI_SERIAL)
 #define DI_CHECKER	(1 << __DI_CHECKER)
 #define DI_PRIO		(1 << __DI_PRIO)
-#define DI_WWID 	(1 << __DI_WWID)
+#define DI_WWID		(1 << __DI_WWID)
+#define DI_BLACKLIST	(1 << __DI_BLACKLIST)
 
 #define DI_ALL		(DI_SYSFS  | DI_SERIAL | DI_CHECKER | DI_PRIO | \
 			 DI_WWID)
libmultipath/util.c +1 -1
index 3ac018c..41ac21b 100644
@@ -27,7 +27,7 @@ basenamecpy (const char * str1, char * str2, int str2len)
 	if (!str1 || !strlen(str1))
 		return 0;
 
-	if (strlen(str1) > str2len)
+	if (strlen(str1) >= str2len)
 		return 0;
 
 	if (!str2)
multipath/main.c +7 -7
index e526f7c..5d5a6f8 100644
@@ -262,7 +262,7 @@ configure (void)
 	/*
 	 * if we have a blacklisted device parameter, exit early
 	 */
-	if (dev &&
+	if (dev && conf->dev_type == DEV_DEVNODE &&
 	    (filter_devnode(conf->blist_devnode,
 			    conf->elist_devnode, dev) > 0)) {
 		if (conf->dry_run == 2)
@@ -275,16 +275,16 @@ configure (void)
 	 * failing the translation is fatal (by policy)
 	 */
 	if (conf->dev) {
-		refwwid = get_refwwid(conf->dev, conf->dev_type, pathvec);
-
+		int failed = get_refwwid(conf->dev, conf->dev_type, pathvec,
+					 &refwwid);
 		if (!refwwid) {
-			condlog(3, "scope is nul");
+			if (failed == 2 && conf->dry_run == 2)
+				printf("%s is not a valid multipath device path\n", conf->dev);
+			else
+				condlog(3, "scope is nul");
 			goto out;
 		}
 		condlog(3, "scope limited to %s", refwwid);
-		if (filter_wwid(conf->blist_wwid, conf->elist_wwid,
-				refwwid) > 0)
-			goto out;
 		if (conf->dry_run == 2) {
 			if (check_wwids_file(refwwid, 0) == 0){
 				printf("%s is a valid multipath device path\n", conf->dev);
multipathd/cli_handlers.c +5 -6
index 4df37fe..a1e4bde 100644
@@ -433,19 +433,18 @@ cli_add_path (void * v, char ** reply, int * len, void * data)
 		udevice = udev_device_new_from_subsystem_sysname(conf->udev,
 								 "block",
 								 param);
-		pp = store_pathinfo(vecs->pathvec, conf->hwtable,
-				    udevice, DI_ALL);
+		r = store_pathinfo(vecs->pathvec, conf->hwtable,
+				   udevice, DI_ALL, &pp);
 		udev_device_unref(udevice);
 		if (!pp) {
+			if (r == 2)
+				goto blacklisted;
 			condlog(0, "%s: failed to store path info", param);
 			return 1;
 		}
 		pp->checkint = conf->checkint;
 	}
-	r = ev_add_path(pp, vecs);
-	if (r == 2)
-		goto blacklisted;
-	return r;
+	return ev_add_path(pp, vecs);
 blacklisted:
 	*reply = strdup("blacklisted\n");
 	*len = strlen(*reply) + 1;
multipathd/main.c +10 -12
index a6afebb..8c0866d 100644
@@ -299,7 +299,7 @@ ev_add_map (char * dev, char * alias, struct vectors * vecs)
 		condlog(2, "%s: devmap %s registered", alias, dev);
 		return 0;
 	}
-	refwwid = get_refwwid(dev, DEV_DEVMAP, vecs->pathvec);
+	r = get_refwwid(dev, DEV_DEVMAP, vecs->pathvec, &refwwid);
 
 	if (refwwid) {
 		r = coalesce_paths(vecs, NULL, refwwid, 0);
@@ -308,6 +308,8 @@ ev_add_map (char * dev, char * alias, struct vectors * vecs)
 
 	if (!r)
 		condlog(2, "%s: devmap %s added", alias, dev);
+	else if (r == 2)
+		condlog(2, "%s: uev_add_map %s blacklisted", alias, dev);
 	else
 		condlog(0, "%s: uev_add_map %s failed", alias, dev);
 
@@ -373,6 +375,7 @@ static int
 uev_add_path (struct uevent *uev, struct vectors * vecs)
 {
 	struct path *pp;
+	int ret;
 
 	condlog(2, "%s: add path (uevent)", uev->kernel);
 	if (strstr(uev->kernel, "..") != NULL) {
@@ -393,8 +396,11 @@ uev_add_path (struct uevent *uev, struct vectors * vecs)
 		/*
 		 * get path vital state
 		 */
-		if (!(pp = store_pathinfo(vecs->pathvec, conf->hwtable,
-					  uev->udev, DI_ALL))) {
+		ret = store_pathinfo(vecs->pathvec, conf->hwtable,
+				     uev->udev, DI_ALL, &pp);
+		if (!pp) {
+			if (ret == 2)
+				return 0;
 			condlog(0, "%s: failed to store path info",
 				uev->kernel);
 			return 1;
@@ -402,14 +408,13 @@ uev_add_path (struct uevent *uev, struct vectors * vecs)
 		pp->checkint = conf->checkint;
 	}
 
-	return (ev_add_path(pp, vecs) != 1)? 0 : 1;
+	return ev_add_path(pp, vecs);
 }
 
 /*
  * returns:
  * 0: added
  * 1: error
- * 2: blacklisted
  */
 int
 ev_add_path (struct path * pp, struct vectors * vecs)
@@ -427,13 +432,6 @@ ev_add_path (struct path * pp, struct vectors * vecs)
 		condlog(0, "%s: failed to get path uid", pp->dev);
 		goto fail; /* leave path added to pathvec */
 	}
-	if (filter_path(conf, pp) > 0){
-		int i = find_slot(vecs->pathvec, (void *)pp);
-		if (i != -1)
-			vector_del_slot(vecs->pathvec, i);
-		free_path(pp);
-		return 2;
-	}
 	mpp = pp->mpp = find_mp_by_wwid(vecs->mpvec, pp->wwid);
 rescan:
 	if (mpp) {
Signature · 1 line
1.8.0
author maintainer
#17 lore raw

PATCH v3 17/18 multipath: check for NULL from udev_device_get_*

In reply to Benjamin Marzinski

The udev_device_get_* functions can return NULL, an occassionally do so in the multipathd code. multipath needs to check if the result is NULL before dereferencing it.

---
 libmultipath/discovery.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
libmultipath/discovery.c +11 -5
index b8a5cd1..831cfef 100644
@@ -113,6 +113,7 @@ path_discovery (vector pathvec, struct config * conf, int flag)
 
 	udev_list_entry_foreach(entry,
 				udev_enumerate_get_list_entry(udev_iter)) {
+		const char *devtype;
 		devpath = udev_list_entry_get_name(entry);
 		condlog(4, "Discover device %s", devpath);
 		udevice = udev_device_new_from_syspath(conf->udev, devpath);
@@ -121,7 +122,8 @@ path_discovery (vector pathvec, struct config * conf, int flag)
 			r++;
 			continue;
 		}
-		if(!strncmp(udev_device_get_devtype(udevice), "disk", 4))
+		devtype = udev_device_get_devtype(udevice);
+		if(devtype && !strncmp(devtype, "disk", 4))
 			r += path_discover(pathvec, conf, udevice, flag);
 		udev_device_unref(udevice);
 	}
@@ -459,7 +461,8 @@ scsi_sysfs_pathinfo (struct path * pp)
 
 	parent = pp->udev;
 	while (parent) {
-		if (!strncmp(udev_device_get_subsystem(parent), "scsi", 4)) {
+		const char *subsys = udev_device_get_subsystem(parent);
+		if (subsys && !strncmp(subsys, "scsi", 4)) {
 			attr_path = udev_device_get_sysname(parent);
 			if (!attr_path)
 				break;
@@ -525,7 +528,8 @@ ccw_sysfs_pathinfo (struct path * pp)
 
 	parent = pp->udev;
 	while (parent) {
-		if (!strncmp(udev_device_get_subsystem(parent), "ccw", 3))
+		const char *subsys = udev_device_get_subsystem(parent);
+		if (subsys && !strncmp(subsys, "ccw", 3))
 			break;
 		parent = udev_device_get_parent(parent);
 	}
@@ -581,7 +585,8 @@ cciss_sysfs_pathinfo (struct path * pp)
 
 	parent = pp->udev;
 	while (parent) {
-		if (!strncmp(udev_device_get_subsystem(parent), "cciss", 5)) {
+		const char *subsys = udev_device_get_subsystem(parent);
+		if (subsys && !strncmp(subsys, "cciss", 5)) {
 			attr_path = udev_device_get_sysname(parent);
 			if (!attr_path)
 				break;
@@ -662,7 +667,8 @@ path_offline (struct path * pp)
 
 	parent = pp->udev;
 	while (parent) {
-		if (!strncmp(udev_device_get_subsystem(parent), "scsi", 4))
+		const char *subsys = udev_device_get_subsystem(parent);
+		if (subsys && !strncmp(subsys, "scsi", 4))
 			break;
 		parent = udev_device_get_parent(parent);
 	}
Signature · 1 line
1.8.0
author maintainer
#18 lore raw

PATCH v3 18/18 multipath: make path devices readonly again.

In reply to Benjamin Marzinski

Path device fds were changed to be opened read/write when the mpathpersist code was added. However, I have talked with Vijay, and this doesn't appear to be necessary for mpathpersist to work correctly. If the path fds are opened read/write, when the are closed a change uevent is triggered, which was causing problems during shutdown with LVM on top of multipath devices. This patch reverts them to being read-only again.

---
 libmultipath/discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/discovery.c +1 -1
index 831cfef..8b6f74d 100644
@@ -886,7 +886,7 @@ pathinfo (struct path *pp, vector hwtable, int mask)
 	 * fetch info not available through sysfs
 	 */
 	if (pp->fd < 0)
-		pp->fd = open(udev_device_get_devnode(pp->udev), O_RDWR);
+		pp->fd = open(udev_device_get_devnode(pp->udev), O_RDONLY);
 
 	if (pp->fd < 0) {
 		condlog(4, "Couldn't open node for %s: %s",
Signature · 1 line
1.8.0
#19 lore raw
In reply to Benjamin Marzinski
Quoted 2 lines · Benjamin Marzinski

This patch sets fast_io_fail to 5 seconds in the defaults section.

Merged 1-18.
Thanks.

I also imported the log_thread_flush() and log_reset() missing functions from Hannes tree. Which makes the tree buildable again.

Best regards,
Christophe Varoqui
www.opensvc.com

Quoted 30 lines
---
 libmultipath/config.c   | 1 +
 libmultipath/defaults.h | 1 +
 2 files changed, 2 insertions(+)
libmultipath/config.c +1 -0
index 0a56cd1..51b4f45 100644
@@ -516,6 +516,7 @@ load_config (char * file)
 	conf->reassign_maps = DEFAULT_REASSIGN_MAPS;
 	conf->checkint = DEFAULT_CHECKINT;
 	conf->max_checkint = MAX_CHECKINT(conf->checkint);
+	conf->fast_io_fail = DEFAULT_FAST_IO_FAIL;
 
 	/*
 	 * preload default hwtable
libmultipath/defaults.h +1 -0
index 74b236f..f647ee0 100644
@@ -15,6 +15,7 @@
 #define DEFAULT_USER_FRIENDLY_NAMES    0
 #define DEFAULT_VERBOSITY	2
 #define DEFAULT_REASSIGN_MAPS	1
+#define DEFAULT_FAST_IO_FAIL	5
 
 #define DEFAULT_CHECKINT	5
 #define MAX_CHECKINT(a)		(a << 2)
#20 lore raw
Quoted 9 lines · Christophe Varoqui
Quoted 2 lines · Benjamin Marzinski

This patch sets fast_io_fail to 5 seconds in the defaults section.

Merged 1-18.
Thanks.

I also imported the log_thread_flush() and log_reset() missing functions from Hannes tree. Which makes the tree buildable again.

Yikes. Sorry.

I got sidetracked and forgot to check for that patch.

Thanks for fixing it up.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)