Accepting request 18442 from Base:System

Copy from Base:System/multipath-tools based on submit request 18442 from user hreinecke

OBS-URL: https://build.opensuse.org/request/show/18442
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/multipath-tools?expand=0&rev=25
This commit is contained in:
OBS User autobuild 2009-08-22 01:49:00 +00:00 committed by Git OBS Bridge
parent a5688557c7
commit 07a04674d8
67 changed files with 18 additions and 25727 deletions

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:507361270bd9d1c703a265834334ba5d39f3d2d4677dd531ab23611c845fb381
size 131381

View File

@ -1,45 +0,0 @@
From b33a53646ba745dca3ef93ca29c45cbef2dfa171 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 18 Nov 2008 08:29:17 +0100
Subject: [PATCH] Adapt to new sysfs layout in uev_discard()
Later kernel moved the block sysfs entry below the device path,
so we have to check for the 'block' directory somewhere in the
devpath, not at the beginning.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
multipathd/main.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index a4b0311..6908902 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -603,14 +603,19 @@ uxsock_trigger (char * str, char ** reply, int * len, void * trigger_data)
static int
uev_discard(char * devpath)
{
- char a[10], b[10];
+ char a[10], b[10], *c;
/*
* keep only block devices, discard partitions
*/
- if (sscanf(devpath, "/block/%10s", a) != 1 ||
- sscanf(devpath, "/block/%10[^/]/%10s", a, b) == 2) {
- condlog(4, "discard event on %s", devpath);
+ c = strstr(devpath,"/block");
+ if (!c) {
+ condlog(3, "discard non-block event on %s", devpath);
+ return 1;
+ }
+ if (sscanf(c, "/block/%10s", a) != 1 ||
+ sscanf(c, "/block/%10[^/]/%10s", a, b) == 2) {
+ condlog(3, "discard event on %s", c);
return 1;
}
return 0;
--
1.5.3.2

View File

@ -1,81 +0,0 @@
From b0ce6c618b0953b708f4810e763ce307f1bad590 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Mon, 20 Oct 2008 08:49:04 +0200
Subject: [PATCH] Add support for couple of IBM storage devices
Few of the IBM rdac storage devices are not available in the multipath
tools. This patch adds support for those.
Signed-Off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/hwtable.c | 38 +++++++++++++++++++++++++++++++++++---
1 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index cd9a9d2..f87907d 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -358,9 +358,9 @@ static struct hwentry default_hw[] = {
.prio_name = PRIO_RDAC,
},
{
- /* IBM DS3400 */
+ /* IBM DS4100 */
.vendor = "IBM",
- .product = "1726-4xx",
+ .product = "1724",
.getuid = DEFAULT_GETUID,
.features = "1 queue_if_no_path",
.hwhandler = "1 rdac",
@@ -374,7 +374,23 @@ static struct hwentry default_hw[] = {
.prio_name = PRIO_RDAC,
},
{
- /* IBM DS4400 / FAStT700 */
+ /* IBM DS3200 / DS3300 / DS3400 */
+ .vendor = "IBM",
+ .product = "1726",
+ .getuid = DEFAULT_GETUID,
+ .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,
+ .checker_name = RDAC,
+ .prio_name = PRIO_RDAC,
+ },
+ {
+ /* IBM DS4400 / DS4500 / FAStT700 */
.vendor = "IBM",
.product = "1742",
.getuid = DEFAULT_GETUID,
@@ -422,6 +438,22 @@ static struct hwentry default_hw[] = {
.prio_name = PRIO_RDAC,
},
{
+ /* IBM DS5000 */
+ .vendor = "IBM",
+ .product = "1818",
+ .getuid = DEFAULT_GETUID,
+ .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,
+ .checker_name = RDAC,
+ .prio_name = PRIO_RDAC,
+ },
+ {
/* IBM Netfinity Fibre Channel RAID Controller Unit */
.vendor = "IBM",
.product = "3526",
--
1.5.2.4

View File

@ -1,44 +0,0 @@
From af9e485cddb49d75d89f438c1f0f5ac27802e1e5 Mon Sep 17 00:00:00 2001
From: Jim Lester <jim.lester@compellent.com>
Date: Sun, 21 Sep 2008 12:36:33 +0200
Subject: [PATCH] [lib] new hardware from compellent in defaults table
---
libmultipath/hwtable.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index ada5c55..3e33352 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -18,6 +18,27 @@
*/
static struct hwentry default_hw[] = {
/*
+ * Compellent Technologies, Inc.
+ *
+ * Maintainer : Jim Lester, Compellent
+ * Mail : jim.lester@compellent.com
+ */
+ {
+ .vendor = "COMPELNT",
+ .product = "Compellent Vol",
+ .getuid = DEFAULT_GETUID,
+ .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,
+ .checker_name = TUR,
+ .prio_name = DEFAULT_PRIO,
+ },
+ /*
* Apple controller family
*
* Maintainer : Shyam Sundar
--
1.5.2.4

View File

@ -1,27 +0,0 @@
From 1feee37da59d67c4a38e01348e7138d4570c1fd4 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 18 Dec 2008 16:20:09 +0100
Subject: [PATCH] Add missing unlock() on exit path
We forgot to unlock the paths on exit.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/configure.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 68178c3..d1e26a1 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -337,6 +337,7 @@ domap (struct multipath * mpp, char * params)
if (dm_map_present(mpp->alias)) {
condlog(3, "%s: map already present", mpp->alias);
+ lock_multipath(mpp, 0);
break;
}
--
1.6.0.2

View File

@ -1,35 +0,0 @@
commit 4faa9b359e4b35882459c45176760ca2b0c8caaa
Author: Hannes Reinecke <hare@suse.de>
Date: Thu Jan 15 12:03:34 2009 +0100
Add new HP arrays to internal hardware table
This patch is to include entries for 2 new HP arrays in the hwtable.
References: bnc#442133
Signed-off-by: Vijayakumar Balasubramanian <vijayakumar@hp.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index d742d6d..97c979e 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -145,7 +145,7 @@ static struct hwentry default_hw[] = {
{
/* EVA 3000/5000 with new firmware, EVA 4000/6000/8000 */
.vendor = "(COMPAQ|HP)",
- .product = "HSV1[01]1|HSV2[01]0|HSV300",
+ .product = "HSV1[01]1|HSV2[01]0|HSV300|HSV4[05]0",
.getuid = DEFAULT_GETUID,
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
@@ -177,7 +177,7 @@ static struct hwentry default_hw[] = {
{
/* HP MSA2000 product family with new firmware */
.vendor = "HP",
- .product = "MSA2012sa|MSA23(12|24)(fc|i|sa)",
+ .product = "MSA2012sa|MSA23(12|24)(fc|i|sa)|MSA2000s VOLUME",
.getuid = DEFAULT_GETUID,
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,

View File

@ -1,244 +0,0 @@
From 88eb616ae1a673127ef4fd995d703a8b46a63822 Mon Sep 17 00:00:00 2001
From: Christophe Varoqui <christophe.varoqui@free.fr>
Date: Thu, 11 Sep 2008 00:17:37 +0200
Subject: [PATCH] [multipathd] add "show status" cli command
For now just print the number of paths in each path checker state,
if not zero. For example :
path checker states:
up 2
down 1
ghost 1
---
libmultipath/checkers.c | 15 +++++++++++++++
libmultipath/checkers.h | 18 +++++++++++-------
libmultipath/print.c | 24 ++++++++++++++++++++++++
libmultipath/print.h | 1 +
libmultipath/structs.c | 2 +-
multipathd/cli.c | 1 +
multipathd/cli_handlers.c | 30 ++++++++++++++++++++++++++++++
multipathd/cli_handlers.h | 1 +
multipathd/main.c | 4 +++-
9 files changed, 87 insertions(+), 9 deletions(-)
diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
index 5889ad7..5132081 100644
--- a/libmultipath/checkers.c
+++ b/libmultipath/checkers.c
@@ -8,8 +8,23 @@
#include "vector.h"
#include "config.h"
+char *checker_state_names[] = {
+ "wild",
+ "unchecked",
+ "down",
+ "up",
+ "shaky",
+ "ghost",
+ "pending"
+};
+
static LIST_HEAD(checkers);
+char * checker_state_name (int i)
+{
+ return checker_state_names[i];
+}
+
int init_checkers (void)
{
INIT_LIST_HEAD(&checkers);
diff --git a/libmultipath/checkers.h b/libmultipath/checkers.h
index a65aaf9..e735250 100644
--- a/libmultipath/checkers.h
+++ b/libmultipath/checkers.h
@@ -47,13 +47,16 @@
* - Use: All async checkers
* - Description: Indicates a check IO is in flight.
*/
-#define PATH_WILD -1
-#define PATH_UNCHECKED 0
-#define PATH_DOWN 1
-#define PATH_UP 2
-#define PATH_SHAKY 3
-#define PATH_GHOST 4
-#define PATH_PENDING 5
+enum path_check_state {
+ PATH_WILD,
+ PATH_UNCHECKED,
+ PATH_DOWN,
+ PATH_UP,
+ PATH_SHAKY,
+ PATH_GHOST,
+ PATH_PENDING,
+ PATH_MAX_STATE
+};
#define DIRECTIO "directio"
#define TUR "tur"
@@ -106,6 +109,7 @@ struct checker {
#define MSG(c, fmt, args...) snprintf((c)->message, CHECKER_MSG_LEN, fmt, ##args);
+char * checker_state_name (int);
int init_checkers (void);
struct checker * add_checker (char *);
struct checker * checker_lookup (char *);
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 08ebd51..459b973 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -1133,6 +1133,30 @@ snprint_blacklist_except (char * buff, int len)
}
extern int
+snprint_status (char * buff, int len, struct vectors *vecs)
+{
+ int fwd = 0;
+ int i;
+ unsigned int count[PATH_MAX_STATE] = {0};
+ struct path * pp;
+
+ vector_foreach_slot (vecs->pathvec, pp, i) {
+ count[pp->state]++;
+ }
+ fwd += snprintf(buff + fwd, len - fwd, "path checker states:\n");
+ for (i=0; i<PATH_MAX_STATE; i++) {
+ if (!count[i])
+ continue;
+ fwd += snprintf(buff + fwd, len - fwd, "%-20s%u\n",
+ checker_state_name(i), count[i]);
+ }
+
+ if (fwd > len)
+ return len;
+ return fwd;
+}
+
+extern int
snprint_devices (char * buff, int len, struct vectors *vecs)
{
DIR *blkdir;
diff --git a/libmultipath/print.h b/libmultipath/print.h
index 5c7023c..1718c94 100644
--- a/libmultipath/print.h
+++ b/libmultipath/print.h
@@ -44,6 +44,7 @@ int snprint_defaults (char *, int);
int snprint_blacklist (char *, int);
int snprint_blacklist_except (char *, int);
int snprint_blacklist_report (char *, int);
+int snprint_status (char *, int, struct vectors *);
int snprint_devices (char *, int, struct vectors *);
int snprint_hwtable (char *, int, vector);
int snprint_mptable (char *, int, vector);
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 50f66f4..bb0d9f7 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -349,7 +349,7 @@ pathcountgr (struct pathgroup * pgp, int state)
int i;
vector_foreach_slot (pgp->paths, pp, i)
- if ((pp->state == state) || (state < 0))
+ if ((pp->state == state) || (state == PATH_WILD))
count++;
return count;
diff --git a/multipathd/cli.c b/multipathd/cli.c
index 7eaac73..051624a 100644
--- a/multipathd/cli.c
+++ b/multipathd/cli.c
@@ -406,6 +406,7 @@ cli_init (void) {
add_handler(LIST+PATHS, NULL);
add_handler(LIST+PATHS+FMT, NULL);
+ add_handler(LIST+STATUS, NULL);
add_handler(LIST+MAPS, NULL);
add_handler(LIST+MAPS+STATUS, NULL);
add_handler(LIST+MAPS+STATS, NULL);
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index c84805a..415f865 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -224,6 +224,26 @@ cli_list_maps_topology (void * v, char ** reply, int * len, void * data)
}
int
+show_status (char ** r, int *len, struct vectors * vecs)
+{
+ char * c;
+ char * reply;
+
+ unsigned int maxlen = INITIAL_REPLY_LEN;
+ reply = MALLOC(maxlen);
+
+ if (!reply)
+ return 1;
+
+ c = reply;
+ c += snprint_status(c, reply + maxlen - c, vecs);
+
+ *r = reply;
+ *len = (int)(c - reply + 1);
+ return 0;
+}
+
+int
show_maps (char ** r, int *len, struct vectors * vecs, char * style)
{
int i;
@@ -270,6 +290,16 @@ cli_list_maps (void * v, char ** reply, int * len, void * data)
}
int
+cli_list_status (void * v, char ** reply, int * len, void * data)
+{
+ struct vectors * vecs = (struct vectors *)data;
+
+ condlog(3, "list status (operator)");
+
+ return show_status(reply, len, vecs);
+}
+
+int
cli_list_maps_status (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
diff --git a/multipathd/cli_handlers.h b/multipathd/cli_handlers.h
index a688481..cfc4b12 100644
--- a/multipathd/cli_handlers.h
+++ b/multipathd/cli_handlers.h
@@ -1,5 +1,6 @@
int cli_list_paths (void * v, char ** reply, int * len, void * data);
int cli_list_paths_fmt (void * v, char ** reply, int * len, void * data);
+int cli_list_status (void * v, char ** reply, int * len, void * data);
int cli_list_maps (void * v, char ** reply, int * len, void * data);
int cli_list_maps_status (void * v, char ** reply, int * len, void * data);
int cli_list_maps_stats (void * v, char ** reply, int * len, void * data);
diff --git a/multipathd/main.c b/multipathd/main.c
index 8d74cb9..e57a3e4 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -159,7 +159,8 @@ sync_map_state(struct multipath *mpp)
vector_foreach_slot (mpp->pg, pgp, i){
vector_foreach_slot (pgp->paths, pp, j){
- if (pp->state <= PATH_UNCHECKED)
+ if (pp->state == PATH_UNCHECKED ||
+ pp->state == PATH_WILD)
continue;
if ((pp->dmstate == PSTATE_FAILED ||
pp->dmstate == PSTATE_UNDEF) &&
@@ -693,6 +694,7 @@ uxlsnrloop (void * ap)
set_handler_callback(LIST+PATHS, cli_list_paths);
set_handler_callback(LIST+PATHS+FMT, cli_list_paths_fmt);
set_handler_callback(LIST+MAPS, cli_list_maps);
+ set_handler_callback(LIST+STATUS, cli_list_status);
set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status);
set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats);
set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology);
--
1.5.2.4

View File

@ -1,204 +0,0 @@
From 27ec49eca021f1cc85e66d55509f1e051a820bd4 Mon Sep 17 00:00:00 2001
From: Christophe Varoqui <christophe.varoqui@free.fr>
Date: Mon, 29 Sep 2008 01:37:02 +0200
Subject: [PATCH] [multipathd] add "show wildcards" cli command
The fact I had to look at the code to find the wildcards to use
in "show paths format ...", "show multipath format ..." and
"show pathgroup format ..." was a clear sign that more help was
necessary.
The "show wildcards" command outputs :
multipath format wildcards:
%n name
%w uuid
%d sysfs
%F failback
%Q queueing
%N paths
%r write_prot
%t dm-st
%S size
%f features
%h hwhandler
%A action
%0 path_faults
%1 switch_grp
%2 map_loads
%3 total_q_time
%4 q_timeouts
%s vend/prod/rev
path format wildcards:
%w uuid
%i hcil
%d dev
%D dev_t
%t dm_st
%T chk_st
%s vend/prod/rev
%C next_check
%p pri
%S size
pathgroup format wildcards:
%s selector
%p pri
%t dm_st
And for example, "show paths format foo:%d:%S:%i", outs
foo:dev:size:hcil
foo:sda:149G:2:0:0:0
---
libmultipath/print.c | 21 +++++++++++++++++++++
libmultipath/print.h | 1 +
multipathd/cli.c | 2 ++
multipathd/cli.h | 2 ++
multipathd/cli_handlers.c | 17 +++++++++++++++++
multipathd/cli_handlers.h | 1 +
multipathd/main.c | 1 +
7 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 7411ccc..09b3579 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -436,8 +436,29 @@ struct pathgroup_data pgd[] = {
{'s', "selector", 0, snprint_pg_selector},
{'p', "pri", 0, snprint_pg_pri},
{'t', "dm_st", 0, snprint_pg_state},
+ {0, NULL, 0 , NULL}
};
+int
+snprint_wildcards (char * buff, int len)
+{
+ int i, fwd = 0;
+
+ fwd += snprintf(buff + fwd, len - fwd, "multipath format wildcards:\n");
+ for (i = 0; mpd[i].header; i++)
+ fwd += snprintf(buff + fwd, len - fwd, "%%%c %s\n",
+ mpd[i].wildcard, mpd[i].header);
+ fwd += snprintf(buff + fwd, len - fwd, "\npath format wildcards:\n");
+ for (i = 0; pd[i].header; i++)
+ fwd += snprintf(buff + fwd, len - fwd, "%%%c %s\n",
+ pd[i].wildcard, pd[i].header);
+ fwd += snprintf(buff + fwd, len - fwd, "\npathgroup format wildcards:\n");
+ for (i = 0; pgd[i].header; i++)
+ fwd += snprintf(buff + fwd, len - fwd, "%%%c %s\n",
+ pgd[i].wildcard, pgd[i].header);
+ return fwd;
+}
+
void
get_path_layout (vector pathvec, int header)
{
diff --git a/libmultipath/print.h b/libmultipath/print.h
index 1718c94..a8be408 100644
--- a/libmultipath/print.h
+++ b/libmultipath/print.h
@@ -44,6 +44,7 @@ int snprint_defaults (char *, int);
int snprint_blacklist (char *, int);
int snprint_blacklist_except (char *, int);
int snprint_blacklist_report (char *, int);
+int snprint_wildcards (char *, int);
int snprint_status (char *, int, struct vectors *);
int snprint_devices (char *, int, struct vectors *);
int snprint_hwtable (char *, int, vector);
diff --git a/multipathd/cli.c b/multipathd/cli.c
index 051624a..34ae07c 100644
--- a/multipathd/cli.c
+++ b/multipathd/cli.c
@@ -170,6 +170,7 @@ load_keys (void)
r += add_key(keys, "blacklist", BLACKLIST, 0);
r += add_key(keys, "devices", DEVICES, 0);
r += add_key(keys, "format", FMT, 1);
+ r += add_key(keys, "wildcards", WILDCARDS, 0);
if (r) {
free_keys(keys);
@@ -416,6 +417,7 @@ cli_init (void) {
add_handler(LIST+CONFIG, NULL);
add_handler(LIST+BLACKLIST, NULL);
add_handler(LIST+DEVICES, NULL);
+ add_handler(LIST+WILDCARDS, NULL);
add_handler(ADD+PATH, NULL);
add_handler(DEL+PATH, NULL);
add_handler(ADD+MAP, NULL);
diff --git a/multipathd/cli.h b/multipathd/cli.h
index 8c83eab..9932d96 100644
--- a/multipathd/cli.h
+++ b/multipathd/cli.h
@@ -20,6 +20,7 @@ enum {
__BLACKLIST,
__DEVICES,
__FMT,
+ __WILDCARDS,
};
#define LIST (1 << __LIST)
@@ -43,6 +44,7 @@ enum {
#define BLACKLIST (1 << __BLACKLIST)
#define DEVICES (1 << __DEVICES)
#define FMT (1 << __FMT)
+#define WILDCARDS (1 << __WILDCARDS)
#define INITIAL_REPLY_LEN 1000
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 415f865..36a4968 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -224,6 +224,23 @@ cli_list_maps_topology (void * v, char ** reply, int * len, void * data)
}
int
+cli_list_wildcards (void * v, char ** reply, int * len, void * data)
+{
+ char * c;
+
+ *reply = MALLOC(INITIAL_REPLY_LEN);
+
+ if (!reply)
+ return 1;
+
+ c = *reply;
+ c += snprint_wildcards(c, INITIAL_REPLY_LEN);
+
+ *len = INITIAL_REPLY_LEN;
+ return 0;
+}
+
+int
show_status (char ** r, int *len, struct vectors * vecs)
{
char * c;
diff --git a/multipathd/cli_handlers.h b/multipathd/cli_handlers.h
index cfc4b12..703a925 100644
--- a/multipathd/cli_handlers.h
+++ b/multipathd/cli_handlers.h
@@ -9,6 +9,7 @@ int cli_list_maps_topology (void * v, char ** reply, int * len, void * data);
int cli_list_config (void * v, char ** reply, int * len, void * data);
int cli_list_blacklist (void * v, char ** reply, int * len, void * data);
int cli_list_devices (void * v, char ** reply, int * len, void * data);
+int cli_list_wildcards (void * v, char ** reply, int * len, void * data);
int cli_add_path (void * v, char ** reply, int * len, void * data);
int cli_del_path (void * v, char ** reply, int * len, void * data);
int cli_add_map (void * v, char ** reply, int * len, void * data);
diff --git a/multipathd/main.c b/multipathd/main.c
index e57a3e4..84fb5c4 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -703,6 +703,7 @@ uxlsnrloop (void * ap)
set_handler_callback(LIST+CONFIG, cli_list_config);
set_handler_callback(LIST+BLACKLIST, cli_list_blacklist);
set_handler_callback(LIST+DEVICES, cli_list_devices);
+ set_handler_callback(LIST+WILDCARDS, cli_list_wildcards);
set_handler_callback(ADD+PATH, cli_add_path);
set_handler_callback(DEL+PATH, cli_del_path);
set_handler_callback(ADD+MAP, cli_add_map);
--
1.5.2.4

View File

@ -1,38 +0,0 @@
From 6ebe82d29b759049d1df1cb689f9c35bdaf58808 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 20 Nov 2008 13:33:10 +0100
Subject: [PATCH] Allow zero paths for device-mapper strings
There is no reason why we shouldn't allow zero paths in the device
mapper output.
References: 435688
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/dmparser.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
index 9441b11..0cef666 100644
--- a/libmultipath/dmparser.c
+++ b/libmultipath/dmparser.c
@@ -187,11 +187,12 @@ disassemble_map (vector pathvec, char * params, struct multipath * mpp)
num_pg = atoi(word);
FREE(word);
- if (num_pg > 0 && !mpp->pg)
+ if (num_pg > 0 && !mpp->pg) {
mpp->pg = vector_alloc();
- if (!mpp->pg)
- return 1;
+ if (!mpp->pg)
+ return 1;
+ }
/*
* first pg to try
--
1.5.3.2

View File

@ -1,94 +0,0 @@
From 1532369e0269ddc8bbb295f3cc26f102b247bca0 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 20 Nov 2008 08:50:10 +0100
Subject: [PATCH] Always allocate space for alias
We should always allocate memory for the alias, this makes freeing
up the string less error-prone.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/devmapper.c | 8 ++++----
libmultipath/propsel.c | 6 +++---
libmultipath/structs.c | 4 +---
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 92afae7..bc4f9db 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -765,7 +765,7 @@ dm_get_name(char *uuid, char *name)
{
vector vec;
struct multipath *mpp;
- int i;
+ int i, retval = 0;
vec = vector_alloc();
@@ -779,14 +779,14 @@ dm_get_name(char *uuid, char *name)
vector_foreach_slot(vec, mpp, i) {
if (!strcmp(uuid, mpp->wwid)) {
- vector_free(vec);
strcpy(name, mpp->alias);
- return 1;
+ retval = 1;
}
+ free_multipath(mpp, KEEP_PATHS);
}
vector_free(vec);
- return 0;
+ return retval;
}
int
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index 43611ff..5a16182 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -159,7 +159,7 @@ extern int
select_alias (struct multipath * mp)
{
if (mp->mpe && mp->mpe->alias)
- mp->alias = mp->mpe->alias;
+ mp->alias = strdup(mp->mpe->alias);
else {
mp->alias = NULL;
if (conf->user_friendly_names)
@@ -175,7 +175,7 @@ select_alias (struct multipath * mp)
}
}
if (mp->alias == NULL)
- mp->alias = mp->wwid;
+ mp->alias = strdup(mp->wwid);
}
return 0;
@@ -365,6 +365,6 @@ select_pg_timeout(struct multipath *mp)
return 0;
}
mp->pg_timeout = PGTIMEOUT_UNDEF;
- condlog(3, "pg_timeout = NONE (internal default)");
+ condlog(3, "%s: pg_timeout = NONE (internal default)", mp->alias);
return 0;
}
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index bb0d9f7..d2bfc2d 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -161,9 +161,7 @@ free_multipath (struct multipath * mpp, int free_paths)
free_multipath_attributes(mpp);
- if (mpp->alias &&
- (!mpp->mpe || (mpp->mpe && mpp->alias != mpp->mpe->alias)) &&
- (mpp->wwid && mpp->alias != mpp->wwid)) {
+ if (mpp->alias) {
FREE(mpp->alias);
mpp->alias = NULL;
}
--
1.5.3.2

View File

@ -1,114 +0,0 @@
From 53c7a13bf5383814a7118607d3b1da41de51c4b1 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 20 Nov 2008 08:40:59 +0100
Subject: [PATCH] Return number of characters written in basename()
basename() can fail, so we should return the number of
characters written to get some error indicator.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/configure.c | 12 +++++++++---
libmultipath/discovery.h | 1 -
libmultipath/util.c | 13 +++++++++++--
libmultipath/util.h | 2 +-
4 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 8444ef2..494ea70 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -34,13 +34,14 @@
#include "dict.h"
#include "alias.h"
#include "prio.h"
+#include "util.h"
extern int
setup_map (struct multipath * mpp)
{
struct pathgroup * pgp;
int i;
-
+
/*
* don't bother if devmap size is unknown
*/
@@ -579,9 +580,14 @@ get_refwwid (char * dev, enum devtypes dev_type, vector pathvec)
return NULL;
if (dev_type == DEV_DEVNODE) {
- basename(dev, buff);
+ if (basename(dev, buff) == 0) {
+ condlog(1, "basename failed for '%s' (%s)",
+ dev, buff);
+ return NULL;
+ }
+
pp = find_path_by_dev(pathvec, buff);
-
+
if (!pp) {
pp = alloc_path();
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index c7cf7e8..05b1cfe 100644
--- a/libmultipath/discovery.h
+++ b/libmultipath/discovery.h
@@ -27,7 +27,6 @@
int sysfs_get_dev (struct sysfs_device * dev, char * buff, size_t len);
int path_discovery (vector pathvec, struct config * conf, int flag);
-void basename (char *, char *);
int do_tur (char *);
int devt2devname (char *, char *);
int pathinfo (struct path *, vector hwtable, int mask);
diff --git a/libmultipath/util.c b/libmultipath/util.c
index c7fe6b4..3afe7ea 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -38,10 +38,18 @@ strchop(char *str)
str[++i] = '\0';
}
-void
+int
basename (char * str1, char * str2)
{
- char *p = str1 + (strlen(str1) - 1);
+ char *p;
+
+ if (!str1 || !strlen(str1))
+ return 0;
+
+ if (!str2)
+ return 0;
+
+ p = str1 + (strlen(str1) - 1);
while (*--p != '/' && p != str1)
continue;
@@ -50,6 +58,7 @@ basename (char * str1, char * str2)
p++;
strcpy(str2, p);
+ return strlen(p);
}
int
diff --git a/libmultipath/util.h b/libmultipath/util.h
index d0df8aa..14af696 100644
--- a/libmultipath/util.h
+++ b/libmultipath/util.h
@@ -3,7 +3,7 @@
int strcmp_chomp(char *, char *);
void strchop(char *);
-void basename (char * src, char * dst);
+int basename (char * src, char * dst);
int filepresent (char * run);
int get_word (char * sentence, char ** word);
size_t strlcpy(char *dst, const char *src, size_t size);
--
1.5.3.2

View File

@ -1,27 +0,0 @@
commit 1b043535b5584cf8298bf535e5794289f1b98f43
Author: Hannes Reinecke <hare@suse.de>
Date: Tue Nov 4 09:40:26 2008 +0100
Check for empty mpvecs in mpvec_garbage_collector()
During shutdown the mpvec pointer can indeed be empty, so we should
check it first before trying to access it.
References: 437245
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/multipathd/main.c b/multipathd/main.c
index 78e6ed3..a4b0311 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -798,6 +798,9 @@ mpvec_garbage_collector (struct vectors * vecs)
struct multipath * mpp;
unsigned int i;
+ if (!vecs->mpvec)
+ return;
+
vector_foreach_slot (vecs->mpvec, mpp, i) {
if (mpp && mpp->alias && !dm_map_present(mpp->alias)) {
condlog(2, "%s: remove dead map", mpp->alias);

View File

@ -1,152 +0,0 @@
commit 08a140c02f9010f356e5b18dc7b7652cc15fc79d
Author: Hannes Reinecke <hare@suse.de>
Date: Fri Sep 26 15:31:07 2008 +0200
multipath: Check return value for get_inq()
Check the return value of get_inq() to correctly handle devices
with unconnected LUNs.
References: 419123
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index dd45e03..e1a67ac 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -275,7 +275,7 @@ devt2devname (char *devname, char *devt)
int
do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op,
- void *resp, int mx_resp_len, int noisy)
+ void *resp, int mx_resp_len)
{
unsigned char inqCmdBlk[INQUIRY_CMDLEN] =
{ INQUIRY_CMD, 0, 0, 0, 0, 0 };
@@ -334,7 +334,7 @@ get_serial (char * str, int maxlen, int fd)
if (fd < 0)
return 1;
- if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) {
+ if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN)) {
len = buff[3];
if (len >= maxlen)
return 1;
@@ -348,26 +348,69 @@ get_serial (char * str, int maxlen, int fd)
}
static int
-get_inq (char * vendor, char * product, char * rev, int fd)
+get_inq (char * dev, char * vendor, char * product, char * rev, int fd)
{
- char buff[MX_ALLOC_LEN + 1] = {0};
+ unsigned char buff[MX_ALLOC_LEN + 1] = {0};
+ int len;
if (fd < 0)
return 1;
- if (0 == do_inq(fd, 0, 0, 0, buff, MX_ALLOC_LEN, 0)) {
- memcpy(vendor, buff + 8, 8);
- vendor[8] = '\0';
- strchop(vendor);
- memcpy(product, buff + 16, 16);
- product[16] = '\0';
- strchop(product);
- memcpy(rev, buff + 32, 4);
- rev[4] = '\0';
- strchop(rev);
- return 0;
+ if (0 != do_inq(fd, 0, 0, 0, buff, MX_ALLOC_LEN))
+ return 1;
+
+ /* Check peripheral qualifier */
+ if ((buff[0] >> 5) != 0) {
+ int pqual = (buff[0] >> 5);
+ switch (pqual) {
+ case 1:
+ condlog(3, "%s: INQUIRY failed, LU not connected", dev);
+ break;
+ case 3:
+ condlog(3, "%s: INQUIRY failed, LU not supported", dev);
+ break;
+ default:
+ condlog(3, "%s: INQUIRY failed, Invalid PQ %x",
+ dev, pqual);
+ break;
+ }
+
+ return 1;
}
- return 1;
+
+ len = buff[4] + 4;
+
+ if (len < 8) {
+ condlog(3, "%s: INQUIRY response too short (len %d)",
+ dev, len);
+ return 1;
+ }
+
+ len -= 8;
+ memset(vendor, 0x0, 8);
+ memcpy(vendor, buff + 8, len > 8 ? 8 : len);
+ vendor[8] = '\0';
+ strchop(vendor);
+ if (len <= 8)
+ return 0;
+
+ len -= 8;
+
+ memset(product, 0x0, 16);
+ memcpy(product, buff + 16, len > 16 ? 16 : len);
+ product[16] = '\0';
+ strchop(product);
+ if (len <= 16)
+ return 0;
+
+ len -= 16;
+
+ memset(rev, 0x0, 4);
+ memcpy(rev, buff + 32, 4);
+ rev[4] = '\0';
+ strchop(rev);
+
+ return 0;
}
static int
@@ -549,13 +592,16 @@ sysfs_pathinfo(struct path * pp)
if (!strncmp(parent->kernel, "block",5))
parent = sysfs_device_get_parent(parent);
+ if (!strncmp(pp->dev,"cciss",5))
+ strcpy(parent->subsystem,"cciss");
+
condlog(3, "%s: subsystem = %s", pp->dev, parent->subsystem);
if (!strncmp(parent->subsystem, "scsi",4))
pp->bus = SYSFS_BUS_SCSI;
if (!strncmp(parent->subsystem, "ccw",3))
pp->bus = SYSFS_BUS_CCW;
- if (!strncmp(pp->dev,"cciss",5))
+ if (!strncmp(parent->subsystem,"cciss",5))
pp->bus = SYSFS_BUS_CCISS;
if (pp->bus == SYSFS_BUS_UNDEF)
@@ -587,8 +633,14 @@ scsi_ioctl_pathinfo (struct path * pp, int mask)
static int
cciss_ioctl_pathinfo (struct path * pp, int mask)
{
+ int ret;
+
if (mask & DI_SYSFS) {
- get_inq(pp->vendor_id, pp->product_id, pp->rev, pp->fd);
+ ret = get_inq(pp->dev, pp->vendor_id, pp->product_id,
+ pp->rev, pp->fd);
+ if (ret)
+ return ret;
+
condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id);
condlog(3, "%s: product = %s", pp->dev, pp->product_id);
condlog(3, "%s: revision = %s", pp->dev, pp->rev);

View File

@ -1,30 +0,0 @@
commit 03b42661495abdb9fa594ff82105f705d2c4148f
Author: Hannes Reinecke <hare@suse.de>
Date: Mon Jan 26 13:01:33 2009 +0100
Error checking for VECTOR_XXX defines
Christophe doesn't believe in error checking. I, however, have
been tripping over them all the time.
References: bnc#469269
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/vector.h b/libmultipath/vector.h
index aa9e134..59cfd27 100644
--- a/libmultipath/vector.h
+++ b/libmultipath/vector.h
@@ -31,9 +31,9 @@ struct _vector {
typedef struct _vector *vector;
#define VECTOR_DEFAULT_SIZE 1
-#define VECTOR_SLOT(V,E) ((V)->slot[(E)])
-#define VECTOR_SIZE(V) ((V)->allocated)
-#define VECTOR_LAST_SLOT(V) ((V)->slot[((V)->allocated - 1)])
+#define VECTOR_SLOT(V,E) (((V) && (E) < (V)->allocated) ? (V)->slot[(E)] : NULL)
+#define VECTOR_SIZE(V) ((V) ? (V)->allocated : 0)
+#define VECTOR_LAST_SLOT(V) (((V) && (V)->allocated) ? (V)->slot[((V)->allocated - 1)] : NULL)
#define vector_foreach_slot(v,p,i) \
for (i = 0; (v) && i < (v)->allocated && ((p) = (v)->slot[i]); i++)

View File

@ -1,54 +0,0 @@
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index eb7ac03..3903b28 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -114,6 +114,9 @@ pgcmp (struct multipath * mpp, struct multipath * cmpp)
struct pathgroup * cpgp;
int r = 0;
+ if (!mpp)
+ return 0;
+
vector_foreach_slot (mpp->pg, pgp, i) {
compute_pgid(pgp);
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index e3cace9..3770566 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -163,6 +163,9 @@ _remove_maps (struct vectors * vecs, int stop_waiter)
int i;
struct multipath * mpp;
+ if (!vecs)
+ return;
+
vector_foreach_slot (vecs->mpvec, mpp, i) {
_remove_map(mpp, vecs, stop_waiter, 1);
i--;
@@ -451,6 +454,9 @@ verify_paths(struct multipath * mpp, struct vectors * vecs, vector rpvec)
int count = 0;
int i, j;
+ if (!mpp)
+ return 0;
+
vector_foreach_slot (mpp->paths, pp, i) {
/*
* see if path is in sysfs
diff --git a/libmultipath/vector.h b/libmultipath/vector.h
index 993ba79..aa9e134 100644
--- a/libmultipath/vector.h
+++ b/libmultipath/vector.h
@@ -36,9 +36,9 @@ typedef struct _vector *vector;
#define VECTOR_LAST_SLOT(V) ((V)->slot[((V)->allocated - 1)])
#define vector_foreach_slot(v,p,i) \
- for (i = 0; i < (v)->allocated && ((p) = (v)->slot[i]); i++)
+ for (i = 0; (v) && i < (v)->allocated && ((p) = (v)->slot[i]); i++)
#define vector_foreach_slot_after(v,p,i) \
- for (; i < (v)->allocated && ((p) = (v)->slot[i]); i++)
+ for (; (v) && i < (v)->allocated && ((p) = (v)->slot[i]); i++)
/* Prototypes */
extern vector vector_alloc(void);

View File

@ -1,69 +0,0 @@
From 2abb4feab7683ba7946a3cf387568de3f7312df3 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 13 Jan 2009 15:28:23 +0100
Subject: [PATCH] Checker name is not displayed on failure
If add_checker() isn't able to locate the checker
it won't display the name in free_checker().
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/checkers.c | 5 +++--
libmultipath/prio.c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
index 4378621..e1789e5 100644
--- a/libmultipath/checkers.c
+++ b/libmultipath/checkers.c
@@ -87,10 +87,12 @@ struct checker * add_checker (char * name)
c = alloc_checker();
if (!c)
return NULL;
+ snprintf(c->name, CHECKER_NAME_LEN, "%s", name);
snprintf(libname, LIB_CHECKER_NAMELEN, "%s/libcheck%s.so",
conf->multipath_dir, name);
if (stat(libname,&stbuf) < 0) {
- condlog(0,"Invalid checker '%s'", name);
+ condlog(0,"Checker '%s' not found in %s",
+ name, conf->multipath_dir);
goto out;
}
condlog(3, "loading %s checker", libname);
@@ -122,7 +124,6 @@ struct checker * add_checker (char * name)
if (!c->free)
goto out;
- snprintf(c->name, CHECKER_NAME_LEN, "%s", name);
c->fd = 0;
c->sync = 1;
list_add(&c->node, &checkers);
diff --git a/libmultipath/prio.c b/libmultipath/prio.c
index 30e03c2..7508a8a 100644
--- a/libmultipath/prio.c
+++ b/libmultipath/prio.c
@@ -71,10 +71,12 @@ struct prio * add_prio (char * name)
p = alloc_prio();
if (!p)
return NULL;
+ snprintf(p->name, PRIO_NAME_LEN, "%s", name);
snprintf(libname, LIB_PRIO_NAMELEN, "%s/libprio%s.so",
conf->multipath_dir, name);
if (stat(libname,&stbuf) < 0) {
- condlog(0,"Invalid prioritizer '%s'", name);
+ condlog(0,"Prioritizer '%s' not found in %s",
+ name, conf->multipath_dir);
goto out;
}
condlog(3, "loading %s prioritizer", libname);
@@ -91,7 +93,6 @@ struct prio * add_prio (char * name)
condlog(0, "A dynamic linking error occurred: (%s)", errstr);
if (!p->getprio)
goto out;
- snprintf(p->name, PRIO_NAME_LEN, "%s", name);
list_add(&p->node, &prioritizers);
return p;
out:
--
1.5.3.2

View File

@ -1,34 +0,0 @@
commit 1942363f6acc7d9e507d4bc82063287da19cd05a
Author: Hannes Reinecke <hare@suse.de>
Date: Tue Nov 4 10:08:01 2008 +0100
dmraid uuid starts with 'DMRAID'
The dmraid uuid starts with 'DMRAID', not 'dmraid'.
References: 439439
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index 2746eff..3e09dcf 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -18,7 +18,7 @@ ENV{DM_UUID}=="mpath-*", \
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
# Create persistent links for dmraid tables
-ENV{DM_UUID}=="dmraid-*", \
+ENV{DM_UUID}=="DMRAID-*", \
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
# Create persistent links for linear tables
@@ -32,7 +32,7 @@ ENV{DM_PART}=="?*", \
# Create dm tables for partitions
ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="mpath-*", \
RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
-ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="dmraid-*", \
+ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="DMRAID-*", \
RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="linear-*", \
RUN+="/sbin/kpartx -a -p _part /dev/$kernel"

View File

@ -1,46 +0,0 @@
From f333a7d0516c053f2acc67c9ecec702e24ffdf44 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 8 Jan 2009 11:44:13 +0100
Subject: [PATCH] Do not reinitialize prio and checker list after config init
init_prio() and init_checker() are called after the config file
is read as we have to know the path to the shared libraries.
But we should not overwrite any checker or prio information read
from the config file.
References: 464373
Signed-off-by: Konrad Rzeszutek <konrad@virtualiron.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/checkers.c | 1 -
libmultipath/prio.c | 1 -
2 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
index 45ef531..4378621 100644
--- a/libmultipath/checkers.c
+++ b/libmultipath/checkers.c
@@ -28,7 +28,6 @@ char * checker_state_name (int i)
int init_checkers (void)
{
- INIT_LIST_HEAD(&checkers);
if (!add_checker(DEFAULT_CHECKER))
return 1;
return 0;
diff --git a/libmultipath/prio.c b/libmultipath/prio.c
index 5e01f54..30e03c2 100644
--- a/libmultipath/prio.c
+++ b/libmultipath/prio.c
@@ -12,7 +12,6 @@ static LIST_HEAD(prioritizers);
int init_prio (void)
{
- INIT_LIST_HEAD(&prioritizers);
if (!add_prio(DEFAULT_PRIO))
return 1;
return 0;
--
1.6.0.2

View File

@ -1,146 +0,0 @@
commit 33a9016139228c492f5e95278c8ee77418c53efa
Author: Hannes Reinecke <hare@suse.de>
Date: Mon Jan 26 13:50:28 2009 +0100
Check for blocked devices in checkerloop()
The checkerloop should also check for blocked devices; reducing
multipathd stall even further.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 2e63cdf..b56899a 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -688,7 +688,7 @@ static int sysfs_get_sdev_state(struct path *pp)
if (!sysfs_get_state(parent, dev_state, 32)) {
if (!strncmp(dev_state, "blocked", 7)) {
condlog(3, "%s: device blocked", pp->dev);
- return PATH_UNCHECKED;
+ return PATH_PENDING;
} else if (!strncmp(dev_state, "running", 7)) {
return PATH_UP;
}
@@ -792,40 +792,40 @@ cciss_ioctl_pathinfo (struct path * pp, int mask)
return 0;
}
-static int
+int
get_state (struct path * pp)
{
struct checker * c = &pp->checker;
+ int state = PATH_UNCHECKED;
condlog(3, "%s: get_state", pp->dev);
if (pp->bus == SYSFS_BUS_SCSI && pp->sysdev) {
/* Check the sdev state before accessing it */
- pp->state = sysfs_get_sdev_state(pp);
- if (pp->state == PATH_UNCHECKED || pp->state == PATH_DOWN) {
+ state = sysfs_get_sdev_state(pp);
+ if (state == PATH_PENDING || state == PATH_DOWN) {
/* Further checking pointless */
- pp->priority = 0;
- return 0;
+ return state;
}
}
if (!checker_selected(c)) {
select_checker(pp);
if (!checker_selected(c)) {
condlog(3, "%s: No checker selected", pp->dev);
- return 1;
+ return PATH_UNCHECKED;
}
checker_set_fd(c, pp->fd);
if (checker_init(c, pp->mpp?&pp->mpp->mpcontext:NULL)) {
condlog(3, "%s: checker init failed", pp->dev);
- return 1;
+ return PATH_UNCHECKED;
}
}
- pp->state = checker_check(c);
- condlog(3, "%s: state = %i", pp->dev, pp->state);
- if (pp->state == PATH_DOWN && strlen(checker_message(c)))
+ state = checker_check(c);
+ condlog(3, "%s: state = %i", pp->dev, state);
+ if (state == PATH_DOWN && strlen(checker_message(c)))
condlog(3, "%s: checker msg is \"%s\"",
pp->dev, checker_message(c));
- return 0;
+ return state;
}
static int
@@ -839,7 +839,7 @@ get_prio (struct path * pp)
if (pp->bus == SYSFS_BUS_SCSI) {
/* Check the sdev state before accessing it */
path_state = sysfs_get_sdev_state(pp);
- if (path_state == PATH_DOWN || path_state == PATH_UNCHECKED) {
+ if (path_state == PATH_DOWN || path_state == PATH_PENDING) {
pp->priority = PRIO_UNDEF;
return 0;
}
@@ -914,8 +914,11 @@ pathinfo (struct path *pp, vector hwtable, int mask)
cciss_ioctl_pathinfo(pp, mask))
goto blank;
- if (mask & DI_CHECKER && get_state(pp))
- goto blank;
+ if (mask & DI_CHECKER) {
+ pp->state = get_state(pp);
+ if (pp->state == PATH_UNCHECKED || pp->state == PATH_WILD)
+ goto blank;
+ }
/*
* Retrieve path priority, even for PATH_DOWN paths if it has never
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index 3749674..a460491 100644
--- a/libmultipath/discovery.h
+++ b/libmultipath/discovery.h
@@ -33,6 +33,7 @@ int pathinfo (struct path *, vector hwtable, int mask);
struct path * store_pathinfo (vector pathvec, vector hwtable,
char * devname, int flag);
int sysfs_set_fc_values (struct path *pp, int dev_loss_tmo, int fast_io_fail_tmo);
+int get_state(struct path *pp);
/*
* discovery bitmask
diff --git a/multipathd/main.c b/multipathd/main.c
index 7bc0211..5456a6c 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -116,6 +116,9 @@ coalesce_maps(struct vectors *vecs, vector nmpv)
unsigned int i;
int j;
+ if (!vecs)
+ return 0;
+
vector_foreach_slot (ompv, ompp, i) {
if (!find_mp_by_wwid(nmpv, ompp->wwid)) {
/*
@@ -942,16 +945,16 @@ check_path (struct vectors * vecs, struct path * pp)
*/
checker_set_async(&pp->checker);
- newstate = checker_check(&pp->checker);
+ newstate = get_state(pp);
- if (newstate < 0) {
+ if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) {
condlog(2, "%s: unusable path", pp->dev);
pathinfo(pp, conf->hwtable, 0);
return;
}
/*
- * Async IO in flight. Keep the previous path state
- * and reschedule as soon as possible
+ * Async IO in flight or path blocked. Keep the previous
+ * path state and reschedule as soon as possible
*/
if (newstate == PATH_PENDING) {
pp->tick = 1;

View File

@ -1,42 +0,0 @@
From 0d18112f4f937626b3c335bf52a6231f5118dd9e Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 30 Oct 2008 13:46:15 +0100
Subject: [PATCH] Do not check for valid mp context in get_state()
When called from 'multipath -ll' get_state() does not
have a valid context. But the checkers should run nevertheless
as we need the state here but are not interested in any long-term
issues.
References: 433659
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/discovery.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index a5ae8aa..9929e19 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -659,15 +659,14 @@ get_state (struct path * pp)
{
struct checker * c = &pp->checker;
- if (!pp->mpp)
- return 0;
+ condlog(3, "%s: get_state", pp->dev);
if (!checker_selected(c)) {
select_checker(pp);
if (!checker_selected(c))
return 1;
checker_set_fd(c, pp->fd);
- if (checker_init(c, &pp->mpp->mpcontext))
+ if (checker_init(c, pp->mpp?&pp->mpp->mpcontext:NULL))
return 1;
}
pp->state = checker_check(c);
--
1.5.4.5

View File

@ -1,82 +0,0 @@
From 23348c651f2c4bc7d41a6aa32957615403cf1533 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 13 Jan 2009 15:32:52 +0100
Subject: [PATCH] Don't run checkers or prio for blocked devices
When a device is in 'blocked' state any I/O to it will be
blocked. Hence multipathd will stall when running the
path checker until the device is unblocked, leaving the
entire mulitpath daemon hanging.
So we have to check for the state and _not_ run any
checker or prioritizer if the device is blocked.
References: bnc#464155
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/discovery.c | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index a18a46a..afd247d 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -144,6 +144,7 @@ declare_sysfs_get_str(cutype);
declare_sysfs_get_str(vendor);
declare_sysfs_get_str(model);
declare_sysfs_get_str(rev);
+declare_sysfs_get_str(state);
int
sysfs_get_dev (struct sysfs_device * dev, char * buff, size_t len)
@@ -688,6 +689,23 @@ get_state (struct path * pp)
condlog(3, "%s: get_state", pp->dev);
+ if (pp->bus == SYSFS_BUS_SCSI && pp->sysdev) {
+ struct sysfs_device *parent;
+ char dev_state[32];
+
+ /* check device state */
+ parent = sysfs_device_get_parent(pp->sysdev);
+ if (parent && !strncmp(parent->kernel, "block", 5))
+ parent = sysfs_device_get_parent(parent);
+ if (parent && !sysfs_get_state(parent, dev_state, 32)) {
+ if (!strncmp(dev_state, "blocked", 7)) {
+ condlog(3, "%s: device blocked", pp->dev);
+ pp->state = PATH_DOWN;
+ pp->priority = 0;
+ return 0;
+ }
+ }
+ }
if (!checker_selected(c)) {
select_checker(pp);
if (!checker_selected(c)) {
@@ -714,6 +732,23 @@ get_prio (struct path * pp)
if (!pp)
return 0;
+ if (pp->bus == SYSFS_BUS_SCSI && pp->sysdev) {
+ struct sysfs_device *parent;
+ char dev_state[32];
+
+ /* check device state */
+ parent = sysfs_device_get_parent(pp->sysdev);
+ if (parent && !strncmp(parent->kernel, "block", 5))
+ parent = sysfs_device_get_parent(parent);
+ if (parent && !sysfs_get_state(parent, dev_state, 32)) {
+ if (!strncmp(dev_state, "blocked", 7)) {
+ condlog(3, "%s: device blocked", pp->dev);
+ pp->priority = PRIO_UNDEF;
+ return 0;
+ }
+ }
+ }
+
if (!pp->prio) {
select_prio(pp);
if (!pp->prio) {
--
1.5.3.2

View File

@ -1,136 +0,0 @@
From 5974ba6dd190ed7b5633467962c2cd1dd2beb85d Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Fri, 12 Dec 2008 13:49:30 +0100
Subject: [PATCH] Enhanced error for invalid checker or prioritizer
An invalid checker or prioritizer shouldn't be greeted
with the incomprehensible 'A dynamic linking error ...'
message. Rather display something sensible here.
Oh, and fix up list initialization alloc_X().
References: 456214
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/checkers.c | 23 +++++++++++++++++------
libmultipath/prio.c | 22 +++++++++++++++++-----
2 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
index 2640281..231b408 100644
--- a/libmultipath/checkers.c
+++ b/libmultipath/checkers.c
@@ -2,6 +2,7 @@
#include <string.h>
#include <stddef.h>
#include <dlfcn.h>
+#include <sys/stat.h>
#include "debug.h"
#include "checkers.h"
@@ -35,7 +36,12 @@ int init_checkers (void)
struct checker * alloc_checker (void)
{
- return zalloc(sizeof(struct checker));
+ struct checker *c;
+
+ c = zalloc(sizeof(struct checker));
+ if (c)
+ INIT_LIST_HEAD(&c->node);
+ return c;
}
void free_checker (struct checker * c)
@@ -75,6 +81,7 @@ struct checker * checker_lookup (char * name)
struct checker * add_checker (char * name)
{
char libname[LIB_CHECKER_NAMELEN];
+ struct stat stbuf;
struct checker * c;
char *errstr;
@@ -83,14 +90,18 @@ struct checker * add_checker (char * name)
return NULL;
snprintf(libname, LIB_CHECKER_NAMELEN, "%s/libcheck%s.so",
conf->multipath_dir, name);
+ if (stat(libname,&stbuf) < 0) {
+ condlog(0,"Invalid checker '%s'", name);
+ goto out;
+ }
condlog(3, "loading %s checker", libname);
c->handle = dlopen(libname, RTLD_NOW);
- errstr = dlerror();
- if (errstr != NULL)
- condlog(0, "A dynamic linking error occurred: (%s)", errstr);
- if (!c->handle)
+ if (!c->handle) {
+ if ((errstr = dlerror()) != NULL)
+ condlog(0, "A dynamic linking error occurred: (%s)",
+ errstr);
goto out;
-
+ }
c->check = (int (*)(struct checker *)) dlsym(c->handle, "libcheck_check");
errstr = dlerror();
if (errstr != NULL)
diff --git a/libmultipath/prio.c b/libmultipath/prio.c
index 352e9ca..1b9f51b 100644
--- a/libmultipath/prio.c
+++ b/libmultipath/prio.c
@@ -2,6 +2,7 @@
#include <string.h>
#include <stddef.h>
#include <dlfcn.h>
+#include <sys/stat.h>
#include "debug.h"
#include "prio.h"
@@ -19,7 +20,12 @@ int init_prio (void)
struct prio * alloc_prio (void)
{
- return zalloc(sizeof(struct prio));
+ struct prio *p;
+
+ p = zalloc(sizeof(struct prio));
+ if (p)
+ INIT_LIST_HEAD(&p->node);
+ return p;
}
void free_prio (struct prio * p)
@@ -59,6 +65,7 @@ struct prio * prio_lookup (char * name)
struct prio * add_prio (char * name)
{
char libname[LIB_PRIO_NAMELEN];
+ struct stat stbuf;
struct prio * p;
char *errstr;
@@ -67,13 +74,18 @@ struct prio * add_prio (char * name)
return NULL;
snprintf(libname, LIB_PRIO_NAMELEN, "%s/libprio%s.so",
conf->multipath_dir, name);
+ if (stat(libname,&stbuf) < 0) {
+ condlog(0,"Invalid prioritizer '%s'", name);
+ goto out;
+ }
condlog(3, "loading %s prioritizer", libname);
p->handle = dlopen(libname, RTLD_NOW);
- errstr = dlerror();
- if (errstr != NULL)
- condlog(0, "A dynamic linking error occurred: (%s)", errstr);
- if (!p->handle)
+ if (!p->handle) {
+ if ((errstr = dlerror()) != NULL)
+ condlog(0, "A dynamic linking error occurred: (%s)",
+ errstr);
goto out;
+ }
p->getprio = (int (*)(struct path *)) dlsym(p->handle, "getprio");
errstr = dlerror();
if (errstr != NULL)
--
1.6.0.2

View File

@ -1,40 +0,0 @@
commit 91b2c44cb23076ec0cb647dc42b438f1583677c7
Author: Hannes Reinecke <hare@suse.de>
Date: Wed Jan 21 13:26:51 2009 +0100
Update misleading debug messages for directio checker
io_getevents returns the number of events received, so '1'
is actual a success. And calling 'strerror(errno)' unconditionally
here will lead to false errors as the errno value won't be
updated then.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/checkers/directio.c b/libmultipath/checkers/directio.c
index c701609..ecf0dd2 100644
--- a/libmultipath/checkers/directio.c
+++ b/libmultipath/checkers/directio.c
@@ -149,14 +149,19 @@ check_state(int fd, struct directio_context *ct, int sync)
ct->running++;
r = io_getevents(ct->ioctx, 1L, 1L, &event, &timeout);
- LOG(3, "async io getevents returns %li (errno=%s)", r, strerror(errno));
- if (r < 1L) {
+ if (r < 0 ) {
+ LOG(3, "async io getevents returned %li (errno=%s)", r,
+ strerror(errno));
+ rc = PATH_UNCHECKED;
+ } else if (r < 1L) {
if (ct->running > ASYNC_TIMEOUT_SEC || sync) {
LOG(3, "abort check on timeout");
rc = PATH_DOWN;
- } else
+ } else {
+ LOG(3, "async io pending");
rc = PATH_PENDING;
+ }
} else {
LOG(3, "io finished %lu/%lu", event.res, event.res2);
ct->running = 0;

View File

@ -1,60 +0,0 @@
From 67c3b7d8d0ec6f438d11c02c0ad78041ef67d924 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 7 Jan 2009 10:52:25 +0100
Subject: [PATCH] Fix sysfs_attr_get_value()
sysfs_attr_get_value() should return NULL if the attribute was not
found or found to be empty. And we should increase the attribute
value size to avoid overflows.
And overflows should be truncated, not ignored.
References: bnc#456747
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/structs.h | 2 +-
libmultipath/sysfs.c | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 75bd379..8596e8d 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -10,7 +10,7 @@
#define CALLOUT_MAX_SIZE 128
#define BLK_DEV_SIZE 33
#define PATH_SIZE 512
-#define NAME_SIZE 128
+#define NAME_SIZE 512
#define SCSI_VENDOR_SIZE 9
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index c0d4d5f..e00a101 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -445,8 +445,10 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name)
close(fd);
if (size < 0)
goto out;
- if (size == sizeof(value))
- goto out;
+ if (size == sizeof(value)) {
+ dbg("overflow in attribute '%s', truncating", path_full);
+ size--;
+ }
/* got a valid value, store and return it */
value[size] = '\0';
@@ -456,7 +458,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name)
attr->value = attr->value_local;
out:
- return attr->value;
+ return attr && attr->value && strlen(attr->value) ? attr->value : NULL;
}
int sysfs_lookup_devpath_by_subsys_id(char *devpath_full, size_t len,
--
1.6.0.2

View File

@ -1,47 +0,0 @@
From 297a4a148a8469e272c6ed0cfb394a38a324fb0b Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Fri, 12 Dec 2008 14:41:51 +0100
Subject: [PATCH] Fix merge error from prio_weightedpath
Merge error.
References: 441007
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/dict.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 9ba3961..09ecf51 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -640,14 +640,17 @@ hw_prio_handler(vector strvec)
return 1;
temp = buff;
- while ((result = strsep(&temp, split_char))) {
- if (prio_lookup(result)) {
- conf->prio_name = STRDUP(result);
- if (temp)
- conf->prio_arg = STRDUP(temp);
- else
- conf->prio_arg = NULL;
- break;
+ while (temp) {
+ result = strsep(&temp, split_char);
+ if (strcmp(result, "")) {
+ if (prio_lookup(result)) {
+ hwe->prio_name = STRDUP(result);
+ if (temp)
+ hwe->prio_arg = STRDUP(temp);
+ else
+ hwe->prio_arg = NULL;
+ break;
+ }
}
}
--
1.6.0.2

View File

@ -1,123 +0,0 @@
From 244454da2d4f3cb5d197a6b0e6fc2b4c8d72d08c Mon Sep 17 00:00:00 2001
From: Christophe Varoqui <christophe.varoqui@free.fr>
Date: Mon, 29 Sep 2008 00:44:46 +0200
Subject: [PATCH] [libmultipath] fixes for "show paths format"
o undue 1-char rollback when encountering unknown wildcard
o fix segfault when format starts with an unknown wildard
o continue parsing the format after an unknown wildcard
---
libmultipath/print.c | 33 +++++++++++++--------------------
1 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 459b973..7411ccc 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -28,6 +28,9 @@
#define NOPAD s = c
#define PAD(x) while ((int)(c - s) < (x) && (c < (line + len - 1))) \
*c++ = ' '; s = c
+#define ENDLINE \
+ if (c > line) \
+ line[c - line - 1] = '\n'
#define PRINT(var, size, format, args...) \
fwd = snprintf(var, size, format, ##args); \
c += (fwd >= size) ? size : fwd;
@@ -532,15 +535,13 @@ snprint_multipath_header (char * line, int len, char * format)
f++;
if (!(data = mpd_lookup(*f)))
- break; /* unknown wildcard */
+ continue; /* unknown wildcard */
PRINT(c, TAIL, data->header);
PAD(data->width);
} while (*f++);
- line[c - line - 1] = '\n';
- line[c - line] = '\0';
-
+ ENDLINE;
return (c - line);
}
@@ -567,7 +568,7 @@ snprint_multipath (char * line, int len, char * format,
f++;
if (!(data = mpd_lookup(*f)))
- break;
+ continue;
data->snprint(buff, MAX_FIELD_LEN, mpp);
PRINT(c, TAIL, buff);
@@ -575,9 +576,7 @@ snprint_multipath (char * line, int len, char * format,
buff[0] = '\0';
} while (*f++);
- line[c - line - 1] = '\n';
- line[c - line] = '\0';
-
+ ENDLINE;
return (c - line);
}
@@ -602,15 +601,13 @@ snprint_path_header (char * line, int len, char * format)
f++;
if (!(data = pd_lookup(*f)))
- break; /* unknown wildcard */
+ continue; /* unknown wildcard */
PRINT(c, TAIL, data->header);
PAD(data->width);
} while (*f++);
- line[c - line - 1] = '\n';
- line[c - line] = '\0';
-
+ ENDLINE;
return (c - line);
}
@@ -637,16 +634,14 @@ snprint_path (char * line, int len, char * format,
f++;
if (!(data = pd_lookup(*f)))
- break;
+ continue;
data->snprint(buff, MAX_FIELD_LEN, pp);
PRINT(c, TAIL, buff);
PAD(data->width);
} while (*f++);
- line[c - line - 1] = '\n';
- line[c - line] = '\0';
-
+ ENDLINE;
return (c - line);
}
@@ -673,16 +668,14 @@ snprint_pathgroup (char * line, int len, char * format,
f++;
if (!(data = pgd_lookup(*f)))
- break;
+ continue;
data->snprint(buff, MAX_FIELD_LEN, pgp);
PRINT(c, TAIL, buff);
PAD(data->width);
} while (*f++);
- line[c - line - 1] = '\n';
- line[c - line] = '\0';
-
+ ENDLINE;
return (c - line);
}
--
1.5.2.4

View File

@ -1,29 +0,0 @@
From 62ff5068186fd0baf3d93ea85b00aaffe3bf4810 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 29 Oct 2008 17:00:16 +0100
Subject: [PATCH] Incorrect scsi_id commandline for cciss
The scsi_id program was called with incorrect commandline
for cciss devices. Fix.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/hwtable.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index f87907d..fda131c 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -193,7 +193,7 @@ static struct hwentry default_hw[] = {
/* HP Smart Array */
.vendor = "HP",
.product = "LOGICAL VOLUME.*",
- .getuid = "/lib/udev/scsi_id -n -g -u -d /dev/%n",
+ .getuid = "/lib/udev/scsi_id -g -u -d /dev/%n",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
.selector = DEFAULT_SELECTOR,
--
1.5.4.5

View File

@ -1,28 +0,0 @@
From 3cf5b5aaa64e673364e8758640e5d5434425235b Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 9 Oct 2008 12:53:38 +0200
Subject: [PATCH] fopen returns NULL on failure, not -1
References: 432598
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/discovery.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index e1a67ac..a5ae8aa 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -237,7 +237,7 @@ devt2devname (char *devname, char *devt)
return 1;
}
- if ((fd = fopen("/proc/partitions", "r")) < 0) {
+ if (!(fd = fopen("/proc/partitions", "r"))) {
condlog(0, "Cannot open /proc/partitions");
return 1;
}
--
1.5.2.4

File diff suppressed because it is too large Load Diff

View File

@ -1,67 +0,0 @@
commit 4322929c30a2f2bb57ebb1d427eb7536adb05dc1
Author: Hannes Reinecke <hare@suse.de>
Date: Thu Nov 6 09:16:00 2008 +0100
Handle arguments to multipathd from the init file
Introduces a $ARGS variable through which we could
pass arguments to multipathd.
There's also a change in the stop section of the initscript. If multipathd
is manually executed with an option like "-v9", the output of $DAEMON does not
match $PROCNAME. This leads to multipathd never being killed when stop is called
Signed-off-by: Ritesh Raj Sarraf <rsarraf@netapp.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/multipathd/multipathd.init.suse b/multipathd/multipathd.init.suse
index 664a4c5..d9bcc51 100755
--- a/multipathd/multipathd.init.suse
+++ b/multipathd/multipathd.init.suse
@@ -22,6 +22,7 @@
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/sbin/multipathd
PIDFILE=/var/run/multipathd.pid
+ARGS=""
# Set the maximum number of open files
MAX_OPEN_FDS=4096
@@ -46,11 +47,11 @@ case "$1" in
if [ -f $PIDFILE ]; then
PID="$(cat $PIDFILE)"
- PROCNAME="$(ps -o cmd --no-headers $PID)"
+ PROCNAME="$(ps -p $PID -o comm=)"
fi
- if [ "$PROCNAME" != "$DAEMON" ]; then
- $DAEMON
+ if [ "$PROCNAME" != `basename $DAEMON` ]; then
+ $DAEMON $ARGS
fi
# Remember status and be verbose
@@ -64,10 +65,10 @@ case "$1" in
# So implement a cruder version:
if [ -f $PIDFILE ]; then
PID="$(cat $PIDFILE)"
- PROCNAME="$(ps -o cmd --no-headers $PID)"
+ PROCNAME="$(ps -p $PID -o comm=)"
fi
- if [ "$PROCNAME" == "$DAEMON" ]; then
+ if [ "$PROCNAME" == `basename $DAEMON` ]; then
kill -TERM $PID
fi
@@ -109,8 +110,8 @@ case "$1" in
if [ -f $PIDFILE ]; then
PID="$(cat $PIDFILE)"
- PROCNAME="$(ps -o cmd --no-headers $PID)"
- if [ "$PROCNAME" == "$DAEMON" ]; then
+ PROCNAME="$(ps -p $PID -o comm=)"
+ if [ "$PROCNAME" == `basename $DAEMON` ]; then
(exit 0)
else
(exit 1)

View File

@ -1,423 +0,0 @@
From 4c6e3b7eff9825353610bfc3130276e6f5233247 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 13 Jan 2009 16:01:30 +0100
Subject: [PATCH] Implement dev_loss_tmo and fast_io_fail_tmo
When using multipath the 'dev_loss_tmo' and 'fast_io_fail_tmo'
settings should be as small as possible to avoid any stalls
in multipathd. So we should be able to configure both
from within mulitpath.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/config.c | 2 +
libmultipath/config.h | 4 +
libmultipath/dict.c | 144 ++++++++++++++++++++++++++++++++++++++++++++
libmultipath/discovery.c | 104 +++++++++++++++++++++++++++++++
libmultipath/discovery.h | 1 +
libmultipath/structs_vec.c | 6 ++
multipath/multipath.conf.5 | 12 ++++
7 files changed, 273 insertions(+), 0 deletions(-)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index 83da6e7..ea7ad99 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -463,6 +463,8 @@ load_config (char * file)
conf->dev_type = DEV_NONE;
conf->minio = 1000;
conf->max_fds = 0;
+ conf->dev_loss_tmo = 0;
+ conf->fast_io_fail_tmo = 0;
conf->multipath_dir = set_default(DEFAULT_MULTIPATHDIR);
/*
diff --git a/libmultipath/config.h b/libmultipath/config.h
index fc0e22d..7d23927 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -29,6 +29,8 @@ struct hwentry {
int no_path_retry;
int minio;
int pg_timeout;
+ int dev_loss_tmo;
+ int fast_io_fail_tmo;
char * bl_product;
};
@@ -67,6 +69,8 @@ struct config {
int pg_timeout;
int max_fds;
int force_reload;
+ int dev_loss_tmo;
+ int fast_io_fail_tmo;
char * dev;
char * sysfs_dir;
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 09ecf51..ed77000 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -189,6 +189,46 @@ max_fds_handler(vector strvec)
}
static int
+def_dev_loss_tmo_handler(vector strvec)
+{
+ char * buff;
+
+ buff = set_value(strvec);
+
+ if (!buff)
+ return 1;
+
+ if (strlen(buff) == 9 &&
+ !strcmp(buff, "off"))
+ conf->dev_loss_tmo = -1;
+ else
+ conf->dev_loss_tmo = atoi(buff);
+ FREE(buff);
+
+ return 0;
+}
+
+static int
+def_fast_io_fail_tmo_handler(vector strvec)
+{
+ char * buff;
+
+ buff = set_value(strvec);
+
+ if (!buff)
+ return 1;
+
+ if (strlen(buff) == 9 &&
+ !strcmp(buff, "off"))
+ conf->fast_io_fail_tmo = -1;
+ else
+ conf->fast_io_fail_tmo = atoi(buff);
+ FREE(buff);
+
+ return 0;
+}
+
+static int
def_weight_handler(vector strvec)
{
char * buff;
@@ -779,6 +819,54 @@ hw_pg_timeout_handler(vector strvec)
return 0;
}
+static int
+hw_dev_loss_tmo_handler(vector strvec)
+{
+ struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable);
+ char * buff;
+
+ if (!hwe)
+ return 1;
+
+ buff = set_value(strvec);
+
+ if (!buff)
+ return 1;
+
+ if (strlen(buff) == 9 &&
+ !strcmp(buff, "off"))
+ hwe->dev_loss_tmo = -1;
+ else
+ hwe->dev_loss_tmo = atoi(buff);
+ FREE(buff);
+
+ return 0;
+}
+
+static int
+hw_fast_io_fail_tmo_handler(vector strvec)
+{
+ struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable);
+ char * buff;
+
+ if (!hwe)
+ return 1;
+
+ buff = set_value(strvec);
+
+ if (!buff)
+ return 1;
+
+ if (strlen(buff) == 9 &&
+ !strcmp(buff, "off"))
+ hwe->fast_io_fail_tmo = -1;
+ else
+ hwe->fast_io_fail_tmo = atoi(buff);
+ FREE(buff);
+
+ return 0;
+}
+
/*
* multipaths block handlers
*/
@@ -1406,6 +1494,36 @@ snprint_hw_path_checker (char * buff, int len, void * data)
}
static int
+snprint_hw_dev_loss_tmo (char * buff, int len, void * data)
+{
+ struct hwentry * hwe = (struct hwentry *)data;
+
+ if (!hwe->dev_loss_tmo)
+ return 0;
+ if (hwe->dev_loss_tmo == conf->dev_loss_tmo)
+ return 0;
+
+ if (hwe->dev_loss_tmo < 0)
+ return snprintf(buff, len, "off");
+ return snprintf(buff, len, "%u", hwe->dev_loss_tmo);
+}
+
+static int
+snprint_hw_fast_io_fail_tmo (char * buff, int len, void * data)
+{
+ struct hwentry * hwe = (struct hwentry *)data;
+
+ if (!hwe->fast_io_fail_tmo)
+ return 0;
+ if (hwe->fast_io_fail_tmo == conf->fast_io_fail_tmo)
+ return 0;
+
+ if (hwe->fast_io_fail_tmo < 0)
+ return snprintf(buff, len, "off");
+ return snprintf(buff, len, "%u", hwe->fast_io_fail_tmo);
+}
+
+static int
snprint_def_polling_interval (char * buff, int len, void * data)
{
if (conf->checkint == DEFAULT_CHECKINT)
@@ -1565,6 +1683,28 @@ snprint_max_fds (char * buff, int len, void * data)
}
static int
+snprint_def_dev_loss_tmo (char * buff, int len, void * data)
+{
+ if (!conf->dev_loss_tmo)
+ return 0;
+
+ if (conf->dev_loss_tmo < 0)
+ return snprintf(buff, len, "off");
+ return snprintf(buff, len, "%d", conf->dev_loss_tmo);
+}
+
+static int
+snprint_def_fast_io_fail_tmo (char * buff, int len, void * data)
+{
+ if (!conf->fast_io_fail_tmo)
+ return 0;
+
+ if (conf->fast_io_fail_tmo < 0)
+ return snprintf(buff, len, "off");
+ return snprintf(buff, len, "%d", conf->fast_io_fail_tmo);
+}
+
+static int
snprint_def_rr_weight (char * buff, int len, void * data)
{
if (!conf->rr_weight)
@@ -1681,6 +1821,8 @@ init_keywords(void)
install_keyword("failback", &default_failback_handler, &snprint_def_failback);
install_keyword("rr_min_io", &def_minio_handler, &snprint_def_rr_min_io);
install_keyword("max_fds", &max_fds_handler, &snprint_max_fds);
+ install_keyword("dev_loss_tmo", &def_dev_loss_tmo_handler, &snprint_def_dev_loss_tmo);
+ install_keyword("fast_io_fail_tmo", &def_fast_io_fail_tmo_handler, &snprint_def_fast_io_fail_tmo);
install_keyword("rr_weight", &def_weight_handler, &snprint_def_rr_weight);
install_keyword("no_path_retry", &def_no_path_retry_handler, &snprint_def_no_path_retry);
install_keyword("pg_timeout", &def_pg_timeout_handler, &snprint_def_pg_timeout);
@@ -1739,6 +1881,8 @@ init_keywords(void)
install_keyword("no_path_retry", &hw_no_path_retry_handler, &snprint_hw_no_path_retry);
install_keyword("rr_min_io", &hw_minio_handler, &snprint_hw_rr_min_io);
install_keyword("pg_timeout", &hw_pg_timeout_handler, &snprint_hw_pg_timeout);
+ install_keyword("dev_loss_tmo", &hw_dev_loss_tmo_handler, &snprint_hw_dev_loss_tmo);
+ install_keyword("fast_io_fail_tmo", &hw_fast_io_fail_tmo_handler, &snprint_hw_fast_io_fail_tmo);
install_sublevel_end();
install_keyword_root("multipaths", &multipaths_handler);
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index afd247d..6e4ce1e 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -209,6 +209,110 @@ sysfs_get_fc_nodename (struct sysfs_device * dev, char * node,
return 1;
}
+int
+sysfs_set_fc_values (struct path *pp, int dev_loss_tmo, int fast_io_fail_tmo)
+{
+ char attr_path[SYSFS_PATH_SIZE];
+ char host_path[SYSFS_PATH_SIZE];
+ char attr_value[NAME_SIZE];
+ DIR *host_dir, *rport_dir;
+ struct dirent *host_ent, *rport_ent;
+ int host, channel, lun, port, num;
+ int rport_channel = -1;
+ int rport_id = -1;
+
+ if (dev_loss_tmo == 0 || fast_io_fail_tmo == 0) {
+ condlog(4, "%s: no FC settings", pp->dev);
+ return 0;
+ }
+
+ if (safe_sprintf(host_path, "/sys/class/fc_host/host%i/device",
+ pp->sg_id.host_no)) {
+ condlog(0, "host_path too small");
+ return 1;
+ }
+ if (!(host_dir = opendir(host_path))) {
+ condlog(3, "host %d not a FC HBA", pp->sg_id.host_no);
+ return 0;
+ }
+
+ while (rport_channel < 0 && rport_id < 0 &&
+ (host_ent = readdir(host_dir))) {
+ if (sscanf(host_ent->d_name, "rport-%d:%d-%d",
+ &host, &port, &num) != 3)
+ continue;
+
+ if (host != pp->sg_id.host_no)
+ continue;
+
+ if (safe_sprintf(attr_path, "%s/%s",
+ host_path, host_ent->d_name)) {
+ condlog(0, "target_path too small");
+ continue;
+ }
+
+ if (!(rport_dir = opendir(attr_path))) {
+ condlog(1, "cannot open rport path '%s'", attr_path);
+ continue;
+ }
+
+ while ((rport_ent = readdir(rport_dir))) {
+ if (sscanf(rport_ent->d_name, "target%d:%d:%d",
+ &host, &channel, &lun) != 3)
+ continue;
+
+ if (host != pp->sg_id.host_no &&
+ channel != pp->sg_id.channel &&
+ lun != pp->sg_id.scsi_id)
+ continue;
+
+ rport_channel = port;
+ rport_id = num;
+ break;
+ }
+ }
+
+ if (rport_channel < 0 && rport_id < 0) {
+ condlog(1, "No rport found");
+ return 0;
+ }
+
+ if (safe_sprintf(attr_path,
+ "/class/fc_remote_ports/rport-%d:%d-%d",
+ pp->sg_id.host_no, rport_channel, rport_id)) {
+ condlog(0, "attr_path too small");
+ return 0;
+ }
+
+ if (dev_loss_tmo < 0)
+ sprintf(attr_value, "%d", 0);
+ else
+ sprintf(attr_value, "%d", dev_loss_tmo);
+ num = sysfs_attr_set_value(attr_path, "dev_loss_tmo",
+ attr_value, strlen(attr_value));
+ if (num > 0)
+ condlog(4, "%s: set dev_loss_tmo to %d", pp->dev,
+ dev_loss_tmo);
+ else
+ condlog(4, "%s: failed to set dev_loss_tmo (%d)",
+ pp->dev, errno);
+
+ if (fast_io_fail_tmo < 0)
+ sprintf(attr_value, "%d", 0);
+ else
+ sprintf(attr_value, "%d", fast_io_fail_tmo);
+ num = sysfs_attr_set_value(attr_path, "fast_io_fail_tmo",
+ attr_value, strlen(attr_value));
+ if (num > 0)
+ condlog(4, "%s: set fast_io_fail_tmo to %d", pp->dev,
+ fast_io_fail_tmo);
+ else
+ condlog(4, "%s: failed to set fast_io_fail_tmo (%d)",
+ pp->dev, errno);
+
+ return num == strlen(attr_value) ? 0 : 1;
+}
+
static int
opennode (char * dev, int mode)
{
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index 05b1cfe..3749674 100644
--- a/libmultipath/discovery.h
+++ b/libmultipath/discovery.h
@@ -32,6 +32,7 @@ int devt2devname (char *, char *);
int pathinfo (struct path *, vector hwtable, int mask);
struct path * store_pathinfo (vector pathvec, vector hwtable,
char * devname, int flag);
+int sysfs_set_fc_values (struct path *pp, int dev_loss_tmo, int fast_io_fail_tmo);
/*
* discovery bitmask
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index a1d9632..1632c9d 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -479,6 +479,12 @@ verify_paths(struct multipath * mpp, struct vectors * vecs, vector rpvec)
free_path(pp);
}
} else {
+ if (pp->hwe)
+ sysfs_set_fc_values(pp, pp->hwe->dev_loss_tmo,
+ pp->hwe->fast_io_fail_tmo);
+ else
+ sysfs_set_fc_values(pp, conf->dev_loss_tmo,
+ conf->fast_io_fail_tmo);
condlog(4, "%s: verified path %s dev_t %s",
mpp->alias, pp->dev, pp->dev_t);
}
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 8ac1f1c..926ff69 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -263,6 +263,14 @@ Default is
.B bindings_file
The full pathname of the binding file to be used when the user_friendly_names option is set. Defaults to
.I /var/lib/multipath/bindings
+.TP
+.B dev_loss_tmo
+The default dev_loss_tmo setting for an FC remote port in seconds. If an rport has vanished from the fabric all devices on that port will be removed from sysfs after this timeout.
+.TP
+.B fast_io_fail_tmo
+The default fast_io_fail_tmo setting for an FC remote port in seconds. If an rport has vanished from the fabric all I/O to the devices on that port will be terminated after this timeout. Should be smaller than
+.B dev_loss_tmo
+setting.
.
.SH "blacklist section"
The
@@ -413,6 +421,10 @@ section:
.B no_path_retry
.TP
.B rr_min_io
+.TP
+.B dev_loss_tmo
+.TP
+.B fast_io_fail_tmo
.RE
.PD
.LP
--
1.5.3.2

View File

@ -1,541 +0,0 @@
commit 4b080ac4b0124a911e3785ce3ac77001390d1a23
Author: Hannes Reinecke <hare@suse.de>
Date: Fri Sep 26 16:07:13 2008 +0200
multipath: Implement 'resize map' cli command
To properly support device resize we'll have to notify
multipath about the size changes, too.
References: FATE#302007
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 43324c6..8444ef2 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -348,7 +348,16 @@ domap (struct multipath * mpp)
case ACT_RELOAD:
r = (dm_addmap_reload(mpp->alias, mpp->params, mpp->size, NULL)
- && dm_simplecmd(DM_DEVICE_RESUME, mpp->alias));
+ && dm_simplecmd(DM_DEVICE_RESUME, mpp->alias, 1));
+ break;
+
+ case ACT_RESIZE:
+ r = dm_addmap_reload(mpp->alias, mpp->params, mpp->size, NULL);
+ if (!r)
+ r = dm_addmap_reload_ro(mpp->alias, mpp->params,
+ mpp->size, NULL);
+ if (r)
+ r = dm_simplecmd(DM_DEVICE_RESUME, mpp->alias, 0);
break;
case ACT_RENAME:
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
index 75d5057..25891ba 100644
--- a/libmultipath/configure.h
+++ b/libmultipath/configure.h
@@ -7,6 +7,7 @@
#define ACT_SWITCHPG_STR "switchpg"
#define ACT_RENAME_STR "rename"
#define ACT_CREATE_STR "create"
+#define ACT_RESIZE_STR "resize"
enum actions {
ACT_UNDEF,
@@ -15,7 +16,8 @@ enum actions {
ACT_RELOAD,
ACT_SWITCHPG,
ACT_RENAME,
- ACT_CREATE
+ ACT_CREATE,
+ ACT_RESIZE,
};
#define FLUSH_ONE 1
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 70e10c2..92afae7 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -150,7 +150,7 @@ dm_prereq (void)
}
extern int
-dm_simplecmd (int task, const char *name) {
+dm_simplecmd (int task, const char *name, int no_flush) {
int r = 0;
struct dm_task *dmt;
@@ -163,7 +163,8 @@ dm_simplecmd (int task, const char *name) {
dm_task_no_open_count(dmt);
dm_task_skip_lockfs(dmt); /* for DM_DEVICE_RESUME */
#ifdef LIBDM_API_FLUSH
- dm_task_no_flush(dmt); /* for DM_DEVICE_SUSPEND/RESUME */
+ if (no_flush)
+ dm_task_no_flush(dmt); /* for DM_DEVICE_SUSPEND/RESUME */
#endif
r = dm_task_run (dmt);
@@ -536,7 +537,7 @@ dm_flush_map (const char * mapname)
return 1;
}
- r = dm_simplecmd(DM_DEVICE_REMOVE, mapname);
+ r = dm_simplecmd(DM_DEVICE_REMOVE, mapname, 0);
if (r) {
condlog(4, "multipath map %s removed", mapname);
@@ -933,7 +934,7 @@ dm_remove_partmaps (const char * mapname)
*/
condlog(4, "partition map %s removed",
names->name);
- dm_simplecmd(DM_DEVICE_REMOVE, names->name);
+ dm_simplecmd(DM_DEVICE_REMOVE, names->name, 0);
}
next = names->next;
diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h
index a340c00..b262efa 100644
--- a/libmultipath/devmapper.h
+++ b/libmultipath/devmapper.h
@@ -3,7 +3,7 @@
void dm_init(void);
int dm_prereq (void);
-int dm_simplecmd (int, const char *);
+int dm_simplecmd (int, const char *, int);
int dm_addmap_create (const char *, const char *,
unsigned long long size, const char *uuid);
int dm_addmap_create_ro (const char *, const char *,
diff --git a/libmultipath/sysfs.h b/libmultipath/sysfs.h
index e7fa3e7..2cd762f 100644
--- a/libmultipath/sysfs.h
+++ b/libmultipath/sysfs.h
@@ -21,5 +21,6 @@ struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device
void sysfs_device_put(struct sysfs_device *dev);
char *sysfs_attr_get_value(const char *devpath, const char *attr_name);
int sysfs_resolve_link(char *path, size_t size);
+int sysfs_get_size (struct sysfs_device * dev, unsigned long long * size);
#endif
diff --git a/multipathd/cli.c b/multipathd/cli.c
index 7eaac73..f5b9797 100644
--- a/multipathd/cli.c
+++ b/multipathd/cli.c
@@ -155,6 +155,7 @@ load_keys (void)
r += add_key(keys, "resume", RESUME, 0);
r += add_key(keys, "reinstate", REINSTATE, 0);
r += add_key(keys, "fail", FAIL, 0);
+ r += add_key(keys, "resize", RESIZE, 0);
r += add_key(keys, "paths", PATHS, 0);
r += add_key(keys, "maps", MAPS, 0);
r += add_key(keys, "multipaths", MAPS, 0);
diff --git a/multipathd/cli.h b/multipathd/cli.h
index 8c83eab..d4a038c 100644
--- a/multipathd/cli.h
+++ b/multipathd/cli.h
@@ -7,6 +7,7 @@ enum {
__RESUME,
__REINSTATE,
__FAIL,
+ __RESIZE,
__PATHS,
__MAPS,
__PATH,
@@ -30,6 +31,7 @@ enum {
#define RESUME (1 << __RESUME)
#define REINSTATE (1 << __REINSTATE)
#define FAIL (1 << __FAIL)
+#define RESIZE (1 << __RESIZE)
#define PATHS (1 << __PATHS)
#define MAPS (1 << __MAPS)
#define PATH (1 << __PATH)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index c84805a..38130f5 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -14,6 +14,7 @@
#include <debug.h>
#include <print.h>
#include <sysfs.h>
+#include <errno.h>
#include "main.h"
#include "cli.h"
@@ -362,12 +363,139 @@ cli_del_map (void * v, char ** reply, int * len, void * data)
}
int
+reload_paths(struct multipath *mpp, struct vectors * vecs)
+{
+ struct pathgroup *pgp;
+ struct path *pp;
+ int i, j, err = 1;
+ char *dev;
+ vector path_names;
+
+ path_names = vector_alloc();
+ if (!path_names){
+ condlog(0, "%s: unable to allcoate space for pathnames vector",
+ mpp->alias);
+ return 1;
+ }
+ vector_foreach_slot(mpp->pg, pgp, i) {
+ vector_foreach_slot(pgp->paths, pp, j) {
+
+ dev = strdup(pp->dev);
+ if (!dev) {
+ condlog(0, "%s: unable to allocate path name",
+ mpp->alias);
+ goto out;
+ }
+ if (!vector_alloc_slot(path_names)){
+ condlog(0, "%s: unable to allocate path name slot",
+ mpp->alias);
+ free(dev);
+ goto out;
+ }
+ vector_set_slot(path_names, dev);
+ }
+ }
+ vector_foreach_slot(path_names, dev, i) {
+ err = ev_remove_path(dev, vecs);
+ if (err) {
+ condlog(0, "%s: couldn't remove path '%s' : %s",
+ mpp->alias, dev, strerror(errno));
+ goto out;
+ }
+ err = ev_add_path(dev, vecs);
+ if (err)
+ condlog(0, "%s: couldn't add path '%s' : %s",
+ mpp->alias, dev, strerror(errno));
+ }
+out:
+ vector_foreach_slot(path_names, dev, i)
+ free(dev);
+ vector_free(path_names);
+ return err;
+}
+
+int resize_map(struct multipath *mpp, unsigned long long size,
+ struct vectors * vecs)
+{
+ mpp->size = size;
+ update_mpp_paths(mpp, vecs->pathvec);
+ setup_map(mpp);
+ mpp->action = ACT_RESIZE;
+ if (domap(mpp) <= 0) {
+ condlog(0, "%s: failed to resize map : %s", mpp->alias,
+ strerror(errno));
+ return 1;
+ }
+ return 0;
+}
+
+int
+cli_resize(void *v, char **reply, int *len, void *data)
+{
+ struct vectors * vecs = (struct vectors *)data;
+ char * mapname = get_keyparam(v, MAP);
+ struct multipath *mpp;
+ int minor;
+ unsigned long long size;
+ struct pathgroup *pgp;
+ struct path *pp;
+
+ condlog(2, "%s: resize map (operator)", mapname);
+ if (sscanf(mapname, "dm-%d", &minor) == 1)
+ mpp = find_mp_by_minor(vecs->mpvec, minor);
+ else
+ mpp = find_mp_by_alias(vecs->mpvec, mapname);
+
+ if (!mpp) {
+ condlog(0, "%s: invalid map name. cannot resize", mapname);
+ return 1;
+ }
+
+ pgp = VECTOR_SLOT(mpp->pg, 0);
+ pp = VECTOR_SLOT(pgp->paths, 0);
+ if (sysfs_get_size(pp->sysdev, &size)) {
+ condlog(0, "%s: couldn't get size for sysfs. cannot resize",
+ mapname);
+ return 1;
+ }
+ if (size == mpp->size) {
+ condlog(0, "%s: map is still the same size (%llu)", mapname,
+ mpp->size);
+ return 0;
+ }
+ condlog(3, "%s old size is %llu, new size is %llu", mapname, mpp->size,
+ size);
+ if (size > mpp->size) {
+ if (reload_paths(mpp, vecs) != 0) {
+ condlog(0, "%s: failed to reload paths", mapname);
+ return 1;
+ }
+ if (resize_map(mpp, size, vecs) != 0)
+ return 1;
+ }
+ else {
+ if (resize_map(mpp, size, vecs) != 0)
+ return 1;
+ if (reload_paths(mpp, vecs) != 0) {
+ condlog(0, "%s: failed to reload paths", mapname);
+ return 1;
+ }
+ }
+ dm_lib_release();
+ setup_multipath(vecs, mpp);
+ sync_map_state(mpp);
+
+ return 0;
+}
+
+int
cli_switch_group(void * v, char ** reply, int * len, void * data)
{
char * mapname = get_keyparam(v, MAP);
int groupnum = atoi(get_keyparam(v, GROUP));
-
- condlog(2, "%s: switch to path group #%i (operator)", mapname, groupnum);
+
+ condlog(2, "%s: switch to path group #%i (operator)",
+ mapname, groupnum);
return dm_switchgroup(mapname, groupnum);
}
@@ -376,7 +504,7 @@ int
cli_reconfigure(void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
-
+
condlog(2, "reconfigure (operator)");
return reconfigure(vecs);
@@ -387,18 +515,17 @@ cli_suspend(void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, MAP);
- int r = dm_simplecmd(DM_DEVICE_SUSPEND, param);
+ int r = dm_simplecmd(DM_DEVICE_SUSPEND, param, 1);
+ struct multipath * mpp = find_mp_by_alias(vecs->mpvec, param);
condlog(2, "%s: suspend (operator)", param);
if (!r) /* error */
return 1;
-
- struct multipath * mpp = find_mp_by_alias(vecs->mpvec, param);
if (!mpp)
return 1;
-
+
dm_get_info(param, &mpp->dmi);
return 0;
}
@@ -408,18 +535,17 @@ cli_resume(void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, MAP);
- int r = dm_simplecmd(DM_DEVICE_RESUME, param);
+ int r = dm_simplecmd(DM_DEVICE_RESUME, param, 1);
+ struct multipath * mpp = find_mp_by_alias(vecs->mpvec, param);
condlog(2, "%s: resume (operator)", param);
if (!r) /* error */
return 1;
-
- struct multipath * mpp = find_mp_by_alias(vecs->mpvec, param);
if (!mpp)
return 1;
-
+
dm_get_info(param, &mpp->dmi);
return 0;
}
@@ -430,7 +556,7 @@ cli_reinstate(void * v, char ** reply, int * len, void * data)
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, PATH);
struct path * pp;
-
+
pp = find_path_by_dev(vecs->pathvec, param);
if (!pp)
@@ -453,7 +579,7 @@ cli_fail(void * v, char ** reply, int * len, void * data)
char * param = get_keyparam(v, PATH);
struct path * pp;
int r;
-
+
pp = find_path_by_dev(vecs->pathvec, param);
if (!pp)
@@ -477,67 +603,67 @@ cli_fail(void * v, char ** reply, int * len, void * data)
int
show_blacklist (char ** r, int * len)
{
- char *c = NULL;
- char *reply = NULL;
- unsigned int maxlen = INITIAL_REPLY_LEN;
- int again = 1;
+ char *c = NULL;
+ char *reply = NULL;
+ unsigned int maxlen = INITIAL_REPLY_LEN;
+ int again = 1;
- while (again) {
+ while (again) {
reply = MALLOC(maxlen);
if (!reply)
return 1;
- c = reply;
- c += snprint_blacklist_report(c, maxlen);
- again = ((c - reply) == maxlen);
- if (again) {
+ c = reply;
+ c += snprint_blacklist_report(c, maxlen);
+ again = ((c - reply) == maxlen);
+ if (again) {
maxlen *= 2;
FREE(reply);
- continue;
- }
- }
+ continue;
+ }
+ }
- *r = reply;
- *len = (int)(c - reply + 1);
+ *r = reply;
+ *len = (int)(c - reply + 1);
- return 0;
+ return 0;
}
int
cli_list_blacklist (void * v, char ** reply, int * len, void * data)
{
- condlog(3, "list blacklist (operator)");
+ condlog(3, "list blacklist (operator)");
- return show_blacklist(reply, len);
+ return show_blacklist(reply, len);
}
int
show_devices (char ** r, int * len, struct vectors *vecs)
{
- char *c = NULL;
- char *reply = NULL;
- unsigned int maxlen = INITIAL_REPLY_LEN;
- int again = 1;
-
- while (again) {
- reply = MALLOC(maxlen);
- if (!reply)
- return 1;
-
- c = reply;
- c += snprint_devices(c, maxlen, vecs);
- again = ((c - reply) == maxlen);
- if (again) {
- maxlen *= 2;
- FREE(reply);
- continue;
- }
- }
-
- *r = reply;
- *len = (int)(c - reply + 1);
-
- return 0;
+ char *c = NULL;
+ char *reply = NULL;
+ unsigned int maxlen = INITIAL_REPLY_LEN;
+ int again = 1;
+
+ while (again) {
+ reply = MALLOC(maxlen);
+ if (!reply)
+ return 1;
+
+ c = reply;
+ c += snprint_devices(c, maxlen, vecs);
+ again = ((c - reply) == maxlen);
+ if (again) {
+ maxlen *= 2;
+ FREE(reply);
+ continue;
+ }
+ }
+
+ *r = reply;
+ *len = (int)(c - reply + 1);
+
+ return 0;
}
int
@@ -545,7 +671,7 @@ cli_list_devices (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
- condlog(3, "list devices (operator)");
+ condlog(3, "list devices (operator)");
- return show_devices(reply, len, vecs);
+ return show_devices(reply, len, vecs);
}
diff --git a/multipathd/cli_handlers.h b/multipathd/cli_handlers.h
index a688481..72ed54a 100644
--- a/multipathd/cli_handlers.h
+++ b/multipathd/cli_handlers.h
@@ -14,6 +14,7 @@ int cli_add_map (void * v, char ** reply, int * len, void * data);
int cli_del_map (void * v, char ** reply, int * len, void * data);
int cli_switch_group(void * v, char ** reply, int * len, void * data);
int cli_reconfigure(void * v, char ** reply, int * len, void * data);
+int cli_resize(void * v, char ** reply, int * len, void * data);
int cli_suspend(void * v, char ** reply, int * len, void * data);
int cli_resume(void * v, char ** reply, int * len, void * data);
int cli_reinstate(void * v, char ** reply, int * len, void * data);
diff --git a/multipathd/main.c b/multipathd/main.c
index 4fbac3b..b1e440a 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -147,7 +147,7 @@ coalesce_maps(struct vectors *vecs, vector nmpv)
return 0;
}
-static void
+void
sync_map_state(struct multipath *mpp)
{
struct pathgroup *pgp;
@@ -709,6 +709,7 @@ uxlsnrloop (void * ap)
set_handler_callback(RECONFIGURE, cli_reconfigure);
set_handler_callback(SUSPEND+MAP, cli_suspend);
set_handler_callback(RESUME+MAP, cli_resume);
+ set_handler_callback(RESIZE+MAP, cli_resize);
set_handler_callback(REINSTATE+PATH, cli_reinstate);
set_handler_callback(FAIL+PATH, cli_fail);
diff --git a/multipathd/main.h b/multipathd/main.h
index 1a6dc55..d73cd70 100644
--- a/multipathd/main.h
+++ b/multipathd/main.h
@@ -9,5 +9,6 @@ int ev_add_path (char *, struct vectors *);
int ev_remove_path (char *, struct vectors *);
int ev_add_map (struct sysfs_device *, struct vectors *);
int ev_remove_map (char *, struct vectors *);
+void sync_map_state (struct multipath *);
#endif /* MAIN_H */

View File

@ -1,143 +0,0 @@
From e3354354518377b34fa3b501c11a62b61a54b0d4 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 13 Jan 2009 15:34:55 +0100
Subject: [PATCH] Implement sysfs_attr_set_value()
Complement to sysfs_attr_get_value(). We might want to modify some
sysfs values from multipathing.
References: bnc#464155
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/sysfs.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++
libmultipath/sysfs.h | 2 +
2 files changed, 102 insertions(+), 0 deletions(-)
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index e00a101..4a472ae 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -461,6 +461,106 @@ out:
return attr && attr->value && strlen(attr->value) ? attr->value : NULL;
}
+int sysfs_attr_set_value(const char *devpath, const char *attr_name,
+ char *value, int value_len)
+{
+ char path_full[PATH_SIZE];
+ const char *path;
+ struct sysfs_attr *attr_loop;
+ struct sysfs_attr *attr = NULL;
+ struct stat statbuf;
+ int fd;
+ ssize_t size = 0;
+ size_t sysfs_len;
+
+ dbg("open '%s'/'%s'", devpath, attr_name);
+ sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full));
+ if(sysfs_len >= sizeof(path_full))
+ sysfs_len = sizeof(path_full) - 1;
+ path = &path_full[sysfs_len];
+ strlcat(path_full, devpath, sizeof(path_full));
+ strlcat(path_full, "/", sizeof(path_full));
+ strlcat(path_full, attr_name, sizeof(path_full));
+
+ /* look for attribute in cache */
+ list_for_each_entry(attr_loop, &attr_list, node) {
+ if (strcmp(attr_loop->path, path) == 0) {
+ dbg("found in cache '%s'", attr_loop->path);
+ attr = attr_loop;
+ }
+ }
+ if (!attr) {
+ /* store attribute in cache */
+ dbg("new uncached attribute '%s'", path_full);
+ attr = malloc(sizeof(struct sysfs_attr));
+ if (attr == NULL)
+ return -1;
+ memset(attr, 0x00, sizeof(struct sysfs_attr));
+ strlcpy(attr->path, path, sizeof(attr->path));
+ dbg("add to cache '%s'", path_full);
+ list_add(&attr->node, &attr_list);
+ } else {
+ /* clear old value */
+ if(attr->value)
+ memset(attr->value, 0x00, sizeof(attr->value));
+ }
+
+ if (lstat(path_full, &statbuf) != 0) {
+ dbg("stat '%s' failed: %s", path_full, strerror(errno));
+ goto out;
+ }
+
+ if (S_ISLNK(statbuf.st_mode)) {
+ /* links return the last element of the target path */
+ char link_target[PATH_SIZE];
+ int len;
+ const char *pos;
+
+ len = readlink(path_full, link_target, sizeof(link_target));
+ if (len > 0) {
+ link_target[len] = '\0';
+ pos = strrchr(link_target, '/');
+ if (pos != NULL) {
+ dbg("cache '%s' with link value '%s'",
+ path_full, value);
+ strlcpy(attr->value_local, &pos[1],
+ sizeof(attr->value_local));
+ attr->value = attr->value_local;
+ }
+ }
+ goto out;
+ }
+
+ /* skip directories */
+ if (S_ISDIR(statbuf.st_mode))
+ goto out;
+
+ /* skip non-readable files */
+ if ((statbuf.st_mode & S_IRUSR) == 0)
+ goto out;
+
+ /* write attribute value */
+ fd = open(path_full, O_WRONLY);
+ if (fd < 0) {
+ dbg("attribute '%s' can not be opened: %s",
+ path_full, strerror(errno));
+ goto out;
+ }
+ size = write(fd, value, value_len);
+ close(fd);
+ if (size < 0)
+ goto out;
+
+ /* successfully wrote new value, store it */
+ remove_trailing_chars(value, '\n');
+ dbg("cache '%s' with attribute value '%s'", path_full, value);
+ strlcpy(attr->value_local, value, sizeof(attr->value_local));
+ attr->value = attr->value_local;
+
+out:
+ return size;
+}
+
int sysfs_lookup_devpath_by_subsys_id(char *devpath_full, size_t len,
const char *subsystem, const char *id)
{
diff --git a/libmultipath/sysfs.h b/libmultipath/sysfs.h
index 620962c..ac76acf 100644
--- a/libmultipath/sysfs.h
+++ b/libmultipath/sysfs.h
@@ -20,6 +20,8 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev);
struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem);
void sysfs_device_put(struct sysfs_device *dev);
char *sysfs_attr_get_value(const char *devpath, const char *attr_name);
+int sysfs_attr_set_value(const char *devpath, const char *attr_name,
+ char *value, int value_len);
int sysfs_resolve_link(char *path, size_t size);
int sysfs_get_size (struct sysfs_device * dev, unsigned long long * size);
--
1.5.3.2

View File

@ -1,26 +0,0 @@
Subject: Add device-handler modules to mkinitrd script
From: Hannes Reinecke <hare@suse.de>
Date: Mon Oct 27 14:39:59 2008 +0100:
Git: 9ac06d484adb369c1848f5793cf36ab681899ef7
The mkinitrd boot script still tries to include the obsolete
device-mapper hardware handler modules. Update it to include
the SCSI device-handler modules.
References: 431877
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/multipath/boot-multipath.sh b/multipath/boot-multipath.sh
index a946785..ae11a26 100755
--- a/multipath/boot-multipath.sh
+++ b/multipath/boot-multipath.sh
@@ -4,7 +4,7 @@
#%provides: dmroot
#%programs: /sbin/multipath /lib/multipath/*
#%if: "$root_mpath"
-#%modules: dm-multipath dm-round-robin dm-emc dm-hp_sw dm-rdac
+#%modules: dm-multipath dm-round-robin scsi-dh-emc scsi-dh-hp_sw scsi-dh-rdac scsi-dh-alua
#
##### Multipath
##

View File

@ -1,27 +0,0 @@
From 669b5c11d8c82252f9697e35d183a0c840386261 Mon Sep 17 00:00:00 2001
From: Dave Wysochanski <dwysocha@redhat.com>
Date: Sun, 28 Sep 2008 22:32:29 +0200
Subject: [PATCH] [lib] Increase bindings file lock timeout to avoid failure of user_friendly_names
On setups with a large number of paths / multipath maps, contention for
the advisory lock on the bindings file may take longer than 3 seconds,
and some multipath processes may create maps based on WWID despite having
user_friendly_names set. Increasing the timeout is a simple fix that
gets us a bit further.
---
libmultipath/alias.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libmultipath/alias.h b/libmultipath/alias.h
index 3d64b9b..fe1191b 100644
--- a/libmultipath/alias.h
+++ b/libmultipath/alias.h
@@ -1,4 +1,4 @@
-#define BINDINGS_FILE_TIMEOUT 3
+#define BINDINGS_FILE_TIMEOUT 30
#define BINDINGS_FILE_HEADER \
"# Multipath bindings, Version : 1.0\n" \
"# NOTE: this file is automatically maintained by the multipath program.\n" \
--
1.5.2.4

View File

@ -1,31 +0,0 @@
From 18903014d3e6402909e709fedaf669d2a55c1490 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 21 Oct 2008 10:22:16 +0200
Subject: [PATCH] Increase buffer size in find_loop_by_file()
find_loop_by_file() uses an internal buffer of 20 chars, which is compared
to a buffer of the size of 64 chars. Not good.
References: 436428
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
kpartx/lopart.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kpartx/lopart.c b/kpartx/lopart.c
index b18d6fa..be483da 100644
--- a/kpartx/lopart.c
+++ b/kpartx/lopart.c
@@ -105,7 +105,7 @@ is_loop_device (const char *device)
extern char *
find_loop_by_file (const char * filename)
{
- char dev[20];
+ char dev[64];
char *loop_formats[] = { "/dev/loop%d", "/dev/loop/%d" };
int i, j, fd;
struct stat statbuf;
--
1.5.2.4

View File

@ -1,56 +0,0 @@
From 67f0f96ae532f8fda862576fba6f718809ade128 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 14 Oct 2008 08:38:29 +0200
Subject: [PATCH] kpartx -l does not remove it's loop device
When doing a kpartx -l it does not remove it's loop device when done.
The appended patch to multipath-tools could fix this.
References: 417266
Signed-off-by: Philipp Zimmer <pzimmer@novell.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
kpartx/kpartx.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
index d1ba87c..43dcd13 100644
--- a/kpartx/kpartx.c
+++ b/kpartx/kpartx.c
@@ -198,6 +198,7 @@ main(int argc, char **argv){
char *mapname = NULL;
int loopro = 0;
int hotplug = 0;
+ int loopcreated = 0;
struct stat buf;
initpts();
@@ -292,6 +293,7 @@ main(int argc, char **argv){
fprintf(stderr, "can't set up loop\n");
exit (1);
}
+ loopcreated = 1;
}
device = loopdev;
}
@@ -394,6 +396,15 @@ main(int argc, char **argv){
break;
}
+ if (loopcreated && S_ISREG (buf.st_mode)) {
+ if (del_loop(device)) {
+ if (verbose)
+ printf("can't del loop : %s\n",
+ device);
+ exit(1);
+ }
+ printf("loop deleted : %s\n", device);
+ }
break;
case DELETE:
--
1.5.2.4

View File

@ -1,74 +0,0 @@
From 2fb0035d2322771bd9753e26a2a1c5babbfc2abc Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 30 Oct 2008 16:49:50 +0100
Subject: [PATCH] Link directio checker against libaio
The directio checker has to link against libaio explicitely,
otherwise any versioning information is lost.
References: 433659
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/checkers/Makefile | 3 +++
libmultipath/checkers/directio.c | 2 +-
multipath/Makefile | 2 +-
multipathd/Makefile | 2 +-
4 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile
index a20dfac..99b3dc2 100644
--- a/libmultipath/checkers/Makefile
+++ b/libmultipath/checkers/Makefile
@@ -17,6 +17,9 @@ CFLAGS += -I..
all: $(LIBS)
+libcheckdirectio.so: directio.o
+ $(CC) $(SHARED_FLAGS) -o $@ $^ -laio
+
libcheck%.so: libsg.o %.o
$(CC) $(SHARED_FLAGS) -o $@ $^
diff --git a/libmultipath/checkers/directio.c b/libmultipath/checkers/directio.c
index 5c92dac..c701609 100644
--- a/libmultipath/checkers/directio.c
+++ b/libmultipath/checkers/directio.c
@@ -13,7 +13,7 @@
#include <linux/fs.h>
#include <errno.h>
#include <linux/kdev_t.h>
-#include <asm/unistd.h>
+#include <unistd.h>
#include <libaio.h>
#include "checkers.h"
diff --git a/multipath/Makefile b/multipath/Makefile
index 75d4ddf..a02107b 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -7,7 +7,7 @@ include ../Makefile.inc
OBJS = main.o
CFLAGS += -I$(multipathdir) -Wl,-rpath,$(libdir)
-LDFLAGS += -lpthread -ldevmapper -laio -ldl \
+LDFLAGS += -lpthread -ldevmapper -ldl \
-lmultipath -L$(multipathdir)
EXEC = multipath
diff --git a/multipathd/Makefile b/multipathd/Makefile
index b019959..565210f 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -6,7 +6,7 @@ include ../Makefile.inc
# basic flags setting
#
CFLAGS += -I$(multipathdir) -Wl,-rpath,$(libdir)
-LDFLAGS += -lpthread -ldevmapper -lreadline -lncurses -laio -ldl \
+LDFLAGS += -lpthread -ldevmapper -lreadline -lncurses -ldl \
-lmultipath -L$(multipathdir)
#
--
1.5.4.5

View File

@ -1,526 +0,0 @@
From 28b790ea42f100c74f682f1abea6c33e7d0e3553 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 20 Nov 2008 12:36:24 +0100
Subject: [PATCH] Make 'params' and 'status' local variables
The 'params' and 'status' fields in the multipath structure are
just scratch variables where the output from device-mapper is stored
into. And as we call device-mapper quite frequently it really looks
not thread-safe as the multipath structure can be accessed from
all threads. So better make them local variables to eliminate this
problem.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/configure.c | 30 ++++++++++++++++--------------
libmultipath/configure.h | 4 ++--
libmultipath/devmapper.c | 12 +++++++-----
libmultipath/dmparser.c | 19 +++++++++++--------
libmultipath/dmparser.h | 2 +-
libmultipath/print.c | 6 +++---
libmultipath/print.h | 2 +-
libmultipath/structs.h | 2 --
libmultipath/structs_vec.c | 20 ++++++++++++++++----
libmultipath/waiter.c | 1 +
multipath/main.c | 13 +++++++++----
multipathd/cli_handlers.c | 6 ++++--
multipathd/main.c | 15 +++++++++++----
13 files changed, 82 insertions(+), 50 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 494ea70..eb7ac03 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -37,7 +37,7 @@
#include "util.h"
extern int
-setup_map (struct multipath * mpp)
+setup_map (struct multipath * mpp, char * params, int params_size)
{
struct pathgroup * pgp;
int i;
@@ -89,7 +89,7 @@ setup_map (struct multipath * mpp)
* transform the mp->pg vector of vectors of paths
* into a mp->params strings to feed the device-mapper
*/
- if (assemble_map(mpp)) {
+ if (assemble_map(mpp, params, params_size)) {
condlog(0, "%s: problem assembing map", mpp->alias);
return 1;
}
@@ -298,7 +298,7 @@ lock_multipath (struct multipath * mpp, int lock)
#define DOMAP_DRY 3
extern int
-domap (struct multipath * mpp)
+domap (struct multipath * mpp, char * params)
{
int r = 0;
@@ -337,25 +337,25 @@ domap (struct multipath * mpp)
break;
}
- r = dm_addmap_create(mpp->alias, mpp->params, mpp->size,
+ r = dm_addmap_create(mpp->alias, params, mpp->size,
mpp->wwid);
if (!r)
- r = dm_addmap_create_ro(mpp->alias, mpp->params,
+ r = dm_addmap_create_ro(mpp->alias, params,
mpp->size, mpp->wwid);
lock_multipath(mpp, 0);
break;
case ACT_RELOAD:
- r = (dm_addmap_reload(mpp->alias, mpp->params, mpp->size, NULL)
+ r = (dm_addmap_reload(mpp->alias, params, mpp->size, NULL)
&& dm_simplecmd(DM_DEVICE_RESUME, mpp->alias, 1));
break;
case ACT_RESIZE:
- r = dm_addmap_reload(mpp->alias, mpp->params, mpp->size, NULL);
+ r = dm_addmap_reload(mpp->alias, params, mpp->size, NULL);
if (!r)
- r = dm_addmap_reload_ro(mpp->alias, mpp->params,
+ r = dm_addmap_reload_ro(mpp->alias, params,
mpp->size, NULL);
if (r)
r = dm_simplecmd(DM_DEVICE_RESUME, mpp->alias, 0);
@@ -383,7 +383,7 @@ domap (struct multipath * mpp)
/* multipath daemon mode */
mpp->stat_map_loads++;
condlog(2, "%s: load table [0 %llu %s %s]", mpp->alias,
- mpp->size, TGT_MPATH, mpp->params);
+ mpp->size, TGT_MPATH, params);
/*
* Required action is over, reset for the stateful daemon
*/
@@ -422,6 +422,7 @@ coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, int force_r
int r = 1;
int k, i;
char empty_buff[WWID_SIZE];
+ char params[PARAMS_SIZE];
struct multipath * mpp;
struct path * pp1;
struct path * pp2;
@@ -493,8 +494,9 @@ coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, int force_r
mpp->action = ACT_REJECT;
}
verify_paths(mpp, vecs, NULL);
-
- if (setup_map(mpp)) {
+
+ params[0] = '\0';
+ if (setup_map(mpp, params, PARAMS_SIZE)) {
remove_map(mpp, vecs, 0);
continue;
}
@@ -502,7 +504,7 @@ coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, int force_r
if (mpp->action == ACT_UNDEF)
select_action(mpp, curmp, force_reload);
- r = domap(mpp);
+ r = domap(mpp, params);
if (r == DOMAP_FAIL || r == DOMAP_RETRY) {
condlog(3, "%s: domap (%u) failure "
@@ -610,7 +612,7 @@ get_refwwid (char * dev, enum devtypes dev_type, vector pathvec)
if (dev_type == DEV_DEVT) {
pp = find_path_by_devt(pathvec, dev);
-
+
if (!pp) {
if (devt2devname(buff, dev))
return NULL;
@@ -624,7 +626,7 @@ get_refwwid (char * dev, enum devtypes dev_type, vector pathvec)
if (pathinfo(pp, conf->hwtable, DI_SYSFS | DI_WWID))
return NULL;
-
+
if (store_path(pathvec, pp)) {
free_path(pp);
return NULL;
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
index 25891ba..ec2800d 100644
--- a/libmultipath/configure.h
+++ b/libmultipath/configure.h
@@ -23,8 +23,8 @@ enum actions {
#define FLUSH_ONE 1
#define FLUSH_ALL 2
-int setup_map (struct multipath * mpp);
-int domap (struct multipath * mpp);
+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);
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index cde98eb..a7ab41f 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -206,6 +206,8 @@ dm_addmap (int task, const char *name, const char *target,
goto freeout;
}
+ condlog(4, "%s: addmap [0 %llu %s %s]\n", name, size, target, params);
+
dm_task_no_open_count(dmt);
r = dm_task_run (dmt);
@@ -323,7 +325,10 @@ dm_get_map(char * name, unsigned long long * size, char * outparams)
if (size)
*size = length;
- if (snprintf(outparams, PARAMS_SIZE, "%s", params) <= PARAMS_SIZE)
+ if (outparams) {
+ if (snprintf(outparams, PARAMS_SIZE, "%s", params) <= PARAMS_SIZE)
+ r = 0;
+ } else
r = 0;
out:
dm_task_destroy(dmt);
@@ -756,10 +761,7 @@ dm_get_maps (vector mp)
goto out1;
if (info > 0) {
- if (dm_get_map(names->name, &mpp->size, mpp->params))
- goto out1;
-
- if (dm_get_status(names->name, mpp->status))
+ if (dm_get_map(names->name, &mpp->size, NULL))
goto out1;
dm_get_uuid(names->name, mpp->wwid);
diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
index d1face5..9441b11 100644
--- a/libmultipath/dmparser.c
+++ b/libmultipath/dmparser.c
@@ -47,7 +47,7 @@ merge_words (char ** dst, char * word, int space)
* Transforms the path group vector into a proper device map string
*/
int
-assemble_map (struct multipath * mp)
+assemble_map (struct multipath * mp, char * params, int len)
{
int i, j;
int shift, freechar;
@@ -57,15 +57,15 @@ assemble_map (struct multipath * mp)
struct path * pp;
minio = mp->minio;
- p = mp->params;
- freechar = sizeof(mp->params);
+ p = params;
+ freechar = len;
shift = snprintf(p, freechar, "%s %s %i %i",
mp->features, mp->hwhandler,
VECTOR_SIZE(mp->pg), mp->bestpg);
if (shift >= freechar) {
- fprintf(stderr, "mp->params too small\n");
+ condlog(0, "%s: params too small\n", mp->alias);
return 1;
}
p += shift;
@@ -76,7 +76,7 @@ assemble_map (struct multipath * mp)
shift = snprintf(p, freechar, " %s %i 1", mp->selector,
VECTOR_SIZE(pgp->paths));
if (shift >= freechar) {
- fprintf(stderr, "mp->params too small\n");
+ condlog(0, "%s: params too small\n", mp->alias);
return 1;
}
p += shift;
@@ -88,11 +88,14 @@ assemble_map (struct multipath * mp)
if (mp->rr_weight == RR_WEIGHT_PRIO
&& pp->priority > 0)
tmp_minio = minio * pp->priority;
-
+ if (!strlen(pp->dev_t) ) {
+ condlog(0, "dev_t not set for '%s'\n", pp->dev);
+ return 1;
+ }
shift = snprintf(p, freechar, " %s %d",
pp->dev_t, tmp_minio);
if (shift >= freechar) {
- fprintf(stderr, "mp->params too small\n");
+ condlog(0, "%s: params too small\n", mp->alias);
return 1;
}
p += shift;
@@ -100,7 +103,7 @@ assemble_map (struct multipath * mp)
}
}
if (freechar < 1) {
- fprintf(stderr, "mp->params too small\n");
+ condlog(0, "%s: params too small\n", mp->alias);
return 1;
}
snprintf(p, 1, "\n");
diff --git a/libmultipath/dmparser.h b/libmultipath/dmparser.h
index bf4b2c3..1b45df0 100644
--- a/libmultipath/dmparser.h
+++ b/libmultipath/dmparser.h
@@ -1,3 +1,3 @@
-int assemble_map (struct multipath *);
+int assemble_map (struct multipath *, char *, int);
int disassemble_map (vector, char *, struct multipath *);
int disassemble_status (char *, struct multipath *);
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 7467411..9dea392 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -1276,11 +1276,11 @@ print_pathgroup (struct pathgroup * pgp, char * style)
}
extern void
-print_map (struct multipath * mpp)
+print_map (struct multipath * mpp, char * params)
{
- if (mpp->size && mpp->params)
+ if (mpp->size && params)
printf("0 %llu %s %s\n",
- mpp->size, TGT_MPATH, mpp->params);
+ mpp->size, TGT_MPATH, params);
return;
}
diff --git a/libmultipath/print.h b/libmultipath/print.h
index a8be408..5fe826b 100644
--- a/libmultipath/print.h
+++ b/libmultipath/print.h
@@ -54,7 +54,7 @@ void print_multipath_topology (struct multipath * mpp, int verbosity);
void print_path (struct path * pp, char * style);
void print_multipath (struct multipath * mpp, char * style);
void print_pathgroup (struct pathgroup * pgp, char * style);
-void print_map (struct multipath * mpp);
+void print_map (struct multipath * mpp, char * params);
void print_all_paths (vector pathvec, int banner);
void print_all_paths_custo (vector pathvec, int banner, char *fmt);
void print_hwtable (vector hwtable);
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 85d5109..658d6b2 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -151,8 +151,6 @@ struct multipath {
unsigned long long size;
vector paths;
vector pg;
- char params[PARAMS_SIZE];
- char status[PARAMS_SIZE];
struct dm_info * dmi;
/* configlet pointers */
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 17cafd1..e3cace9 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -237,14 +237,20 @@ extract_hwe_from_path(struct multipath * mpp)
static int
update_multipath_table (struct multipath *mpp, vector pathvec)
{
+ char params[PARAMS_SIZE] = {0};
+
if (!mpp)
return 1;
- if (dm_get_map(mpp->alias, &mpp->size, mpp->params))
+ if (dm_get_map(mpp->alias, &mpp->size, params)) {
+ condlog(3, "%s: cannot get map", mpp->alias);
return 1;
+ }
- if (disassemble_map(pathvec, mpp->params, mpp))
+ if (disassemble_map(pathvec, params, mpp)) {
+ condlog(3, "%s: cannot disassemble map", mpp->alias);
return 1;
+ }
return 0;
}
@@ -252,14 +258,20 @@ update_multipath_table (struct multipath *mpp, vector pathvec)
static int
update_multipath_status (struct multipath *mpp)
{
+ char status[PARAMS_SIZE] = {0};
+
if (!mpp)
return 1;
- if(dm_get_status(mpp->alias, mpp->status))
+ if (dm_get_status(mpp->alias, status)) {
+ condlog(3, "%s: cannot get status", mpp->alias);
return 1;
+ }
- if (disassemble_status(mpp->status, mpp))
+ if (disassemble_status(status, mpp)) {
+ condlog(3, "%s: cannot disassemble status", mpp->alias);
return 1;
+ }
return 0;
}
diff --git a/libmultipath/waiter.c b/libmultipath/waiter.c
index 54cd19f..530180f 100644
--- a/libmultipath/waiter.c
+++ b/libmultipath/waiter.c
@@ -26,6 +26,7 @@ struct event_thread *alloc_waiter (void)
struct event_thread *wp;
wp = (struct event_thread *)MALLOC(sizeof(struct event_thread));
+ memset(wp, 0, sizeof(struct event_thread));
return wp;
}
diff --git a/multipath/main.c b/multipath/main.c
index 60244a5..ffa6eb5 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -158,6 +158,7 @@ get_dm_mpvec (vector curmp, vector pathvec, char * refwwid)
{
int i;
struct multipath * mpp;
+ char params[PARAMS_SIZE], status[PARAMS_SIZE];
if (dm_get_maps(curmp))
return 1;
@@ -175,10 +176,12 @@ get_dm_mpvec (vector curmp, vector pathvec, char * refwwid)
continue;
}
- condlog(3, "params = %s", mpp->params);
- condlog(3, "status = %s", mpp->status);
+ dm_get_map(mpp->alias, &mpp->size, params);
+ condlog(3, "params = %s", params);
+ dm_get_status(mpp->alias, status);
+ condlog(3, "status = %s", status);
- disassemble_map(pathvec, mpp->params, mpp);
+ disassemble_map(pathvec, params, mpp);
/*
* disassemble_map() can add new paths to pathvec.
@@ -191,7 +194,7 @@ get_dm_mpvec (vector curmp, vector pathvec, char * refwwid)
if (conf->list > 1)
mpp->bestpg = select_path_group(mpp);
- disassemble_status(mpp->status, mpp);
+ disassemble_status(status, mpp);
if (conf->list)
print_multipath_topology(mpp, conf->verbosity);
@@ -495,6 +498,8 @@ out:
sysfs_cleanup();
dm_lib_release();
dm_lib_exit();
+ cleanup_prio();
+ cleanup_checkers();
/*
* Freeing config must be done after dm_lib_exit(), because
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index f9b0da4..4f639b6 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -463,11 +463,13 @@ out:
int resize_map(struct multipath *mpp, unsigned long long size,
struct vectors * vecs)
{
+ char params[PARAMS_SIZE] = {0};
+
mpp->size = size;
update_mpp_paths(mpp, vecs->pathvec);
- setup_map(mpp);
+ setup_map(mpp, params, PARAMS_SIZE);
mpp->action = ACT_RESIZE;
- if (domap(mpp) <= 0) {
+ if (domap(mpp, params) <= 0) {
condlog(0, "%s: failed to resize map : %s", mpp->alias,
strerror(errno));
return 1;
diff --git a/multipathd/main.c b/multipathd/main.c
index bb396ec..444494e 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -158,6 +158,8 @@ sync_map_state(struct multipath *mpp)
if (!mpp->pg)
return;
+ condlog(5, "%s: sync map state", mpp->alias);
+
vector_foreach_slot (mpp->pg, pgp, i){
vector_foreach_slot (pgp->paths, pp, j){
if (pp->state == PATH_UNCHECKED ||
@@ -355,6 +357,7 @@ ev_add_path (char * devname, struct vectors * vecs)
struct multipath * mpp;
struct path * pp;
char empty_buff[WWID_SIZE] = {0};
+ char params[PARAMS_SIZE] = {0};
pp = find_path_by_dev(vecs->pathvec, devname);
@@ -409,7 +412,7 @@ rescan:
/*
* push the map to the device-mapper
*/
- if (setup_map(mpp)) {
+ if (setup_map(mpp, params, PARAMS_SIZE)) {
condlog(0, "%s: failed to setup map for addition of new "
"path %s", mpp->alias, devname);
goto out;
@@ -417,7 +420,7 @@ rescan:
/*
* reload the map for the multipath mapped device
*/
- if (domap(mpp) <= 0) {
+ if (domap(mpp, params) <= 0) {
condlog(0, "%s: failed in domap for addition of new "
"path %s", mpp->alias, devname);
/*
@@ -480,6 +483,7 @@ ev_remove_path (char * devname, struct vectors * vecs)
struct multipath * mpp;
struct path * pp;
int i, retval = 0;
+ char params[PARAMS_SIZE] = {0};
pp = find_path_by_dev(vecs->pathvec, devname);
@@ -526,7 +530,7 @@ ev_remove_path (char * devname, struct vectors * vecs)
*/
}
- if (setup_map(mpp)) {
+ if (setup_map(mpp, params, PARAMS_SIZE)) {
condlog(0, "%s: failed to setup map for"
" removal of path %s", mpp->alias,
devname);
@@ -536,7 +540,7 @@ ev_remove_path (char * devname, struct vectors * vecs)
* reload the map
*/
mpp->action = ACT_RELOAD;
- if (domap(mpp) <= 0) {
+ if (domap(mpp, params) <= 0) {
condlog(0, "%s: failed in domap for "
"removal of path %s",
mpp->alias, devname);
@@ -1395,6 +1399,9 @@ child (void * param)
cleanup_checkers();
cleanup_prio();
+ cleanup_checkers();
+ cleanup_prio();
+
condlog(2, "--------shut down-------");
if (logsink)
--
1.5.3.2

View File

@ -1,51 +0,0 @@
From 375c38b4f4aa88fddd6106e4f2722e120fc1dac4 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 15 Oct 2008 13:44:00 +0200
Subject: [PATCH] Missing fixes for libprio ontap.c
The ontap.c libprio source file available on SLES10 SP2 has a few
deviations from the corresponding pp_ontap.c source file in the
path_priority directory.
References: 426975
Signed-off-by: Martin George <marting@netapp.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/prioritizers/ontap.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libmultipath/prioritizers/ontap.c b/libmultipath/prioritizers/ontap.c
index 0a629bc..1200114 100644
--- a/libmultipath/prioritizers/ontap.c
+++ b/libmultipath/prioritizers/ontap.c
@@ -27,7 +27,7 @@
#define INQUIRY_CMDLEN 6
#define DEFAULT_PRIOVAL 10
#define RESULTS_MAX 256
-#define SG_TIMEOUT 30000
+#define SG_TIMEOUT 60000
#define pp_ontap_log(prio, fmt, args...) \
condlog(prio, "%s: ontap prio: " fmt, dev, ##args)
@@ -194,7 +194,7 @@ static int ontap_prio(const char *dev, int fd)
memset(&results, 0, sizeof (results));
rc = send_gva(dev, fd, 0x41, results, &results_size);
- if (rc == 0) {
+ if (rc >= 0) {
tot_len = results[0] << 24 | results[1] << 16 |
results[2] << 8 | results[3];
if (tot_len <= 8) {
@@ -214,6 +214,8 @@ static int ontap_prio(const char *dev, int fd)
is_iscsi_hardware = 1;
goto prio_select;
}
+ } else {
+ return 0;
}
try_fcp_proxy:
--
1.5.2.4

View File

@ -1,85 +0,0 @@
commit d3f2f760250ff40f31ea5ddab7d45c86ba32bab6
Author: Hannes Reinecke <hare@suse.de>
Date: Wed Jan 7 11:05:45 2009 +0100
Add more debugging output
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index c4a53ab..868dcc7 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -689,11 +689,15 @@ get_state (struct path * pp)
if (!checker_selected(c)) {
select_checker(pp);
- if (!checker_selected(c))
+ if (!checker_selected(c)) {
+ condlog(3, "%s: No checker selected", pp->dev);
return 1;
+ }
checker_set_fd(c, pp->fd);
- if (checker_init(c, pp->mpp?&pp->mpp->mpcontext:NULL))
+ if (checker_init(c, pp->mpp?&pp->mpp->mpcontext:NULL)) {
+ condlog(3, "%s: checker init failed", pp->dev);
return 1;
+ }
}
pp->state = checker_check(c);
condlog(3, "%s: state = %i", pp->dev, pp->state);
@@ -711,8 +715,10 @@ get_prio (struct path * pp)
if (!pp->prio) {
select_prio(pp);
- if (!pp->prio)
+ if (!pp->prio) {
+ condlog(3, "%s: no prio selected", pp->dev);
return 1;
+ }
}
pp->priority = prio_getprio(pp->prio, pp);
if (pp->priority < 0) {
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 3770566..a1d9632 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -282,6 +282,7 @@ update_multipath_status (struct multipath *mpp)
extern int
update_multipath_strings (struct multipath *mpp, vector pathvec)
{
+ condlog(4, "%s: %s", mpp->alias, __FUNCTION__);
free_multipath_attributes(mpp);
free_pgvec(mpp->pg, KEEP_PATHS);
mpp->pg = NULL;
@@ -477,6 +478,9 @@ verify_paths(struct multipath * mpp, struct vectors * vecs, vector rpvec)
vector_del_slot(vecs->pathvec, j);
free_path(pp);
}
+ } else {
+ condlog(4, "%s: verified path %s dev_t %s",
+ mpp->alias, pp->dev, pp->dev_t);
}
}
return count;
diff --git a/multipathd/main.c b/multipathd/main.c
index c60d075..b39ba90 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -396,6 +396,8 @@ ev_add_path (char * devname, struct vectors * vecs)
mpp = pp->mpp = find_mp_by_wwid(vecs->mpvec, pp->wwid);
rescan:
if (mpp) {
+ condlog(4,"%s: adopting all paths for path %s",
+ mpp->alias, pp->dev);
if (adopt_paths(vecs->pathvec, mpp))
return 1; /* leave path added to pathvec */
@@ -403,6 +405,7 @@ rescan:
mpp->action = ACT_RELOAD;
}
else {
+ condlog(4,"%s: creating new map", pp->dev);
if ((mpp = add_map_with_path(vecs, pp, 1)))
mpp->action = ACT_CREATE;
else

View File

@ -1,43 +0,0 @@
commit 96f43ccaf6bf5288bfb94344e5c9a60ff5354083
Author: Hannes Reinecke <hare@suse.de>
Date: Fri Dec 19 09:39:52 2008 +0100
Print out maps in dmparser.c
For debugging it's quite helpful to have the actual maps as
being sent to device-mapper printed out.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
index 0cef666..33b5cde 100644
--- a/libmultipath/dmparser.c
+++ b/libmultipath/dmparser.c
@@ -107,6 +107,9 @@ assemble_map (struct multipath * mp, char * params, int len)
return 1;
}
snprintf(p, 1, "\n");
+
+ condlog(3, "%s: assembled map [%s]\n", mp->alias, params);
+
return 0;
}
@@ -128,6 +131,8 @@ disassemble_map (vector pathvec, char * params, struct multipath * mpp)
p = params;
+ condlog(3, "%s: disassemble map [%s]\n", mpp->alias, params);
+
/*
* features
*/
@@ -354,6 +359,8 @@ disassemble_status (char * params, struct multipath * mpp)
p = params;
+ condlog(3, "%s: disassemble status [%s]\n", mpp->alias, params);
+
/*
* features
*/

View File

@ -1,529 +0,0 @@
commit 86bc28e5702babadf73a1c4395870da370efa257
Author: Hannes Reinecke <hare@suse.de>
Date: Fri Nov 21 14:03:38 2008 +0100
Static Load balancing prioritizer
'Weighted path' is a new path prioritizer for device mapper
multipath, where specific paths and the corresponding priority
values can be provided as arguments.
This prioritizer assigns the priority value provided in the
configuration file based on the comparison made between the
specified paths and the path instance for which this is called.
Paths can be specified as a regular expression of devname
of the path or as hbtl information of the path.
Syntax:
weightedpath <hbtl|devname> <regex1> <prio1> <regex2> <prio2> ...
Examples:
prio "weightedpath hbtl 1:.:.:. 2 4:.:.:. 4" #All paths through SCSI 'H' as
'1' will take prio 2 and all paths with SCSI 'H' as 4 will take prio as 4.
prio "weightedpath devname sda$ 10 sde$ 20" #Path sda takes prio 10 and
path sde takes prio 20. can be provided in multipath section.
This prioritizer allows user to set static load balancing
for devices. Useful when user has prior knowledge of path
performance difference or unavailability of certain paths.
References: 441007
Signed-off-by: Vijayakumar Balasubramanian <vijaykumar@hp.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/config.c b/libmultipath/config.c
index 908156d..83da6e7 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -207,6 +207,12 @@ free_mpe (struct mpentry * mpe)
if (mpe->alias)
FREE(mpe->alias);
+ if (mpe->prio_name)
+ FREE(mpe->prio_name);
+
+ if (mpe->prio_arg)
+ FREE(mpe->prio_arg);
+
FREE(mpe);
}
@@ -291,6 +297,7 @@ merge_hwe (struct hwentry * hwe1, struct hwentry * hwe2)
merge_str(selector);
merge_str(checker_name);
merge_str(prio_name);
+ merge_str(prio_arg);
merge_str(bl_product);
merge_num(pgpolicy);
merge_num(pgfailback);
@@ -339,6 +346,9 @@ store_hwe (vector hwtable, struct hwentry * dhwe)
if (dhwe->prio_name && !(hwe->prio_name = set_param_str(dhwe->prio_name)))
goto out;
+ if (dhwe->prio_arg && !(hwe->prio_arg = set_param_str(dhwe->prio_arg)))
+ goto out;
+
hwe->pgpolicy = dhwe->pgpolicy;
hwe->pgfailback = dhwe->pgfailback;
hwe->rr_weight = dhwe->rr_weight;
@@ -559,8 +569,10 @@ load_config (char * file)
!conf->hwhandler || !conf->bindings_file)
goto out;
- if (!conf->prio_name)
+ if (!conf->prio_name) {
conf->prio_name = set_default(DEFAULT_PRIO);
+ conf->prio_arg = NULL;
+ }
if (!conf->checker_name)
conf->checker_name = set_default(DEFAULT_CHECKER);
diff --git a/libmultipath/config.h b/libmultipath/config.h
index fb917f4..fc0e22d 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -21,6 +21,7 @@ struct hwentry {
char * selector;
char * checker_name;
char * prio_name;
+ char * prio_arg;
int pgpolicy;
int pgfailback;
@@ -37,6 +38,8 @@ struct mpentry {
char * getuid;
char * selector;
+ char * prio_name;
+ char * prio_arg;
int pgpolicy;
int pgfailback;
int rr_weight;
@@ -75,6 +78,7 @@ struct config {
char * hwhandler;
char * bindings_file;
char * prio_name;
+ char * prio_arg;
char * checker_name;
vector keywords;
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 5794b11..9ba3961 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -4,6 +4,7 @@
* Copyright (c) 2005 Benjamin Marzinski, Redhat
* Copyright (c) 2005 Kiyoshi Ueda, NEC
*/
+#include <string.h>
#include "checkers.h"
#include "vector.h"
#include "hwtable.h"
@@ -106,11 +107,26 @@ def_getuid_callout_handler(vector strvec)
static int
def_prio_handler(vector strvec)
{
- conf->prio_name = set_value(strvec);
+ char *buff, *result, *temp;
+ char split_char[] = " \t";
- if (!conf->prio_name)
+ buff = set_value(strvec);
+ if (!buff)
return 1;
+ temp = buff;
+
+ while ((result = strsep(&temp, split_char))) {
+ if (prio_lookup(result)) {
+ conf->prio_name = STRDUP(result);
+ if (temp)
+ conf->prio_arg = STRDUP(temp);
+ else
+ conf->prio_arg = NULL;
+ break;
+ }
+ }
+ FREE(buff);
return 0;
}
@@ -613,15 +629,29 @@ static int
hw_prio_handler(vector strvec)
{
struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable);
+ char *buff, *result, *temp;
+ char split_char[] = " \t";
if (!hwe)
return 1;
- hwe->prio_name = set_value(strvec);
-
- if (!hwe->prio_name)
+ buff = set_value(strvec);
+ if (!buff)
return 1;
+ temp = buff;
+
+ while ((result = strsep(&temp, split_char))) {
+ if (prio_lookup(result)) {
+ conf->prio_name = STRDUP(result);
+ if (temp)
+ conf->prio_arg = STRDUP(temp);
+ else
+ conf->prio_arg = NULL;
+ break;
+ }
+ }
+ FREE(buff);
return 0;
}
@@ -967,6 +997,38 @@ mp_pg_timeout_handler(vector strvec)
return 0;
}
+static int
+mp_prio_handler (vector strvec)
+{
+ struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
+ char *buff, *result, *temp;
+ char split_char[] = " \t";
+
+ if (!mpe)
+ return 1;
+
+ buff = set_value(strvec);
+
+ if (!buff)
+ return 1;
+
+ temp = buff;
+
+ while ((result = strsep(&temp, split_char))) {
+ if (prio_lookup(result)) {
+ mpe->prio_name = STRDUP(result);
+ if (temp)
+ mpe->prio_arg = STRDUP(temp);
+ else
+ mpe->prio_arg = NULL;
+ break;
+ }
+ }
+
+ FREE(buff);
+ return 0;
+}
+
/*
* config file keywords printing
*/
@@ -1102,6 +1164,17 @@ snprint_mp_pg_timeout (char * buff, int len, void * data)
}
static int
+snprint_mp_prio(char * buff, int len, void * data)
+{
+ struct mpentry * mpe = (struct mpentry *)data;
+
+ if (!mpe->prio_name)
+ return 0;
+
+ return snprintf(buff, len, "%s", mpe->prio_name);
+}
+
+static int
snprint_hw_vendor (char * buff, int len, void * data)
{
struct hwentry * hwe = (struct hwentry *)data;
@@ -1672,6 +1745,7 @@ init_keywords(void)
install_keyword("alias", &alias_handler, &snprint_mp_alias);
install_keyword("path_grouping_policy", &mp_pgpolicy_handler, &snprint_mp_path_grouping_policy);
install_keyword("path_selector", &mp_selector_handler, &snprint_mp_selector);
+ install_keyword("prio", &mp_prio_handler, &snprint_mp_prio);
install_keyword("failback", &mp_failback_handler, &snprint_mp_failback);
install_keyword("rr_weight", &mp_weight_handler, &snprint_mp_rr_weight);
install_keyword("no_path_retry", &mp_no_path_retry_handler, &snprint_mp_no_path_retry);
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 56186bd..c4a53ab 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -784,8 +784,11 @@ pathinfo (struct path *pp, vector hwtable, int mask)
* been successfully obtained before.
*/
if (mask & DI_PRIO &&
- (pp->state != PATH_DOWN || pp->priority == PRIO_UNDEF))
+ (pp->state != PATH_DOWN || pp->priority == PRIO_UNDEF)) {
+ if (!strlen(pp->wwid))
+ get_uid(pp);
get_prio(pp);
+ }
if (mask & DI_WWID && !strlen(pp->wwid))
get_uid(pp);
diff --git a/libmultipath/prio.h b/libmultipath/prio.h
index deef02d..1d00725 100644
--- a/libmultipath/prio.h
+++ b/libmultipath/prio.h
@@ -24,6 +24,7 @@
#define PRIO_ONTAP "ontap"
#define PRIO_RANDOM "random"
#define PRIO_RDAC "rdac"
+#define PRIO_WEIGHTED_PATH "weightedpath"
/*
* Value used to mark the fact prio was not defined
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index df42145..a569321 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -12,7 +12,8 @@ LIBS = \
libpriordac.so \
libprioalua.so \
libprioontap.so \
- libpriohds.so
+ libpriohds.so \
+ libprioweightedpath.so
CFLAGS += -I..
diff --git a/libmultipath/prioritizers/weightedpath.c b/libmultipath/prioritizers/weightedpath.c
new file mode 100644
index 0000000..d04d91e
--- /dev/null
+++ b/libmultipath/prioritizers/weightedpath.c
@@ -0,0 +1,99 @@
+/*
+ *
+ * (C) Copyright 2008 Hewlett-Packard Development Company, L.P
+ *
+ * This file is released under the GPL
+ */
+
+/*
+ * Prioritizer for device mapper multipath, where specific paths and the
+ * corresponding priority values are provided as arguments.
+ *
+ * This prioritizer assigns the priority value provided in the configuration
+ * file based on the comparison made between the specified paths and the path
+ * instance for which this is called.
+ * Paths can be specified as a regular expression of devname of the path or
+ * as hbtl information of the path.
+ *
+ * Examples:
+ * prio "weightedpath hbtl 1:.:.:. 2 4:.:.:. 4"
+ * prio "weightedpath devname sda 10 sde 20"
+ *
+ * Returns zero as the default priority.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <prio.h>
+#include "weightedpath.h"
+#include <config.h>
+#include <structs.h>
+#include <memory.h>
+#include <debug.h>
+#include <regex.h>
+
+char *get_next_string(char **temp, char *split_char)
+{
+ char *token = NULL;
+ token = strsep(temp, split_char);
+ while (token != NULL && !strcmp(token, ""))
+ token = strsep(temp, split_char);
+ return token;
+}
+
+/* main priority routine */
+int prio_path_weight(struct path *pp)
+{
+ char path[FILE_NAME_SIZE];
+ char *arg;
+ char *temp, *regex, *prio;
+ char split_char[] = " \t";
+ int priority = DEFAULT_PRIORITY, path_found = 0;
+ regex_t pathe;
+
+ /* Return default priority if there is no argument */
+ if (!pp->prio_arg)
+ return priority;
+
+ arg = temp = STRDUP(pp->prio_arg);
+
+ regex = get_next_string(&temp, split_char);
+
+ if (!strcmp(regex, HBTL)) {
+ sprintf(path, "%d:%d:%d:%d", pp->sg_id.host_no,
+ pp->sg_id.channel, pp->sg_id.scsi_id, pp->sg_id.lun);
+ } else if (!strcmp(regex, DEV_NAME)) {
+ strcpy(path, pp->dev);
+ } else {
+ condlog(0, "%s: %s - Invalid arguments", pp->dev,
+ pp->prio->name);
+ return priority;
+ }
+
+ while (!path_found) {
+ if (!temp)
+ break;
+ if (!(regex = get_next_string(&temp, split_char)))
+ break;
+ if (!(prio = get_next_string(&temp, split_char)))
+ break;
+
+ if (!regcomp(&pathe, regex, REG_EXTENDED|REG_NOSUB)) {
+ if (!regexec(&pathe, path, 0, NULL, 0)) {
+ path_found = 1;
+ priority = atoi(prio);
+ }
+ regfree(&pathe);
+ }
+ }
+
+ FREE(arg);
+ return priority;
+}
+
+int getprio(struct path *pp)
+{
+ return prio_path_weight(pp);
+}
+
diff --git a/libmultipath/prioritizers/weightedpath.h b/libmultipath/prioritizers/weightedpath.h
new file mode 100644
index 0000000..141cdf7
--- /dev/null
+++ b/libmultipath/prioritizers/weightedpath.h
@@ -0,0 +1,11 @@
+#ifndef _WEIGHTED_PATH_H
+#define _WEIGHTED_PATH_H
+
+#define PRIO_WEIGHTED_PATH "weightedpath"
+#define HBTL "hbtl"
+#define DEV_NAME "devname"
+#define DEFAULT_PRIORITY 0
+
+int prio_path_weight(struct path *pp);
+
+#endif
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index 5a16182..1fc7c40 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -258,14 +258,28 @@ select_getuid (struct path * pp)
extern int
select_prio (struct path * pp)
{
+ struct mpentry * mpe;
+
+ if ((mpe = find_mpe(pp->wwid))) {
+ if (mpe->prio_name) {
+ pp->prio = prio_lookup(mpe->prio_name);
+ pp->prio_arg = mpe->prio_arg;
+ condlog(3, "%s: prio = %s (LUN setting)",
+ pp->dev, pp->prio->name);
+ return 0;
+ }
+ }
+
if (pp->hwe && pp->hwe->prio_name) {
pp->prio = prio_lookup(pp->hwe->prio_name);
+ pp->prio_arg = pp->hwe->prio_arg;
condlog(3, "%s: prio = %s (controller setting)",
pp->dev, pp->hwe->prio_name);
return 0;
}
if (conf->prio_name) {
pp->prio = prio_lookup(conf->prio_name);
+ pp->prio_arg = conf->prio_arg;
condlog(3, "%s: prio = %s (config file default)",
pp->dev, conf->prio_name);
return 0;
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 658d6b2..75bd379 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -121,6 +121,7 @@ struct path {
int pgindex;
char * getuid;
struct prio * prio;
+ char * prio_arg;
struct checker checker;
struct multipath * mpp;
int fd;
diff --git a/multipath.conf.annotated b/multipath.conf.annotated
index a4c7e6a..740a334 100644
--- a/multipath.conf.annotated
+++ b/multipath.conf.annotated
@@ -261,6 +261,18 @@
# # default : 1000
# #
# rr_min_io 100
+#
+# #
+# #name : prio
+# #scope : multipath
+# #desc : the function to call to obtain a path weight.
+# # Weights are summed for each path group to
+# # determine the next PG to use case of failure.
+# #default : no callout, all paths equals
+# # Ex:
+# # prio alua
+# # prio "weightedpath devname sda 50 sde 10 sdc 50 sdf 10"
+# prio "weightedpath hbtl 1:.:.:. 2 4:.:.:. 4"
# }
# multipath {
# wwid 1DEC_____321816758474
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index d3c37c8..8ac1f1c 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -151,6 +151,24 @@ Generate the path priority for Hitachi HDS Modular storage arrays.
Default value is \fBnone\fR.
.RE
.TP
+.B prio
+The default program and args to path priority routine. The specified
+routine should return a numeric value specifying the relative priority
+of this path. Higher number have a higher priority.
+.RS
+.TP 12
+.B alua
+Generate the path priority based on ALUA status of the path.
+.TP 12
+.B weightedpath <hbtl|devname> <regex1> <prio1> <regex2> <prio2> ...
+.I hbtl
+regex can be of SCSI H:B:T:L format Ex: 1:0:.:. , *:0:0:.
+.I devname
+regex can be of device name format Ex: sda , sd.e
+Generate the path priority based on the regular expression and the
+priority provided as argument.
+.RE
+.TP
.B features
Specify any device-mapper features to be used. Syntax is
.I num list
@@ -327,6 +345,8 @@ section:
.TP
.B path_selector
.TP
+.B prio
+.TP
.B failback
.TP
.B no_path_retry
@@ -380,6 +400,8 @@ section:
.TP
.B path_checker
.TP
+.B prio
+.TP
.B features
.TP
.B prio_callout

View File

@ -1,26 +0,0 @@
commit 94ed8e8244e89700d702c54d8a791e190b3868df
Author: Hannes Reinecke <hare@suse.de>
Date: Mon Nov 24 10:46:36 2008 +0100
Properly quote variables in mkinitrd scripts
We should quote variables properly, otherwise we risk some script
syntax errors.
References: 447966
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/multipath/setup-multipath.sh b/multipath/setup-multipath.sh
index 1670071..bb9b244 100644
--- a/multipath/setup-multipath.sh
+++ b/multipath/setup-multipath.sh
@@ -12,7 +12,7 @@ fi
if [ -x /sbin/multipath -a -x /sbin/dmsetup ] ; then
for bd in $blockdev ; do
update_blockdev $bd
- if [ $blockdriver = device-mapper ]; then
+ if [ "$blockdriver" = device-mapper ]; then
dm_uuid=$(dmsetup info -c --noheadings -o uuid -j $blockmajor -m $blockminor)
dm_creator=${dm_uuid%-*}
if [ "$dm_creator" = "mpath" ]; then

View File

@ -1,110 +0,0 @@
From 965522c700ea307029789a1485242835132cea77 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 14 Oct 2008 08:21:02 +0200
Subject: [PATCH] Read the verbosity level from multipath.conf configuration file
With this patch, multipathd can read the verbosity level from
the multipath.conf configuration file.
For example:
verbosity 5
References: 388284
Signed-off-by: Ritesh Raj Sarraf <rsarraf@netapp.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/config.c | 2 +-
libmultipath/defaults.h | 1 +
libmultipath/dict.c | 20 ++++++++++++++++++++
multipath/multipath.conf.5 | 5 +++++
4 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index 14bece1..d2585ed 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -423,7 +423,7 @@ load_config (char * file)
* internal defaults
*/
if (!conf->verbosity)
- conf->verbosity = 2;
+ conf->verbosity = DEFAULT_VERBOSITY;
conf->dev_type = DEV_NONE;
conf->minio = 1000;
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index 87b155e..a943673 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -11,6 +11,7 @@
#define DEFAULT_NO_PATH_RETRY NO_PATH_RETRY_UNDEF
#define DEFAULT_PGTIMEOUT -PGTIMEOUT_NONE
#define DEFAULT_USER_FRIENDLY_NAMES 0
+#define DEFAULT_VERBOSITY 2
#define DEFAULT_CHECKINT 5
#define MAX_CHECKINT(a) (a << 2)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index a5a294e..5794b11 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -33,6 +33,17 @@ polling_interval_handler(vector strvec)
}
static int
+verbosity_handler(vector strvec)
+{
+ char * buff;
+
+ buff = VECTOR_SLOT(strvec, 1);
+ conf->verbosity = atoi(buff);
+
+ return 0;
+}
+
+static int
udev_dir_handler(vector strvec)
{
conf->udev_dir = set_value(strvec);
@@ -1327,6 +1338,14 @@ snprint_def_polling_interval (char * buff, int len, void * data)
}
static int
+snprint_def_verbosity (char * buff, int len, void * data)
+{
+ if (conf->checkint == DEFAULT_VERBOSITY)
+ return 0;
+ return snprintf(buff, len, "%i", conf->verbosity);
+}
+
+static int
snprint_def_udev_dir (char * buff, int len, void * data)
{
if (!conf->udev_dir)
@@ -1572,6 +1591,7 @@ void
init_keywords(void)
{
install_keyword_root("defaults", NULL);
+ install_keyword("verbosity", &verbosity_handler, &snprint_def_verbosity);
install_keyword("polling_interval", &polling_interval_handler, &snprint_def_polling_interval);
install_keyword("udev_dir", &udev_dir_handler, &snprint_def_udev_dir);
install_keyword("multipath_dir", &multipath_dir_handler, &snprint_def_multipath_dir);
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 90ef588..d3c37c8 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -74,6 +74,11 @@ interval between two path checks in seconds; default is
directory where udev creates its device nodes; default is
.I /dev
.TP
+.B verbosity
+default verbosity. Higher values increase the verbosity level. Valid
+levels are between 0 and 6; default is 2.
+.I /dev
+.TP
.B selector
The default path selector algorithm to use; they are offered by the
kernel multipath target. The only currently implemented is
--
1.5.2.4

View File

@ -1,262 +0,0 @@
commit 3b88c4374cf2a204e14ffdaf85b2dbfdc4a1391a
Author: Hannes Reinecke <hare@suse.de>
Date: Thu Dec 4 14:20:06 2008 +0100
Reload map for device read-only setting changes
Whenever the read-only setting for a device changes we have
to reload the map. This patch implements the required cli command
and also a uevent handler if a uevent with 'DISK_RO=' setting
has been received.
References: 440959
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 3903b28..68178c3 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -672,3 +672,40 @@ out:
return NULL;
}
+extern int reload_map(struct vectors *vecs, struct multipath *mpp)
+{
+ char params[PARAMS_SIZE];
+ int r;
+
+ update_mpp_paths(mpp, vecs->pathvec);
+
+ params[0] = '\0';
+ if (setup_map(mpp, params, PARAMS_SIZE)) {
+ condlog(0, "%s: failed to setup map", mpp->alias);
+ return 1;
+ }
+ select_action(mpp, vecs->mpvec, 1);
+
+ r = domap(mpp, params);
+ if (r == DOMAP_FAIL || r == DOMAP_RETRY) {
+ condlog(3, "%s: domap (%u) failure "
+ "for reload map", mpp->alias, r);
+ return 1;
+ }
+ if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF) {
+ if (mpp->no_path_retry == NO_PATH_RETRY_FAIL)
+ dm_queue_if_no_path(mpp->alias, 0);
+ else
+ dm_queue_if_no_path(mpp->alias, 1);
+ }
+ if (mpp->pg_timeout != PGTIMEOUT_UNDEF) {
+ if (mpp->pg_timeout == -PGTIMEOUT_NONE)
+ dm_set_pg_timeout(mpp->alias, 0);
+ else
+ dm_set_pg_timeout(mpp->alias, mpp->pg_timeout);
+ }
+
+ return 0;
+}
+
+
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
index ec2800d..d0c06f2 100644
--- a/libmultipath/configure.h
+++ b/libmultipath/configure.h
@@ -28,4 +28,5 @@ 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 reload_map(struct vectors *vecs, struct multipath *mpp);
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index 13986da..19a71ad 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -341,3 +341,23 @@ uevent_get_minor(struct uevent *uev)
return minor;
}
+extern int
+uevent_get_disk_ro(struct uevent *uev)
+{
+ char *p, *q;
+ int i, ro = -1;
+
+ for (i = 0; uev->envp[i] != NULL; i++) {
+ if (!strncmp(uev->envp[i], "DISK_RO", 6) && strlen(uev->envp[i]) > 7) {
+ p = uev->envp[i] + 8;
+ ro = strtoul(p, &q, 10);
+ if (p == q) {
+ condlog(2, "invalid read_only setting '%s'", p);
+ ro = -1;
+ }
+ break;
+ }
+ }
+ return ro;
+}
+
diff --git a/libmultipath/uevent.h b/libmultipath/uevent.h
index 43d163b..ec6450b 100644
--- a/libmultipath/uevent.h
+++ b/libmultipath/uevent.h
@@ -23,5 +23,6 @@ int uevent_listen(int (*store_uev)(struct uevent *, void * trigger_data),
void * trigger_data);
int uevent_get_major(struct uevent *uev);
int uevent_get_minor(struct uevent *uev);
+int uevent_get_disk_ro(struct uevent *uev);
#endif /* _UEVENT_H */
diff --git a/multipathd/cli.c b/multipathd/cli.c
index 2545e89..acc8cab 100644
--- a/multipathd/cli.c
+++ b/multipathd/cli.c
@@ -156,6 +156,7 @@ load_keys (void)
r += add_key(keys, "reinstate", REINSTATE, 0);
r += add_key(keys, "fail", FAIL, 0);
r += add_key(keys, "resize", RESIZE, 0);
+ r += add_key(keys, "reload", RELOAD, 0);
r += add_key(keys, "paths", PATHS, 0);
r += add_key(keys, "maps", MAPS, 0);
r += add_key(keys, "multipaths", MAPS, 0);
@@ -427,6 +428,8 @@ cli_init (void) {
add_handler(RECONFIGURE, NULL);
add_handler(SUSPEND+MAP, NULL);
add_handler(RESUME+MAP, NULL);
+ add_handler(RESIZE+MAP, NULL);
+ add_handler(RELOAD+MAP, NULL);
add_handler(REINSTATE+PATH, NULL);
add_handler(FAIL+PATH, NULL);
diff --git a/multipathd/cli.h b/multipathd/cli.h
index be14395..1fa4862 100644
--- a/multipathd/cli.h
+++ b/multipathd/cli.h
@@ -8,6 +8,7 @@ enum {
__REINSTATE,
__FAIL,
__RESIZE,
+ __RELOAD,
__PATHS,
__MAPS,
__PATH,
@@ -33,6 +34,7 @@ enum {
#define REINSTATE (1 << __REINSTATE)
#define FAIL (1 << __FAIL)
#define RESIZE (1 << __RESIZE)
+#define RELOAD (1 << __RELOAD)
#define PATHS (1 << __PATHS)
#define MAPS (1 << __MAPS)
#define PATH (1 << __PATH)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 4f639b6..819dd87 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -460,6 +460,28 @@ out:
return err;
}
+int
+cli_reload(void *v, char **reply, int *len, void *data)
+{
+ struct vectors * vecs = (struct vectors *)data;
+ char * mapname = get_keyparam(v, MAP);
+ struct multipath *mpp;
+ int minor;
+
+ condlog(2, "%s: reload map (operator)", mapname);
+ if (sscanf(mapname, "dm-%d", &minor) == 1)
+ mpp = find_mp_by_minor(vecs->mpvec, minor);
+ else
+ mpp = find_mp_by_alias(vecs->mpvec, mapname);
+
+ if (!mpp) {
+ condlog(0, "%s: invalid map name. cannot reload", mapname);
+ return 1;
+ }
+
+ return reload_map(vecs, mpp);
+}
+
int resize_map(struct multipath *mpp, unsigned long long size,
struct vectors * vecs)
{
diff --git a/multipathd/cli_handlers.h b/multipathd/cli_handlers.h
index b65f259..6e92a07 100644
--- a/multipathd/cli_handlers.h
+++ b/multipathd/cli_handlers.h
@@ -17,6 +17,7 @@ int cli_del_map (void * v, char ** reply, int * len, void * data);
int cli_switch_group(void * v, char ** reply, int * len, void * data);
int cli_reconfigure(void * v, char ** reply, int * len, void * data);
int cli_resize(void * v, char ** reply, int * len, void * data);
+int cli_reload(void * v, char ** reply, int * len, void * data);
int cli_suspend(void * v, char ** reply, int * len, void * data);
int cli_resume(void * v, char ** reply, int * len, void * data);
int cli_reinstate(void * v, char ** reply, int * len, void * data);
diff --git a/multipathd/main.c b/multipathd/main.c
index 444494e..c60d075 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -572,6 +572,43 @@ out:
}
static int
+uev_update_path (struct uevent *uev, struct vectors * vecs)
+{
+ struct sysfs_device * dev;
+ int retval, ro;
+
+ dev = sysfs_device_get(uev->devpath);
+ if (!dev) {
+ condlog(2, "%s: not found in sysfs", uev->devpath);
+ return 1;
+ }
+ ro = uevent_get_disk_ro(uev);
+
+ if (ro >= 0) {
+ struct path * pp;
+
+ condlog(2, "%s: update path write_protect to '%d' (uevent)",
+ uev->kernel, ro);
+ pp = find_path_by_dev(vecs->pathvec, uev->kernel);
+ if (!pp) {
+ condlog(0, "%s: spurious uevent, path not found",
+ uev->kernel);
+ return 1;
+ }
+ if (pp->mpp)
+ retval = reload_map(vecs, pp->mpp);
+
+ condlog(2, "%s: map %s reloaded (retval %d)",
+ uev->kernel, pp->mpp->alias, retval);
+
+ }
+
+ sysfs_device_put(dev);
+
+ return retval;
+}
+
+static int
map_discovery (struct vectors * vecs)
{
struct multipath * mpp;
@@ -688,6 +725,10 @@ uev_trigger (struct uevent * uev, void * trigger_data)
r = uev_remove_path(uev, vecs);
goto out;
}
+ if (!strncmp(uev->action, "change", 6)) {
+ r = uev_update_path(uev, vecs);
+ goto out;
+ }
out:
unlock(vecs->lock);
@@ -731,6 +772,7 @@ uxlsnrloop (void * ap)
set_handler_callback(SUSPEND+MAP, cli_suspend);
set_handler_callback(RESUME+MAP, cli_resume);
set_handler_callback(RESIZE+MAP, cli_resize);
+ set_handler_callback(RELOAD+MAP, cli_reload);
set_handler_callback(REINSTATE+PATH, cli_reinstate);
set_handler_callback(FAIL+PATH, cli_fail);

View File

@ -1,27 +0,0 @@
From e70d95062c5aaa9218fc0b610ced88280df50650 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 18 Dec 2008 10:03:15 +0100
Subject: [PATCH] Remove kdev_t.h include
Pointless and giving the users the wrong impression.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/devmapper.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index a7ab41f..713db6a 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -10,7 +10,6 @@
#include <string.h>
#include <libdevmapper.h>
#include <ctype.h>
-#include <linux/kdev_t.h>
#include <unistd.h>
#include <errno.h>
--
1.6.0.2

View File

@ -1,449 +0,0 @@
From e8f4746fa0aec8422022f52d917d6f82915128ce Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 20 Nov 2008 12:14:42 +0100
Subject: [PATCH] Rework sysfs device handling in multipathd
Relying on sysfs devices has the disadvantage that the device
might already been gone by the time we look at it. And we don't
actually need it for eg device-mapper events as we can get all
required information via the device-mapper ioctl.
So only access sysfs if we absolutely have to and try to get
the information from other places if possible.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/devmapper.c | 25 ++++++++++++
libmultipath/devmapper.h | 1 +
libmultipath/uevent.c | 46 +++++++++++++++++++++-
libmultipath/uevent.h | 8 ++++
multipathd/cli_handlers.c | 13 +++---
multipathd/main.c | 94 +++++++++++++++++++++++++-------------------
multipathd/main.h | 2 +-
7 files changed, 139 insertions(+), 50 deletions(-)
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index bc4f9db..cde98eb 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -494,6 +494,31 @@ out:
}
int
+dm_get_major (char * mapname)
+{
+ int r = -1;
+ struct dm_task *dmt;
+ struct dm_info info;
+
+ if (!(dmt = dm_task_create(DM_DEVICE_INFO)))
+ return 0;
+
+ if (!dm_task_set_name(dmt, mapname))
+ goto out;
+
+ if (!dm_task_run(dmt))
+ goto out;
+
+ if (!dm_task_get_info(dmt, &info))
+ goto out;
+
+ r = info.major;
+out:
+ dm_task_destroy(dmt);
+ return r;
+}
+
+int
dm_get_minor (char * mapname)
{
int r = -1;
diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h
index b262efa..0c7b6b6 100644
--- a/libmultipath/devmapper.h
+++ b/libmultipath/devmapper.h
@@ -27,6 +27,7 @@ int dm_enablegroup(char * mapname, int index);
int dm_disablegroup(char * mapname, int index);
int dm_get_maps (vector mp);
int dm_geteventnr (char *name);
+int dm_get_major (char *name);
int dm_get_minor (char *name);
char * dm_mapname(int major, int minor);
int dm_remove_partmaps (const char * mapname);
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index 99757fe..13986da 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -262,10 +262,13 @@ int uevent_listen(int (*uev_trigger)(struct uevent *, void * trigger_data),
uev->envp[i] = NULL;
condlog(3, "uevent '%s' from '%s'", uev->action, uev->devpath);
+ uev->kernel = strrchr(uev->devpath, '/');
+ if (uev->kernel)
+ uev->kernel++;
/* print payload environment */
for (i = 0; uev->envp[i] != NULL; i++)
- condlog(3, "%s", uev->envp[i]);
+ condlog(5, "%s", uev->envp[i]);
/*
* Queue uevent and poke service pthread.
@@ -297,3 +300,44 @@ exit:
return 1;
}
+
+extern int
+uevent_get_major(struct uevent *uev)
+{
+ char *p, *q;
+ int i, major = -1;
+
+ for (i = 0; uev->envp[i] != NULL; i++) {
+ if (!strncmp(uev->envp[i], "MAJOR", 5) && strlen(uev->envp[i]) > 6) {
+ p = uev->envp[i] + 6;
+ major = strtoul(p, &q, 10);
+ if (p == q) {
+ condlog(2, "invalid major '%s'", p);
+ major = -1;
+ }
+ break;
+ }
+ }
+ return major;
+}
+
+extern int
+uevent_get_minor(struct uevent *uev)
+{
+ char *p, *q;
+ int i, minor = -1;
+
+ for (i = 0; uev->envp[i] != NULL; i++) {
+ if (!strncmp(uev->envp[i], "MINOR", 5) && strlen(uev->envp[i]) > 6) {
+ p = uev->envp[i] + 6;
+ minor = strtoul(p, &q, 10);
+ if (p == q) {
+ condlog(2, "invalid minor '%s'", p);
+ minor = -1;
+ }
+ break;
+ }
+ }
+ return minor;
+}
+
diff --git a/libmultipath/uevent.h b/libmultipath/uevent.h
index 55ce42c..43d163b 100644
--- a/libmultipath/uevent.h
+++ b/libmultipath/uevent.h
@@ -1,3 +1,6 @@
+#ifndef _UEVENT_H
+#define _UEVENT_H
+
/* environment buffer, the kernel's size in lib/kobject_uevent.c should fit in */
#define HOTPLUG_BUFFER_SIZE 1024
#define HOTPLUG_NUM_ENVP 32
@@ -12,8 +15,13 @@ struct uevent {
char buffer[HOTPLUG_BUFFER_SIZE + OBJECT_SIZE];
char *devpath;
char *action;
+ char *kernel;
char *envp[HOTPLUG_NUM_ENVP];
};
int uevent_listen(int (*store_uev)(struct uevent *, void * trigger_data),
void * trigger_data);
+int uevent_get_major(struct uevent *uev);
+int uevent_get_minor(struct uevent *uev);
+
+#endif /* _UEVENT_H */
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index fca09ed..f9b0da4 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -372,9 +372,8 @@ cli_add_map (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, MAP);
- int minor;
+ int major, minor;
char dev_path[PATH_SIZE];
- struct sysfs_device *sysdev;
condlog(2, "%s: add map (operator)", param);
@@ -389,13 +388,13 @@ cli_add_map (void * v, char ** reply, int * len, void * data)
condlog(2, "%s: not a device mapper table", param);
return 0;
}
- sprintf(dev_path,"/block/dm-%d", minor);
- sysdev = sysfs_device_get(dev_path);
- if (!sysdev) {
- condlog(2, "%s: not found in sysfs", param);
+ major = dm_get_major(param);
+ if (major < 0) {
+ condlog(2, "%s: not a device mapper table", param);
return 0;
}
- return ev_add_map(sysdev, vecs);
+ sprintf(dev_path,"dm-%d", minor);
+ return ev_add_map(dev_path, major, minor, vecs);
}
int
diff --git a/multipathd/main.c b/multipathd/main.c
index 6908902..bb396ec 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -46,6 +46,7 @@
#include <print.h>
#include <configure.h>
#include <prio.h>
+#include <uevent.h>
#include "main.h"
#include "pidfile.h"
@@ -212,32 +213,32 @@ flush_map(struct multipath * mpp, struct vectors * vecs)
}
static int
-uev_add_map (struct sysfs_device * dev, struct vectors * vecs)
+uev_add_map (struct uevent * uev, struct vectors * vecs)
{
- condlog(2, "%s: add map (uevent)", dev->kernel);
- return ev_add_map(dev, vecs);
+ int major, minor;
+
+ condlog(2, "%s: add map (uevent)", uev->kernel);
+ major = uevent_get_major(uev);
+ minor = uevent_get_minor(uev);
+ return ev_add_map(uev->kernel, major, minor, vecs);
}
int
-ev_add_map (struct sysfs_device * dev, struct vectors * vecs)
+ev_add_map (char * dev, int major, int minor, struct vectors * vecs)
{
char * alias;
- char *dev_t;
- int major, minor;
char * refwwid;
struct multipath * mpp;
int map_present;
int r = 1;
- dev_t = sysfs_attr_get_value(dev->devpath, "dev");
-
- if (!dev_t || sscanf(dev_t, "%d:%d", &major, &minor) != 2)
- return 1;
-
alias = dm_mapname(major, minor);
- if (!alias)
+ if (!alias) {
+ condlog(2, "%s: mapname not found for %d:%d",
+ dev, major, minor);
return 1;
+ }
map_present = dm_map_present(alias);
@@ -254,8 +255,7 @@ ev_add_map (struct sysfs_device * dev, struct vectors * vecs)
* if we create a multipath mapped device as a result
* of uev_add_path
*/
- condlog(0, "%s: devmap already registered",
- dev->kernel);
+ condlog(0, "%s: devmap already registered", dev);
return 0;
}
@@ -264,10 +264,10 @@ ev_add_map (struct sysfs_device * dev, struct vectors * vecs)
*/
if (map_present && (mpp = add_map_without_path(vecs, minor, alias))) {
sync_map_state(mpp);
- condlog(2, "%s: devmap %s added", alias, dev->kernel);
+ condlog(2, "%s: devmap %s added", alias, dev);
return 0;
}
- refwwid = get_refwwid(dev->kernel, DEV_DEVMAP, vecs->pathvec);
+ refwwid = get_refwwid(dev, DEV_DEVMAP, vecs->pathvec);
if (refwwid) {
r = coalesce_paths(vecs, NULL, refwwid, 0);
@@ -275,19 +275,19 @@ ev_add_map (struct sysfs_device * dev, struct vectors * vecs)
}
if (!r)
- condlog(2, "%s: devmap %s added", alias, dev->kernel);
+ condlog(2, "%s: devmap %s added", alias, dev);
else
- condlog(0, "%s: uev_add_map %s failed", alias, dev->kernel);
+ condlog(0, "%s: uev_add_map %s failed", alias, dev);
FREE(refwwid);
return r;
}
static int
-uev_remove_map (struct sysfs_device * dev, struct vectors * vecs)
+uev_remove_map (struct uevent * uev, struct vectors * vecs)
{
- condlog(2, "%s: remove map (uevent)", dev->kernel);
- return ev_remove_map(dev->kernel, vecs);
+ condlog(2, "%s: remove map (uevent)", uev->kernel);
+ return ev_remove_map(uev->kernel, vecs);
}
int
@@ -308,13 +308,13 @@ ev_remove_map (char * devname, struct vectors * vecs)
}
static int
-uev_umount_map (struct sysfs_device * dev, struct vectors * vecs)
+uev_umount_map (struct uevent * uev, struct vectors * vecs)
{
struct multipath * mpp;
- condlog(2, "%s: umount map (uevent)", dev->kernel);
+ condlog(2, "%s: umount map (uevent)", uev->kernel);
- mpp = find_mp_by_str(vecs->mpvec, dev->kernel);
+ mpp = find_mp_by_str(vecs->mpvec, uev->kernel);
if (!mpp)
return 0;
@@ -328,14 +328,21 @@ uev_umount_map (struct sysfs_device * dev, struct vectors * vecs)
return 0;
}
+
static int
-uev_add_path (struct sysfs_device * dev, struct vectors * vecs)
+uev_add_path (struct uevent *uev, struct vectors * vecs)
{
+ struct sysfs_device * dev;
+
+ dev = sysfs_device_get(uev->devpath);
+ if (!dev) {
+ condlog(2, "%s: not found in sysfs", uev->devpath);
+ return 1;
+ }
condlog(2, "%s: add path (uevent)", dev->kernel);
return (ev_add_path(dev->kernel, vecs) != 1)? 0 : 1;
}
-
/*
* returns:
* 0: added
@@ -448,12 +455,19 @@ out:
}
static int
-uev_remove_path (struct sysfs_device * dev, struct vectors * vecs)
+uev_remove_path (struct uevent *uev, struct vectors * vecs)
{
+ struct sysfs_device * dev;
int retval;
- condlog(2, "%s: remove path (uevent)", dev->kernel);
- retval = ev_remove_path(dev->kernel, vecs);
+ dev = sysfs_device_get(uev->devpath);
+ if (!dev) {
+ condlog(2, "%s: not found in sysfs", uev->devpath);
+ return 1;
+ }
+ condlog(2, "%s: remove path (uevent)", uev->kernel);
+ retval = ev_remove_path(uev->kernel, vecs);
+
if (!retval)
sysfs_device_put(dev);
@@ -625,7 +639,6 @@ int
uev_trigger (struct uevent * uev, void * trigger_data)
{
int r = 0;
- struct sysfs_device *sysdev;
struct vectors * vecs;
vecs = (struct vectors *)trigger_data;
@@ -633,10 +646,6 @@ uev_trigger (struct uevent * uev, void * trigger_data)
if (uev_discard(uev->devpath))
return 0;
- sysdev = sysfs_device_get(uev->devpath);
- if(!sysdev)
- return 0;
-
lock(vecs->lock);
/*
@@ -644,17 +653,17 @@ uev_trigger (struct uevent * uev, void * trigger_data)
* Add events are ignored here as the tables
* are not fully initialised then.
*/
- if (!strncmp(sysdev->kernel, "dm-", 3)) {
+ if (!strncmp(uev->kernel, "dm-", 3)) {
if (!strncmp(uev->action, "change", 6)) {
- r = uev_add_map(sysdev, vecs);
+ r = uev_add_map(uev, vecs);
goto out;
}
if (!strncmp(uev->action, "remove", 6)) {
- r = uev_remove_map(sysdev, vecs);
+ r = uev_remove_map(uev, vecs);
goto out;
}
if (!strncmp(uev->action, "umount", 6)) {
- r = uev_umount_map(sysdev, vecs);
+ r = uev_umount_map(uev, vecs);
goto out;
}
goto out;
@@ -664,15 +673,15 @@ uev_trigger (struct uevent * uev, void * trigger_data)
* path add/remove event
*/
if (filter_devnode(conf->blist_devnode, conf->elist_devnode,
- sysdev->kernel) > 0)
+ uev->kernel) > 0)
goto out;
if (!strncmp(uev->action, "add", 3)) {
- r = uev_add_path(sysdev, vecs);
+ r = uev_add_path(uev, vecs);
goto out;
}
if (!strncmp(uev->action, "remove", 6)) {
- r = uev_remove_path(sysdev, vecs);
+ r = uev_remove_path(uev, vecs);
goto out;
}
@@ -1383,6 +1392,9 @@ child (void * param)
FREE(vecs);
vecs = NULL;
+ cleanup_checkers();
+ cleanup_prio();
+
condlog(2, "--------shut down-------");
if (logsink)
diff --git a/multipathd/main.h b/multipathd/main.h
index d73cd70..5d6f1b8 100644
--- a/multipathd/main.h
+++ b/multipathd/main.h
@@ -7,7 +7,7 @@
int reconfigure (struct vectors *);
int ev_add_path (char *, struct vectors *);
int ev_remove_path (char *, struct vectors *);
-int ev_add_map (struct sysfs_device *, struct vectors *);
+int ev_add_map (char *, int, int, struct vectors *);
int ev_remove_map (char *, struct vectors *);
void sync_map_state (struct multipath *);
--
1.5.3.2

View File

@ -1,98 +0,0 @@
From 90d210e6c277d6d822ed66a47d546a91703e4fd9 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 20 Nov 2008 12:33:39 +0100
Subject: [PATCH] Search for correct hwe in update_multipath()
When updating the multipath structure we only should update the
hardware entry if it doesn't exist anymore. And we should take
care of not selecting invalid entries in the paths vector as
the hardware entry for this is invalid, too.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/structs_vec.c | 52 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 785a766..17cafd1 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -27,7 +27,7 @@ update_mpp_paths(struct multipath * mpp, vector pathvec)
struct path * pp;
int i,j;
- if (!mpp->pg)
+ if (!mpp || !mpp->pg)
return 0;
if (!mpp->paths &&
@@ -188,13 +188,48 @@ static struct hwentry *
extract_hwe_from_path(struct multipath * mpp)
{
struct path * pp = NULL;
+ int pg_num = -1, p_num = -1, i;
struct pathgroup * pgp = NULL;
- if (mpp && mpp->pg)
- pgp = VECTOR_SLOT(mpp->pg, 0);
+ condlog(3, "%s: searching paths for valid hwe", mpp->alias);
- if (pgp && pgp->paths)
- pp = VECTOR_SLOT(pgp->paths, 0);
+ if (mpp && mpp->pg) {
+ vector_foreach_slot(mpp->pg, pgp, i) {
+ if (pgp->status == PGSTATE_ACTIVE ||
+ pgp->status == PGSTATE_ENABLED) {
+ pg_num = i;
+ break;
+ }
+ }
+ if (pg_num >= 0)
+ pgp = VECTOR_SLOT(mpp->pg, pg_num);
+ }
+
+ if (pgp && pgp->paths) {
+ vector_foreach_slot(pgp->paths, pp, i) {
+ if (pp->dmstate == PSTATE_FAILED)
+ continue;
+ if (strlen(pp->vendor_id) > 0 &&
+ strlen(pp->product_id) > 0 &&
+ strlen(pp->rev) > 0) {
+ p_num = i;
+ break;
+ }
+ }
+ if (p_num >= 0)
+ pp = VECTOR_SLOT(pgp->paths, i);
+ }
+
+ if (pp) {
+ condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id);
+ condlog(3, "%s: product = %s", pp->dev, pp->product_id);
+ condlog(3, "%s: rev = %s", pp->dev, pp->rev);
+ if (!pp->hwe) {
+ condlog(3, "searching hwtable");
+ pp->hwe = find_hwe(conf->hwtable, pp->vendor_id,
+ pp->product_id, pp->rev);
+ }
+ }
return pp?pp->hwe:NULL;
}
@@ -316,7 +351,12 @@ retry:
}
//adopt_paths(vecs->pathvec, mpp);
- mpp->hwe = extract_hwe_from_path(mpp);
+ if (!mpp->hwe)
+ mpp->hwe = extract_hwe_from_path(mpp);
+ if (!mpp->hwe) {
+ condlog(3, "%s: no hardware entry found, using defaults",
+ mpp->alias);
+ }
select_rr_weight(mpp);
select_pgfailback(mpp);
set_no_path_retry(mpp);
--
1.5.3.2

View File

@ -1,53 +0,0 @@
From cce0922defb5c89c63ed42d2ea4a398d6a8c5a29 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 9 Dec 2008 12:26:49 +0100
Subject: [PATCH] Set 'max_fds' parameter for multipath
max_fds should be enabled for multipath, too.
References: 457443
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
multipath/main.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/multipath/main.c b/multipath/main.c
index ffa6eb5..49b5619 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -48,6 +48,9 @@
#include <configure.h>
#include <pgpolicies.h>
#include <version.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/resource.h>
int logsink;
@@ -477,6 +480,21 @@ main (int argc, char *argv[])
conf->dev_type = DEV_DEVMAP;
}
+ if (conf->max_fds) {
+ struct rlimit fd_limit;
+ if (conf->max_fds > 0) {
+ fd_limit.rlim_cur = conf->max_fds;
+ fd_limit.rlim_max = conf->max_fds;
+ }
+ else {
+ fd_limit.rlim_cur = RLIM_INFINITY;
+ fd_limit.rlim_max = RLIM_INFINITY;
+ }
+ if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0)
+ condlog(0, "can't set open fds limit to %d : %s\n",
+ conf->max_fds, strerror(errno));
+ }
+
dm_init();
if (conf->remove == FLUSH_ONE) {
--
1.6.0.2

View File

@ -1,38 +0,0 @@
commit a8c6e0c6da02d83b86280dbd1162c44f8cefb53f
Author: Hannes Reinecke <hare@suse.de>
Date: Wed Jan 7 10:59:46 2009 +0100
Shuffle to the call to memset in logarea_init()
We should call memset only after we know the area has been
allocated.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/log.c b/libmultipath/log.c
index 0dd1c22..0cf5047 100644
--- a/libmultipath/log.c
+++ b/libmultipath/log.c
@@ -47,12 +47,11 @@ static int logarea_init (int size)
size = DEFAULT_AREA_SIZE;
la->start = MALLOC(size);
- memset(la->start, 0, size);
-
if (!la->start) {
FREE(la);
return 1;
}
+ memset(la->start, 0, size);
la->empty = 1;
la->end = la->start + size;
@@ -143,7 +142,7 @@ int log_enqueue (int prio, const char * fmt, va_list ap)
la->empty = 0;
msg = (struct logmsg *)la->tail;
msg->prio = prio;
- memcpy((void *)&msg->str, buff, strlen(buff));
+ strcpy((void *)&msg->str, buff);
lastmsg->next = la->tail;
msg->next = la->head;

File diff suppressed because it is too large Load Diff

View File

@ -1,156 +0,0 @@
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index 0b39297..87b155e 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -1,4 +1,4 @@
-#define DEFAULT_GETUID "/lib/udev/scsi_id -g -u /dev/%n"
+#define DEFAULT_GETUID "/lib/udev/scsi_id -g -u -d /dev/%n"
#define DEFAULT_UDEVDIR "/dev"
#define DEFAULT_MULTIPATHDIR "/lib/multipath"
#define DEFAULT_SELECTOR "round-robin 0"
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 48f9b1a..3f45257 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -172,7 +172,7 @@ static struct hwentry default_hw[] = {
/* HP Smart Array */
.vendor = "HP",
.product = "LOGICAL VOLUME.*",
- .getuid = "/lib/udev/scsi_id -n -g -u /dev/%n",
+ .getuid = "/lib/udev/scsi_id -n -g -u -d /dev/%n",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
.selector = DEFAULT_SELECTOR,
@@ -214,7 +214,7 @@ static struct hwentry default_hw[] = {
{
.vendor = "EMC",
.product = "SYMMETRIX",
- .getuid = "/lib/udev/scsi_id -g -u -ppre-spc3-83 /dev/%n",
+ .getuid = "/lib/udev/scsi_id -g -u -ppre-spc3-83 -d /dev/%n",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
.selector = DEFAULT_SELECTOR,
@@ -337,6 +337,22 @@ static struct hwentry default_hw[] = {
.prio_name = PRIO_RDAC,
},
{
+ /* IBM DS3400 */
+ .vendor = "IBM",
+ .product = "1726-4xx",
+ .getuid = DEFAULT_GETUID,
+ .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,
+ .checker_name = RDAC,
+ .prio_name = PRIO_RDAC,
+ },
+ {
/* IBM DS4400 / FAStT700 */
.vendor = "IBM",
.product = "1742",
@@ -514,6 +530,22 @@ static struct hwentry default_hw[] = {
.checker_name = DIRECTIO,
.prio_name = DEFAULT_PRIO,
},
+ {
+ /* IBM IPR */
+ .vendor = "IBM",
+ .product = "IPR.*",
+ .getuid = DEFAULT_GETUID,
+ .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,
+ .checker_name = TUR,
+ .prio_name = PRIO_ALUA,
+ },
/*
* NETAPP controller family
*
@@ -679,7 +711,7 @@ static struct hwentry default_hw[] = {
{
.vendor = "PIVOT3",
.product = "RAIGE VOLUME",
- .getuid = "/sbin/scsi_id -p 0x80 -g -u -s /block/%n",
+ .getuid = "/lib/udev/scsi_id -p 0x80 -g -u -d /dev/%n",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
.selector = DEFAULT_SELECTOR,
diff --git a/libmultipath/uxsock.c b/libmultipath/uxsock.c
index f70e2f5..7bfc5d2 100644
--- a/libmultipath/uxsock.c
+++ b/libmultipath/uxsock.c
@@ -54,7 +54,6 @@ int ux_socket_listen(const char *name)
int fd;
struct sockaddr_un addr;
-
/* get rid of any old socket */
unlink(name);
diff --git a/multipath.conf.annotated b/multipath.conf.annotated
index dda9e4c..a4c7e6a 100644
--- a/multipath.conf.annotated
+++ b/multipath.conf.annotated
@@ -49,7 +49,7 @@
# # path identifier. Absolute path required
# # default : /lib/udev/scsi_id -g -u -s
# #
-# getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n"
+# getuid_callout "/lib/udev/scsi_id -g -u -d /dev/%n"
#
# #
# # name : prio
@@ -312,7 +312,7 @@
# # path identifier. Absolute path required
# # default : /lib/udev/scsi_id -g -u -s
# #
-# getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n"
+# getuid_callout "/lib/udev/scsi_id -g -u -d /dev/%n"
#
# #
# # name : prio
diff --git a/multipath.conf.synthetic b/multipath.conf.synthetic
index 33f820b..6459f56 100644
--- a/multipath.conf.synthetic
+++ b/multipath.conf.synthetic
@@ -7,7 +7,7 @@
# polling_interval 10
# selector "round-robin 0"
# path_grouping_policy multibus
-# getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n"
+# getuid_callout "/lib/udev/scsi_id -g -u -d /dev/%n"
# prio const
# path_checker directio
# rr_min_io 100
@@ -53,7 +53,7 @@
# vendor "COMPAQ "
# product "HSV110 (C)COMPAQ"
# path_grouping_policy multibus
-# getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n"
+# getuid_callout "/lib/udev/scsi_id -g -u -d /dev/%n"
# path_checker directio
# path_selector "round-robin 0"
# hardware_handler "0"
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index fc9d3da..90ef588 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -109,7 +109,7 @@ Default value is \fImultibus\fR.
The default program and args to callout to obtain a unique path
identifier. Should be specified with an absolute path. Default value
is
-.I /lib/udev/scsi_id -g -u -s
+.I /lib/udev/scsi_id -g -u -d /dev/%n
.TP
.B prio_callout
The default program and args to callout to obtain a path priority

View File

@ -1,644 +0,0 @@
diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
index 5132081..2640281 100644
--- a/libmultipath/checkers.c
+++ b/libmultipath/checkers.c
@@ -40,6 +40,14 @@ struct checker * alloc_checker (void)
void free_checker (struct checker * c)
{
+ condlog(3, "unloading %s checker", c->name);
+ list_del(&c->node);
+ if (c->handle) {
+ if (dlclose(c->handle) != 0) {
+ condlog(0, "Cannot unload checker %s: %s",
+ c->name, dlerror());
+ }
+ }
free(c);
}
@@ -49,8 +57,7 @@ void cleanup_checkers (void)
struct checker * checker_temp;
list_for_each_entry_safe(checker_loop, checker_temp, &checkers, node) {
- list_del(&checker_loop->node);
- free(checker_loop);
+ free_checker(checker_loop);
}
}
@@ -68,7 +75,6 @@ struct checker * checker_lookup (char * name)
struct checker * add_checker (char * name)
{
char libname[LIB_CHECKER_NAMELEN];
- void * handle;
struct checker * c;
char *errstr;
@@ -78,31 +84,31 @@ struct checker * add_checker (char * name)
snprintf(libname, LIB_CHECKER_NAMELEN, "%s/libcheck%s.so",
conf->multipath_dir, name);
condlog(3, "loading %s checker", libname);
- handle = dlopen(libname, RTLD_NOW);
+ c->handle = dlopen(libname, RTLD_NOW);
errstr = dlerror();
if (errstr != NULL)
- condlog(0, "A dynamic linking error occurred: (%s)", errstr);
- if (!handle)
+ condlog(0, "A dynamic linking error occurred: (%s)", errstr);
+ if (!c->handle)
goto out;
- c->check = (int (*)(struct checker *)) dlsym(handle, "libcheck_check");
+ c->check = (int (*)(struct checker *)) dlsym(c->handle, "libcheck_check");
errstr = dlerror();
if (errstr != NULL)
- condlog(0, "A dynamic linking error occurred: (%s)", errstr);
+ condlog(0, "A dynamic linking error occurred: (%s)", errstr);
if (!c->check)
goto out;
- c->init = (int (*)(struct checker *)) dlsym(handle, "libcheck_init");
+ c->init = (int (*)(struct checker *)) dlsym(c->handle, "libcheck_init");
errstr = dlerror();
if (errstr != NULL)
- condlog(0, "A dynamic linking error occurred: (%s)", errstr);
+ condlog(0, "A dynamic linking error occurred: (%s)", errstr);
if (!c->init)
goto out;
- c->free = (void (*)(struct checker *)) dlsym(handle, "libcheck_free");
+ c->free = (void (*)(struct checker *)) dlsym(c->handle, "libcheck_free");
errstr = dlerror();
if (errstr != NULL)
- condlog(0, "A dynamic linking error occurred: (%s)", errstr);
+ condlog(0, "A dynamic linking error occurred: (%s)", errstr);
if (!c->free)
goto out;
@@ -199,4 +205,5 @@ void checker_get (struct checker * dst, char * name)
dst->check = src->check;
dst->init = src->init;
dst->free = src->free;
+ dst->handle = NULL;
}
diff --git a/libmultipath/checkers.h b/libmultipath/checkers.h
index e735250..da09d6c 100644
--- a/libmultipath/checkers.h
+++ b/libmultipath/checkers.h
@@ -94,6 +94,7 @@ enum path_check_state {
struct checker {
struct list_head node;
+ void *handle;
int fd;
int sync;
int disable;
@@ -111,6 +112,7 @@ struct checker {
char * checker_state_name (int);
int init_checkers (void);
+void cleanup_checkers (void);
struct checker * add_checker (char *);
struct checker * checker_lookup (char *);
int checker_init (struct checker *, void **);
diff --git a/libmultipath/checkers/emc_clariion.c b/libmultipath/checkers/emc_clariion.c
index 9eac31d..03c1354 100644
--- a/libmultipath/checkers/emc_clariion.c
+++ b/libmultipath/checkers/emc_clariion.c
@@ -102,6 +102,8 @@ int libcheck_check (struct checker * c)
int ret;
memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ memset(sense_buffer, 0, 128);
+ memset(sb, 0, SENSE_BUFF_LEN);
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof (inqCmdBlk);
io_hdr.mx_sb_len = sizeof (sb);
@@ -128,7 +130,7 @@ int libcheck_check (struct checker * c)
}
if ( /* Effective initiator type */
- sense_buffer[27] != 0x03
+ sense_buffer[27] != 0x03
/*
* Failover mode should be set to 1 (PNR failover mode)
* or 4 (ALUA failover mode).
@@ -155,7 +157,7 @@ int libcheck_check (struct checker * c)
"or LUNZ");
return PATH_DOWN;
}
-
+
/*
* store the LUN WWN there and compare that it indeed did not
* change in between, to protect against the path suddenly
@@ -171,28 +173,29 @@ int libcheck_check (struct checker * c)
memcpy(ct->wwn, &sense_buffer[10], 16);
ct->wwn_set = 1;
}
-
+
/*
* Issue read on active path to determine if inactive snapshot.
*/
if (sense_buffer[4] == 2) {/* if active path */
unsigned char buf[4096];
+ memset(buf, 0, 4096);
ret = sg_read(c->fd, &buf[0], sbb = &sb[0]);
if (ret == PATH_DOWN) {
hexadecimal_to_ascii(ct->wwn, wwnstr);
/*
- * Check for inactive snapshot LU this way. Must
+ * Check for inactive snapshot LU this way. Must
* fail these.
- */
+ */
if (((sbb[2]&0xf) == 5) && (sbb[12] == 0x25) &&
(sbb[13]==1)) {
/*
- * Do this so that we can fail even the
- * passive paths which will return
+ * Do this so that we can fail even the
+ * passive paths which will return
* 02/04/03 not 05/25/01 on read.
- */
+ */
SET_INACTIVE_SNAP(c);
MSG(c, "emc_clariion_checker: Active "
"path to inactive snapshot WWN %s.",
@@ -206,10 +209,10 @@ int libcheck_check (struct checker * c)
MSG(c, "emc_clariion_checker: Active path is "
"healthy.");
/*
- * Remove the path from the set of paths to inactive
- * snapshot LUs if it was in this list since the
- * snapshot is no longer inactive.
- */
+ * Remove the path from the set of paths to inactive
+ * snapshot LUs if it was in this list since the
+ * snapshot is no longer inactive.
+ */
CLR_INACTIVE_SNAP(c);
}
} else {
@@ -221,7 +224,7 @@ int libcheck_check (struct checker * c)
ret = PATH_DOWN;
} else {
MSG(c,
- "emc_clariion_checker: Passive path is healthy.");
+ "emc_clariion_checker: Passive path is healthy.");
ret = PATH_UP; /* not ghost */
}
}
diff --git a/libmultipath/checkers/hp_sw.c b/libmultipath/checkers/hp_sw.c
index 7509307..3f28d85 100644
--- a/libmultipath/checkers/hp_sw.c
+++ b/libmultipath/checkers/hp_sw.c
@@ -48,75 +48,76 @@ static int
do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op,
void *resp, int mx_resp_len, int noisy)
{
- unsigned char inqCmdBlk[INQUIRY_CMDLEN] =
- { INQUIRY_CMD, 0, 0, 0, 0, 0 };
- unsigned char sense_b[SENSE_BUFF_LEN];
- struct sg_io_hdr io_hdr;
-
- if (cmddt)
- inqCmdBlk[1] |= 2;
- if (evpd)
- inqCmdBlk[1] |= 1;
- inqCmdBlk[2] = (unsigned char) pg_op;
+ unsigned char inqCmdBlk[INQUIRY_CMDLEN] =
+ { INQUIRY_CMD, 0, 0, 0, 0, 0 };
+ unsigned char sense_b[SENSE_BUFF_LEN];
+ struct sg_io_hdr io_hdr;
+
+ if (cmddt)
+ inqCmdBlk[1] |= 2;
+ if (evpd)
+ inqCmdBlk[1] |= 1;
+ inqCmdBlk[2] = (unsigned char) pg_op;
inqCmdBlk[3] = (unsigned char)((mx_resp_len >> 8) & 0xff);
inqCmdBlk[4] = (unsigned char) (mx_resp_len & 0xff);
- memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
- io_hdr.interface_id = 'S';
- io_hdr.cmd_len = sizeof (inqCmdBlk);
- io_hdr.mx_sb_len = sizeof (sense_b);
- io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
- io_hdr.dxfer_len = mx_resp_len;
- io_hdr.dxferp = resp;
- io_hdr.cmdp = inqCmdBlk;
- io_hdr.sbp = sense_b;
- io_hdr.timeout = DEF_TIMEOUT;
-
- if (ioctl(sg_fd, SG_IO, &io_hdr) < 0)
- return 1;
-
- /* treat SG_ERR here to get rid of sg_err.[ch] */
- io_hdr.status &= 0x7e;
- if ((0 == io_hdr.status) && (0 == io_hdr.host_status) &&
- (0 == io_hdr.driver_status))
- return 0;
- if ((SCSI_CHECK_CONDITION == io_hdr.status) ||
- (SCSI_COMMAND_TERMINATED == io_hdr.status) ||
- (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) {
- if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) {
- int sense_key;
- unsigned char * sense_buffer = io_hdr.sbp;
- if (sense_buffer[0] & 0x2)
- sense_key = sense_buffer[1] & 0xf;
- else
- sense_key = sense_buffer[2] & 0xf;
- if(RECOVERED_ERROR == sense_key)
- return 0;
- }
- }
- return 1;
+ memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ memset(sense_b, 0, SENSE_BUFF_LEN);
+ io_hdr.interface_id = 'S';
+ io_hdr.cmd_len = sizeof (inqCmdBlk);
+ io_hdr.mx_sb_len = sizeof (sense_b);
+ io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
+ io_hdr.dxfer_len = mx_resp_len;
+ io_hdr.dxferp = resp;
+ io_hdr.cmdp = inqCmdBlk;
+ io_hdr.sbp = sense_b;
+ io_hdr.timeout = DEF_TIMEOUT;
+
+ if (ioctl(sg_fd, SG_IO, &io_hdr) < 0)
+ return 1;
+
+ /* treat SG_ERR here to get rid of sg_err.[ch] */
+ io_hdr.status &= 0x7e;
+ if ((0 == io_hdr.status) && (0 == io_hdr.host_status) &&
+ (0 == io_hdr.driver_status))
+ return 0;
+ if ((SCSI_CHECK_CONDITION == io_hdr.status) ||
+ (SCSI_COMMAND_TERMINATED == io_hdr.status) ||
+ (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) {
+ if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) {
+ int sense_key;
+ unsigned char * sense_buffer = io_hdr.sbp;
+ if (sense_buffer[0] & 0x2)
+ sense_key = sense_buffer[1] & 0xf;
+ else
+ sense_key = sense_buffer[2] & 0xf;
+ if(RECOVERED_ERROR == sense_key)
+ return 0;
+ }
+ }
+ return 1;
}
static int
do_tur (int fd)
{
- unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 };
- struct sg_io_hdr io_hdr;
- unsigned char sense_buffer[32];
-
- memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
- io_hdr.interface_id = 'S';
- io_hdr.cmd_len = sizeof (turCmdBlk);
- io_hdr.mx_sb_len = sizeof (sense_buffer);
- io_hdr.dxfer_direction = SG_DXFER_NONE;
- io_hdr.cmdp = turCmdBlk;
- io_hdr.sbp = sense_buffer;
- io_hdr.timeout = DEF_TIMEOUT;
- io_hdr.pack_id = 0;
-
- if (ioctl(fd, SG_IO, &io_hdr) < 0)
+ unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 };
+ struct sg_io_hdr io_hdr;
+ unsigned char sense_buffer[32];
+
+ memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ io_hdr.interface_id = 'S';
+ io_hdr.cmd_len = sizeof (turCmdBlk);
+ io_hdr.mx_sb_len = sizeof (sense_buffer);
+ io_hdr.dxfer_direction = SG_DXFER_NONE;
+ io_hdr.cmdp = turCmdBlk;
+ io_hdr.sbp = sense_buffer;
+ io_hdr.timeout = DEF_TIMEOUT;
+ io_hdr.pack_id = 0;
+
+ if (ioctl(fd, SG_IO, &io_hdr) < 0)
return 1;
- if (io_hdr.info & SG_INFO_OK_MASK)
+ if (io_hdr.info & SG_INFO_OK_MASK)
return 1;
return 0;
@@ -134,8 +135,8 @@ libcheck_check (struct checker * c)
if (do_tur(c->fd)) {
MSG(c, MSG_HP_SW_GHOST);
- return PATH_GHOST;
- }
+ return PATH_GHOST;
+ }
MSG(c, MSG_HP_SW_UP);
return PATH_UP;
}
diff --git a/libmultipath/checkers/rdac.c b/libmultipath/checkers/rdac.c
index 0086125..c4c7b8f 100644
--- a/libmultipath/checkers/rdac.c
+++ b/libmultipath/checkers/rdac.c
@@ -52,6 +52,7 @@ do_inq(int sg_fd, unsigned int pg_op, void *resp, int mx_resp_len)
inqCmdBlk[2] = (unsigned char) pg_op;
inqCmdBlk[4] = (unsigned char) (mx_resp_len & 0xff);
memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ memset(sense_b, 0, SENSE_BUFF_LEN);
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof (inqCmdBlk);
@@ -100,6 +101,7 @@ libcheck_check (struct checker * c)
{
struct volume_access_inq inq;
+ memset(&inq, 0, sizeof(struct volume_access_inq));
if (0 != do_inq(c->fd, 0xC9, &inq, sizeof(struct volume_access_inq))) {
MSG(c, MSG_RDAC_DOWN);
return PATH_DOWN;
diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c
index 43b846d..820a2e3 100644
--- a/libmultipath/checkers/tur.c
+++ b/libmultipath/checkers/tur.c
@@ -47,6 +47,7 @@ libcheck_check (struct checker * c)
retry:
memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ memset(&sense_buffer, 0, 32);
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof (turCmdBlk);
io_hdr.mx_sb_len = sizeof (sense_buffer);
diff --git a/libmultipath/config.c b/libmultipath/config.c
index cf134e4..908156d 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -150,9 +150,6 @@ free_hwe (struct hwentry * hwe)
if (hwe->revision)
FREE(hwe->revision);
- if (hwe->selector)
- FREE(hwe->selector);
-
if (hwe->getuid)
FREE(hwe->getuid);
@@ -162,6 +159,15 @@ free_hwe (struct hwentry * hwe)
if (hwe->hwhandler)
FREE(hwe->hwhandler);
+ if (hwe->selector)
+ FREE(hwe->selector);
+
+ if (hwe->checker_name)
+ FREE(hwe->checker_name);
+
+ if (hwe->prio_name)
+ FREE(hwe->prio_name);
+
if (hwe->bl_product)
FREE(hwe->bl_product);
@@ -409,6 +415,12 @@ free_config (struct config * conf)
if (conf->bindings_file)
FREE(conf->bindings_file);
+ if (conf->prio_name)
+ FREE(conf->prio_name);
+
+ if (conf->checker_name)
+ FREE(conf->checker_name);
+
free_blacklist(conf->blist_devnode);
free_blacklist(conf->blist_wwid);
free_blacklist_device(conf->blist_device);
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 9929e19..20d0684 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -232,6 +232,7 @@ devt2devname (char *devname, char *devt)
char block_path[FILE_NAME_SIZE];
struct stat statbuf;
+ memset(block_path, 0, FILE_NAME_SIZE);
if (sscanf(devt, "%u:%u", &major, &minor) != 2) {
condlog(0, "Invalid device number %s", devt);
return 1;
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 46ae2ec..7467411 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -111,19 +111,22 @@ snprint_ro (char * buff, size_t len, struct multipath * mpp)
static int
snprint_progress (char * buff, size_t len, int cur, int total)
{
- int i = PROGRESS_LEN * cur / total;
- int j = PROGRESS_LEN - i;
char * c = buff;
char * end = buff + len;
- while (i-- > 0) {
- c += snprintf(c, len, "X");
- if ((len = (end - c)) <= 1) goto out;
- }
+ if (total > 0) {
+ int i = PROGRESS_LEN * cur / total;
+ int j = PROGRESS_LEN - i;
+
+ while (i-- > 0) {
+ c += snprintf(c, len, "X");
+ if ((len = (end - c)) <= 1) goto out;
+ }
- while (j-- > 0) {
- c += snprintf(c, len, ".");
- if ((len = (end - c)) <= 1) goto out;
+ while (j-- > 0) {
+ c += snprintf(c, len, ".");
+ if ((len = (end - c)) <= 1) goto out;
+ }
}
c += snprintf(c, len, " %i/%i", cur, total);
@@ -705,6 +708,7 @@ print_multipath_topology (struct multipath * mpp, int verbosity)
{
char buff[MAX_LINE_LEN * MAX_LINES] = {};
+ memset(&buff[0], 0, MAX_LINE_LEN * MAX_LINES);
snprint_multipath_topology(&buff[0], MAX_LINE_LEN * MAX_LINES,
mpp, verbosity);
printf("%s", buff);
diff --git a/libmultipath/prio.c b/libmultipath/prio.c
index c9d2873..352e9ca 100644
--- a/libmultipath/prio.c
+++ b/libmultipath/prio.c
@@ -24,6 +24,14 @@ struct prio * alloc_prio (void)
void free_prio (struct prio * p)
{
+ condlog(3, "unloading %s prioritizer", p->name);
+ list_del(&p->node);
+ if (p->handle) {
+ if (dlclose(p->handle) != 0) {
+ condlog(0, "Cannot unload prioritizer %s: %s",
+ p->name, dlerror());
+ }
+ }
free(p);
}
@@ -33,8 +41,7 @@ void cleanup_prio(void)
struct prio * prio_temp;
list_for_each_entry_safe(prio_loop, prio_temp, &prioritizers, node) {
- list_del(&prio_loop->node);
- free(prio_loop);
+ free_prio(prio_loop);
}
}
@@ -52,7 +59,6 @@ struct prio * prio_lookup (char * name)
struct prio * add_prio (char * name)
{
char libname[LIB_PRIO_NAMELEN];
- void * handle;
struct prio * p;
char *errstr;
@@ -62,16 +68,16 @@ struct prio * add_prio (char * name)
snprintf(libname, LIB_PRIO_NAMELEN, "%s/libprio%s.so",
conf->multipath_dir, name);
condlog(3, "loading %s prioritizer", libname);
- handle = dlopen(libname, RTLD_NOW);
+ p->handle = dlopen(libname, RTLD_NOW);
errstr = dlerror();
if (errstr != NULL)
- condlog(0, "A dynamic linking error occurred: (%s)", errstr);
- if (!handle)
+ condlog(0, "A dynamic linking error occurred: (%s)", errstr);
+ if (!p->handle)
goto out;
- p->getprio = (int (*)(struct path *)) dlsym(handle, "getprio");
+ p->getprio = (int (*)(struct path *)) dlsym(p->handle, "getprio");
errstr = dlerror();
if (errstr != NULL)
- condlog(0, "A dynamic linking error occurred: (%s)", errstr);
+ condlog(0, "A dynamic linking error occurred: (%s)", errstr);
if (!p->getprio)
goto out;
snprintf(p->name, PRIO_NAME_LEN, "%s", name);
diff --git a/libmultipath/prio.h b/libmultipath/prio.h
index 4eea703..deef02d 100644
--- a/libmultipath/prio.h
+++ b/libmultipath/prio.h
@@ -37,12 +37,14 @@
#define PRIO_NAME_LEN 16
struct prio {
+ void *handle;
struct list_head node;
char name[PRIO_NAME_LEN];
int (*getprio)(struct path *);
};
int init_prio (void);
+void cleanup_prio(void);
struct prio * add_prio (char *);
struct prio * prio_lookup (char *);
int prio_getprio (struct prio *, struct path *);
diff --git a/libmultipath/prioritizers/alua_rtpg.c b/libmultipath/prioritizers/alua_rtpg.c
index 59df788..498de62 100644
--- a/libmultipath/prioritizers/alua_rtpg.c
+++ b/libmultipath/prioritizers/alua_rtpg.c
@@ -265,8 +265,10 @@ get_asymmetric_access_state(int fd, unsigned int tpg)
}
memset(buf, 0, buflen);
rc = do_rtpg(fd, buf, buflen);
- if (rc < 0)
+ if (rc < 0) {
+ free(buf);
return rc;
+ }
scsi_buflen = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
if (buflen < (scsi_buflen + 4)) {
free(buf);
diff --git a/libmultipath/prioritizers/emc.c b/libmultipath/prioritizers/emc.c
index 61d7a77..c3301b2 100644
--- a/libmultipath/prioritizers/emc.c
+++ b/libmultipath/prioritizers/emc.c
@@ -18,8 +18,9 @@ int emc_clariion_prio(const char *dev, int fd)
unsigned char inqCmdBlk[INQUIRY_CMDLEN] = {INQUIRY_CMD, 1, 0xC0, 0,
sizeof(sb), 0};
struct sg_io_hdr io_hdr;
- int ret = 0;
+ int ret = PRIO_UNDEF;
+ memset(&sense_buffer, 0, 256);
memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof (inqCmdBlk);
@@ -45,9 +46,9 @@ int emc_clariion_prio(const char *dev, int fd)
pp_emc_log(0, "path unit report page in unknown format");
goto out;
}
-
+
if ( /* Effective initiator type */
- sense_buffer[27] != 0x03
+ sense_buffer[27] != 0x03
/*
* Failover mode should be set to 1 (PNR failover mode)
* or 4 (ALUA failover mode).
@@ -68,7 +69,7 @@ int emc_clariion_prio(const char *dev, int fd)
/* Note this will switch to the default priority group, even if
* it is not the currently active one. */
ret = (sense_buffer[5] == sense_buffer[8]) ? 1 : 0;
-
+
out:
return(ret);
}
diff --git a/libmultipath/prioritizers/hds.c b/libmultipath/prioritizers/hds.c
index f3d4cb3..d56a46a 100644
--- a/libmultipath/prioritizers/hds.c
+++ b/libmultipath/prioritizers/hds.c
@@ -104,6 +104,7 @@ int hds_modular_prio (const char *dev, int fd)
}
memset (&io_hdr, 0, sizeof (sg_io_hdr_t));
+ memset (inqBuff, 0, INQ_REPLY_LEN);
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof (inqCmdBlk);
io_hdr.mx_sb_len = sizeof (sense_buffer);
diff --git a/libmultipath/prioritizers/ontap.c b/libmultipath/prioritizers/ontap.c
index 1200114..4d7c128 100644
--- a/libmultipath/prioritizers/ontap.c
+++ b/libmultipath/prioritizers/ontap.c
@@ -79,6 +79,7 @@ static int send_gva(const char *dev, int fd, unsigned char pg,
int ret = -1;
memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ memset(results, 0, *results_size);
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof (cdb);
io_hdr.mx_sb_len = sizeof (sb);
diff --git a/libmultipath/prioritizers/rdac.c b/libmultipath/prioritizers/rdac.c
index 7eafc31..b514bdd 100644
--- a/libmultipath/prioritizers/rdac.c
+++ b/libmultipath/prioritizers/rdac.c
@@ -21,6 +21,7 @@ int rdac_prio(const char *dev, int fd)
int ret = 0;
memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ memset(sense_buffer, 0, 256);
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof (inqCmdBlk);
io_hdr.mx_sb_len = sizeof (sb);

View File

@ -1,42 +0,0 @@
commit 38a29e437712a01dcb027371a948b110cd54196e
Author: Hannes Reinecke <hare@suse.de>
Date: Wed Dec 3 10:38:04 2008 +0100
Split off IBM ESS entries
For some reason the regular expression doesn't work properly.
So split off the two entries.
References: bnc#439763
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index bf8c611..d742d6d 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -507,7 +507,23 @@ static struct hwentry default_hw[] = {
{
/* IBM ESS F20 aka Shark */
.vendor = "IBM",
- .product = "2105(800|F20)",
+ .product = "2105800",
+ .getuid = DEFAULT_GETUID,
+ .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,
+ .checker_name = TUR,
+ .prio_name = DEFAULT_PRIO,
+ },
+ {
+ /* IBM ESS F20 aka Shark */
+ .vendor = "IBM",
+ .product = "2105F20",
.getuid = DEFAULT_GETUID,
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,

View File

@ -1,23 +0,0 @@
commit 5b86869d6e83660fa9f004313497b67d67c78bea
Author: Hannes Reinecke <hare@suse.de>
Date: Mon Dec 1 10:01:40 2008 +0100
Add Should-Start entry for IBM xDR
IBM's xDR solution requires a should-start entry.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/multipath/multipath.init.suse b/multipath/multipath.init.suse
index 7dd7031..4f2d8b0 100755
--- a/multipath/multipath.init.suse
+++ b/multipath/multipath.init.suse
@@ -9,6 +9,8 @@
# Required-Start: boot.device-mapper boot.udev
# Required-Stop: boot.device-mapper boot.udev
# Default-Start: B
+# Should-Start: boot.xdrsetsite
+# Should-Stop: boot.xdrsetsite
# Default-Stop:
# Short-Description: Create multipath device targets
# Description: Setup initial multipath device-mapper targets

View File

@ -1,39 +0,0 @@
From ac44cbe83f16eafc3de5a56fa275aabd5783ce7c Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 29 Oct 2008 16:58:52 +0100
Subject: [PATCH] Fixup %n to handle '!' special case
The kernel name may contain an '!', which should be translated
into a '/'. So do it here.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/callout.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/libmultipath/callout.c b/libmultipath/callout.c
index 4dd33c5..59ac694 100644
--- a/libmultipath/callout.c
+++ b/libmultipath/callout.c
@@ -131,6 +131,7 @@ apply_format (char * string, char * cmd, struct path * pp)
char * pos;
char * dst;
char * p;
+ char * q;
int len;
int myfree;
@@ -169,6 +170,10 @@ apply_format (char * string, char * cmd, struct path * pp)
return 1;
snprintf(p, len, "%s", pp->dev);
+ for (q = p; q < p + len; q++) {
+ if (q && *q == '!')
+ *q = '/';
+ }
p += len - 1;
break;
case 'd':
--
1.5.4.5

View File

@ -1,165 +0,0 @@
commit 56f63c78a2f6446d283cfeb6884b6f730a712488
Author: Hannes Reinecke <hare@suse.de>
Date: Wed Jan 21 14:44:48 2009 +0100
Update dev_loss_tmo handling
The original implementation didn't update the hwe-specific settings
and failed to detect the correct rport. So fixing it.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index d8d1e30..c37247a 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -212,12 +212,10 @@ sysfs_get_fc_nodename (struct sysfs_device * dev, char * node,
int
sysfs_set_fc_values (struct path *pp, int dev_loss_tmo, int fast_io_fail_tmo)
{
+ char *rport;
char attr_path[SYSFS_PATH_SIZE];
- char host_path[SYSFS_PATH_SIZE];
char attr_value[NAME_SIZE];
- DIR *host_dir, *rport_dir;
- struct dirent *host_ent, *rport_ent;
- int host, channel, lun, port, num;
+ int host, num;
int rport_channel = -1;
int rport_id = -1;
@@ -226,74 +224,48 @@ sysfs_set_fc_values (struct path *pp, int dev_loss_tmo, int fast_io_fail_tmo)
return 0;
}
- if (safe_sprintf(host_path, "/sys/class/fc_host/host%i/device",
- pp->sg_id.host_no)) {
- condlog(0, "host_path too small");
- return 1;
- }
- if (!(host_dir = opendir(host_path))) {
- condlog(3, "host %d not a FC HBA", pp->sg_id.host_no);
+ if (!pp->sysdev) {
+ condlog(3, "%s: no sysfs device set", pp->dev);
return 0;
}
- while (rport_channel < 0 && rport_id < 0 &&
- (host_ent = readdir(host_dir))) {
- if (sscanf(host_ent->d_name, "rport-%d:%d-%d",
- &host, &port, &num) != 3)
- continue;
-
- if (host != pp->sg_id.host_no)
- continue;
-
- if (safe_sprintf(attr_path, "%s/%s",
- host_path, host_ent->d_name)) {
- condlog(0, "target_path too small");
- continue;
- }
-
- if (!(rport_dir = opendir(attr_path))) {
- condlog(1, "cannot open rport path '%s'", attr_path);
- continue;
- }
-
- while ((rport_ent = readdir(rport_dir))) {
- if (sscanf(rport_ent->d_name, "target%d:%d:%d",
- &host, &channel, &lun) != 3)
- continue;
-
- if (host != pp->sg_id.host_no &&
- channel != pp->sg_id.channel &&
- lun != pp->sg_id.scsi_id)
- continue;
+ condlog(4, "%s: checking rport for %s", pp->dev,
+ pp->sysdev ? pp->sysdev->devpath : NULL);
- rport_channel = port;
- rport_id = num;
- break;
- }
+ rport = strstr(pp->sysdev->devpath, "rport");
+ if (!rport || sscanf(rport, "rport-%d:%d-%d/%*s",
+ &host, &rport_channel, &rport_id) != 3) {
+ condlog(3, "%s: Invalid devpath %s",
+ pp->dev, pp->sysdev->devpath);
+ return 1;
}
if (rport_channel < 0 && rport_id < 0) {
- condlog(1, "No rport found");
+ condlog(3, "%s: No rport found", pp->dev);
return 0;
}
+ condlog(4, "%s: using rport-%d:%d-%d for target%d:%d:%d", pp->dev,
+ host, rport_channel, rport_id,
+ pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.scsi_id);
+
if (safe_sprintf(attr_path,
"/class/fc_remote_ports/rport-%d:%d-%d",
- pp->sg_id.host_no, rport_channel, rport_id)) {
- condlog(0, "attr_path too small");
+ host, rport_channel, rport_id)) {
+ condlog(1, "attr_path too small");
return 0;
}
+ condlog(4, "%s: set dev_loss_tmo to %d, fast_io_fail to %d",
+ pp->dev, dev_loss_tmo, fast_io_fail_tmo);
+
if (dev_loss_tmo < 0)
sprintf(attr_value, "%d", 0);
else
sprintf(attr_value, "%d", dev_loss_tmo);
num = sysfs_attr_set_value(attr_path, "dev_loss_tmo",
attr_value, strlen(attr_value));
- if (num > 0)
- condlog(4, "%s: set dev_loss_tmo to %d", pp->dev,
- dev_loss_tmo);
- else
+ if (num <= 0)
condlog(4, "%s: failed to set dev_loss_tmo (%d)",
pp->dev, errno);
@@ -303,10 +275,7 @@ sysfs_set_fc_values (struct path *pp, int dev_loss_tmo, int fast_io_fail_tmo)
sprintf(attr_value, "%d", fast_io_fail_tmo);
num = sysfs_attr_set_value(attr_path, "fast_io_fail_tmo",
attr_value, strlen(attr_value));
- if (num > 0)
- condlog(4, "%s: set fast_io_fail_tmo to %d", pp->dev,
- fast_io_fail_tmo);
- else
+ if (num <= 0)
condlog(4, "%s: failed to set fast_io_fail_tmo (%d)",
pp->dev, errno);
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 1632c9d..6cc7a93 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -479,12 +479,16 @@ verify_paths(struct multipath * mpp, struct vectors * vecs, vector rpvec)
free_path(pp);
}
} else {
- if (pp->hwe)
- sysfs_set_fc_values(pp, pp->hwe->dev_loss_tmo,
- pp->hwe->fast_io_fail_tmo);
- else
- sysfs_set_fc_values(pp, conf->dev_loss_tmo,
- conf->fast_io_fail_tmo);
+ int dev_loss_tmo = conf->dev_loss_tmo;
+ int fast_io_fail_tmo = conf->fast_io_fail_tmo;
+
+ if (pp->hwe && pp->hwe->dev_loss_tmo > 0)
+ dev_loss_tmo = pp->hwe->dev_loss_tmo;
+ if (pp->hwe && pp->hwe->fast_io_fail_tmo > 0)
+ fast_io_fail_tmo = pp->hwe->fast_io_fail_tmo;
+
+ sysfs_set_fc_values(pp, dev_loss_tmo,
+ fast_io_fail_tmo);
condlog(4, "%s: verified path %s dev_t %s",
mpp->alias, pp->dev, pp->dev_t);
}

View File

@ -1,128 +0,0 @@
commit 73af31edbba5588dafce75fa8267b14f36b545b0
Author: Hannes Reinecke <hare@suse.de>
Date: Tue Nov 11 13:44:09 2008 +0100
Update hardware table for new HP arrays
References: 442133
Signed-off-by: Vijayakumar Balasubramanian <vijaykumar@hp.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index fda131c..bf8c611 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -122,7 +122,7 @@ static struct hwentry default_hw[] = {
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
.no_path_retry = 12,
- .minio = DEFAULT_MINIO,
+ .minio = 100,
.checker_name = HP_SW,
.prio_name = PRIO_HP_SW,
},
@@ -138,26 +138,11 @@ static struct hwentry default_hw[] = {
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
.no_path_retry = 12,
- .minio = DEFAULT_MINIO,
+ .minio = 100,
.checker_name = TUR,
.prio_name = PRIO_ALUA,
},
{
- .vendor = "HP",
- .product = "MSA2000s*",
- .getuid = "/sbin/cciss_id %n",
- .features = DEFAULT_FEATURES,
- .hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
- .pgpolicy = GROUP_BY_PRIO,
- .pgfailback = -FAILBACK_IMMEDIATE,
- .rr_weight = RR_WEIGHT_NONE,
- .no_path_retry = 12,
- .minio = DEFAULT_MINIO,
- .checker_name = TUR,
- .prio_name = DEFAULT_PRIO,
- },
- {
/* EVA 3000/5000 with new firmware, EVA 4000/6000/8000 */
.vendor = "(COMPAQ|HP)",
.product = "HSV1[01]1|HSV2[01]0|HSV300",
@@ -169,14 +154,14 @@ static struct hwentry default_hw[] = {
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
.no_path_retry = 12,
- .minio = DEFAULT_MINIO,
+ .minio = 100,
.checker_name = TUR,
.prio_name = PRIO_ALUA,
},
{
- /* HP MSA2000 product family */
+ /* HP MSA2000 product family with old firmware */
.vendor = "HP",
- .product = "MSA2[02]12*",
+ .product = "MSA2[02]12fc|MSA2012i",
.getuid = DEFAULT_GETUID,
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
@@ -184,12 +169,46 @@ static struct hwentry default_hw[] = {
.pgpolicy = MULTIBUS,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
- .no_path_retry = 12,
- .minio = DEFAULT_MINIO,
+ .no_path_retry = 18,
+ .minio = 100,
.checker_name = TUR,
.prio_name = DEFAULT_PRIO,
},
{
+ /* HP MSA2000 product family with new firmware */
+ .vendor = "HP",
+ .product = "MSA2012sa|MSA23(12|24)(fc|i|sa)",
+ .getuid = DEFAULT_GETUID,
+ .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,
+ .checker_name = TUR,
+ .prio_name = PRIO_ALUA,
+ },
+
+ {
+ /* HP SVSP */
+ .vendor = "HP",
+ .product = "HSVX700",
+ .getuid = DEFAULT_GETUID,
+ .features = DEFAULT_FEATURES,
+ .hwhandler = "1 alua",
+ .selector = DEFAULT_SELECTOR,
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
+ .rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = 12,
+ .minio = 100,
+ .checker_name = TUR,
+ .prio_name = PRIO_ALUA,
+ },
+
+ {
/* HP Smart Array */
.vendor = "HP",
.product = "LOGICAL VOLUME.*",
@@ -294,7 +313,7 @@ static struct hwentry default_hw[] = {
.vendor = "(HITACHI|HP)",
.product = "OPEN-.*",
.getuid = DEFAULT_GETUID,
- .features = "1 queue_if_no_path",
+ .features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
.selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,

View File

@ -1,123 +0,0 @@
commit bff69e33ca279de49c5cebc33107c99cbf2c4bea
Author: Hannes Reinecke <hare@suse.de>
Date: Wed Jan 21 14:59:30 2009 +0100
Fix up sdev_state handling
Before trying to access any path checker of priority callouts we
really should check the sdev state; only when in 'running' the
callout is likely to succeed. So modify the handling to properly
check the sdev_state and return a proper error for failure state.
References: 458393
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index c37247a..c09e7ed 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -661,6 +661,44 @@ common_sysfs_pathinfo (struct path * pp, struct sysfs_device *dev)
return 0;
}
+static int sysfs_get_sdev_state(struct path *pp)
+{
+ struct sysfs_device *parent;
+ char dev_state[32];
+
+ /* check device state */
+ if (!pp->sysdev) {
+ condlog(3, "%s: no sysfs device", pp->dev);
+ return PATH_WILD;
+ }
+ parent = sysfs_device_get_parent(pp->sysdev);
+ if (!parent) {
+ condlog(3, "%s: no parent for '%s'",
+ pp->dev, pp->sysdev->devpath);
+ return PATH_WILD;
+ }
+ if (!strncmp(parent->kernel, "block", 5)) {
+ parent = sysfs_device_get_parent(parent);
+ }
+ if (!parent) {
+ condlog(3, "%s: no block device for '%s'",
+ pp->dev, parent->devpath);
+ return PATH_WILD;
+ }
+ if (!sysfs_get_state(parent, dev_state, 32)) {
+ if (!strncmp(dev_state, "blocked", 7)) {
+ condlog(3, "%s: device blocked", pp->dev);
+ return PATH_UNCHECKED;
+ } else if (!strncmp(dev_state, "running", 7)) {
+ return PATH_UP;
+ }
+ condlog(3, "%s: device in state %s",
+ pp->dev, dev_state);
+ return PATH_DOWN;
+ }
+ return PATH_WILD;
+}
+
struct sysfs_device *sysfs_device_from_path(struct path *pp)
{
char sysdev[FILE_NAME_SIZE];
@@ -762,20 +800,12 @@ get_state (struct path * pp)
condlog(3, "%s: get_state", pp->dev);
if (pp->bus == SYSFS_BUS_SCSI && pp->sysdev) {
- struct sysfs_device *parent;
- char dev_state[32];
-
- /* check device state */
- parent = sysfs_device_get_parent(pp->sysdev);
- if (parent && !strncmp(parent->kernel, "block", 5))
- parent = sysfs_device_get_parent(parent);
- if (parent && !sysfs_get_state(parent, dev_state, 32)) {
- if (!strncmp(dev_state, "blocked", 7)) {
- condlog(3, "%s: device blocked", pp->dev);
- pp->state = PATH_DOWN;
- pp->priority = 0;
- return 0;
- }
+ /* Check the sdev state before accessing it */
+ pp->state = sysfs_get_sdev_state(pp);
+ if (pp->state == PATH_UNCHECKED || pp->state == PATH_DOWN) {
+ /* Further checking pointless */
+ pp->priority = 0;
+ return 0;
}
}
if (!checker_selected(c)) {
@@ -801,23 +831,17 @@ get_state (struct path * pp)
static int
get_prio (struct path * pp)
{
+ int path_state;
+
if (!pp)
return 0;
- if (pp->bus == SYSFS_BUS_SCSI && pp->sysdev) {
- struct sysfs_device *parent;
- char dev_state[32];
-
- /* check device state */
- parent = sysfs_device_get_parent(pp->sysdev);
- if (parent && !strncmp(parent->kernel, "block", 5))
- parent = sysfs_device_get_parent(parent);
- if (parent && !sysfs_get_state(parent, dev_state, 32)) {
- if (!strncmp(dev_state, "blocked", 7)) {
- condlog(3, "%s: device blocked", pp->dev);
- pp->priority = PRIO_UNDEF;
- return 0;
- }
+ if (pp->bus == SYSFS_BUS_SCSI) {
+ /* Check the sdev state before accessing it */
+ path_state = sysfs_get_sdev_state(pp);
+ if (path_state == PATH_DOWN || path_state == PATH_UNCHECKED) {
+ pp->priority = PRIO_UNDEF;
+ return 0;
}
}

View File

@ -1,62 +0,0 @@
From 0f7c86b8ba073570acc7fa31c9f52adc2cf4ac8f Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 8 Jan 2009 09:12:36 +0100
Subject: [PATCH] Use MALLOC/FREE for checker and prio allocation
We should be using the proper defines for malloc/free to
ease tracking of memory leaks.
Signed-off-by: Konrad Rzeszutek <konrad@virtualiron.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/checkers.c | 4 ++--
libmultipath/prio.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
index 231b408..45ef531 100644
--- a/libmultipath/checkers.c
+++ b/libmultipath/checkers.c
@@ -38,7 +38,7 @@ struct checker * alloc_checker (void)
{
struct checker *c;
- c = zalloc(sizeof(struct checker));
+ c = MALLOC(sizeof(struct checker));
if (c)
INIT_LIST_HEAD(&c->node);
return c;
@@ -54,7 +54,7 @@ void free_checker (struct checker * c)
c->name, dlerror());
}
}
- free(c);
+ FREE(c);
}
void cleanup_checkers (void)
diff --git a/libmultipath/prio.c b/libmultipath/prio.c
index 1b9f51b..5e01f54 100644
--- a/libmultipath/prio.c
+++ b/libmultipath/prio.c
@@ -22,7 +22,7 @@ struct prio * alloc_prio (void)
{
struct prio *p;
- p = zalloc(sizeof(struct prio));
+ p = MALLOC(sizeof(struct prio));
if (p)
INIT_LIST_HEAD(&p->node);
return p;
@@ -38,7 +38,7 @@ void free_prio (struct prio * p)
p->name, dlerror());
}
}
- free(p);
+ FREE(p);
}
void cleanup_prio(void)
--
1.6.0.2

View File

@ -1,58 +0,0 @@
commit 9751659f37b9bf19ece7849e7186f67a6760c31a
Author: Hannes Reinecke <hare@suse.de>
Date: Thu Jan 15 12:01:33 2009 +0100
Use defaults for dev_loss_tmo and fast_io_fail_tmo
We should be using some sensible defaults. So using '10' for
dev_loss_tmo and '5' for fast_io_fail_tmo.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/config.c b/libmultipath/config.c
index ea7ad99..58485c6 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -463,8 +463,8 @@ load_config (char * file)
conf->dev_type = DEV_NONE;
conf->minio = 1000;
conf->max_fds = 0;
- conf->dev_loss_tmo = 0;
- conf->fast_io_fail_tmo = 0;
+ conf->dev_loss_tmo = DEFAULT_DEV_LOSS_TMO;
+ conf->fast_io_fail_tmo = DEFAULT_FAST_IO_FAIL;
conf->multipath_dir = set_default(DEFAULT_MULTIPATHDIR);
/*
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index a943673..4a55ff9 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -12,6 +12,8 @@
#define DEFAULT_PGTIMEOUT -PGTIMEOUT_NONE
#define DEFAULT_USER_FRIENDLY_NAMES 0
#define DEFAULT_VERBOSITY 2
+#define DEFAULT_DEV_LOSS_TMO 10
+#define DEFAULT_FAST_IO_FAIL 5
#define DEFAULT_CHECKINT 5
#define MAX_CHECKINT(a) (a << 2)
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 926ff69..d29a3b6 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -265,12 +265,12 @@ The full pathname of the binding file to be used when the user_friendly_names op
.I /var/lib/multipath/bindings
.TP
.B dev_loss_tmo
-The default dev_loss_tmo setting for an FC remote port in seconds. If an rport has vanished from the fabric all devices on that port will be removed from sysfs after this timeout.
+The default dev_loss_tmo setting for an FC remote port in seconds. If an rport has vanished from the fabric all devices on that port will be removed from sysfs after this timeout. Default is 10.
.TP
.B fast_io_fail_tmo
The default fast_io_fail_tmo setting for an FC remote port in seconds. If an rport has vanished from the fabric all I/O to the devices on that port will be terminated after this timeout. Should be smaller than
.B dev_loss_tmo
-setting.
+setting. Default is 5.
.
.SH "blacklist section"
The

View File

@ -1,31 +0,0 @@
From c61cebec5c538a95cf641984357259dc616e5760 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 29 Oct 2008 13:54:36 +0100
Subject: [PATCH] multipathd crashes on shutdown
And again pthread programming has proven to be difficult.
We really should wait for the thread to actually exit before
continuing and free up all of its resources.
References: 437245
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/log_pthread.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/libmultipath/log_pthread.c b/libmultipath/log_pthread.c
index 5a97db6..9e9aebe 100644
--- a/libmultipath/log_pthread.c
+++ b/libmultipath/log_pthread.c
@@ -83,6 +83,7 @@ void log_thread_stop (void)
pthread_mutex_lock(logq_lock);
pthread_cancel(log_thr);
pthread_mutex_unlock(logq_lock);
+ pthread_join(log_thr, NULL);
flush_logqueue();
--
1.5.4.5

View File

@ -1,103 +0,0 @@
From 734cf32be1f4bf3fa57bbdcc83147f92c4199b54 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 20 Nov 2008 09:00:39 +0100
Subject: [PATCH] Use /sys/dev for reverse lookup
Newer kernels provide /sys/dev for reverse lookup of major:minor
numbers. Also some error checking is in order here.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/discovery.c | 35 ++++++++++++++++++++++++++++++-----
1 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 20d0684..56186bd 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -152,11 +152,11 @@ sysfs_get_dev (struct sysfs_device * dev, char * buff, size_t len)
attr = sysfs_attr_get_value(dev->devpath, "dev");
if (!attr) {
- condlog(3, "%s: no 'dev' attribute in sysfs", dev->kernel);
+ condlog(3, "%s: no 'dev' attribute in sysfs", dev->devpath);
return 1;
}
if (strlcpy(buff, attr, len) != strlen(attr)) {
- condlog(3, "%s: overflow in 'dev' attribute", dev->kernel);
+ condlog(3, "%s: overflow in 'dev' attribute", dev->devpath);
return 2;
}
return 0;
@@ -169,13 +169,18 @@ sysfs_get_size (struct sysfs_device * dev, unsigned long long * size)
int r;
attr = sysfs_attr_get_value(dev->devpath, "size");
- if (!attr)
+ if (!attr) {
+ condlog(3, "%s: No size attribute in sysfs", dev->devpath);
return 1;
+ }
r = sscanf(attr, "%llu\n", size);
- if (r != 1)
+ if (r != 1) {
+ condlog(3, "%s: Cannot parse size attribute '%s'",
+ dev->devpath, attr);
return 1;
+ }
return 0;
}
@@ -232,12 +237,30 @@ devt2devname (char *devname, char *devt)
char block_path[FILE_NAME_SIZE];
struct stat statbuf;
- memset(block_path, 0, FILE_NAME_SIZE);
if (sscanf(devt, "%u:%u", &major, &minor) != 2) {
condlog(0, "Invalid device number %s", devt);
return 1;
}
+ sprintf(block_path,"/sys/dev/%u:%u", major, minor);
+ if (stat(block_path, &statbuf) == 0) {
+ /* Newer kernels have /sys/dev */
+ if (S_ISLNK(statbuf.st_mode) &&
+ readlink(block_path, dev, FILE_NAME_SIZE) > 0) {
+ char *p = strrchr(dev, '/');
+
+ if (!p) {
+ condlog(0, "No sysfs entry for %s\n",
+ block_path);
+ return 1;
+ }
+ p++;
+ strncpy(devname, p, FILE_NAME_SIZE);
+ return 0;
+ }
+ }
+ memset(block_path, 0, FILE_NAME_SIZE);
+
if (!(fd = fopen("/proc/partitions", "r"))) {
condlog(0, "Cannot open /proc/partitions");
return 1;
@@ -271,6 +294,7 @@ devt2devname (char *devname, char *devt)
condlog(0, "sysfs entry %s is not a directory\n", block_path);
return 1;
}
+ strncpy(devname, dev, FILE_NAME_SIZE);
return 0;
}
@@ -291,6 +315,7 @@ do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op,
inqCmdBlk[3] = (unsigned char)((mx_resp_len >> 8) & 0xff);
inqCmdBlk[4] = (unsigned char) (mx_resp_len & 0xff);
memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ memset(sense_b, 0, SENSE_BUFF_LEN);
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof (inqCmdBlk);
io_hdr.mx_sb_len = sizeof (sense_b);
--
1.5.3.2

View File

@ -1,40 +0,0 @@
commit 8fe887aa6875dfbb5057c9b1e4e8c91445700de5
Author: Hannes Reinecke <hare@suse.de>
Date: Fri Nov 14 10:02:56 2008 +0100
libmultipath: zero out lines in print.c
static declaration of line within a function doesn't place them in
the bss segment, hence they are not zeroed automatically.
Gives funny effects occasionally.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 6d80248..46ae2ec 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -1246,6 +1246,7 @@ print_path (struct path * pp, char * style)
{
char line[MAX_LINE_LEN];
+ memset(&line[0], 0, MAX_LINE_LEN);
snprint_path(&line[0], MAX_LINE_LEN, style, pp);
printf("%s", line);
}
@@ -1255,6 +1256,7 @@ print_multipath (struct multipath * mpp, char * style)
{
char line[MAX_LINE_LEN];
+ memset(&line[0], 0, MAX_LINE_LEN);
snprint_multipath(&line[0], MAX_LINE_LEN, style, mpp);
printf("%s", line);
}
@@ -1264,6 +1266,7 @@ print_pathgroup (struct pathgroup * pgp, char * style)
{
char line[MAX_LINE_LEN];
+ memset(&line[0], 0, MAX_LINE_LEN);
snprint_pathgroup(&line[0], MAX_LINE_LEN, style, pgp);
printf("%s", line);
}

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Aug 21 15:49:47 CEST 2009 - hare@suse.de
- Update to latest upstream git version
- Merge in SLES11 fixes
- Build package from git tree
- Implement '-u' option for kpartx (bnc#517442)
-------------------------------------------------------------------
Fri Jun 19 10:35:46 CEST 2009 - coolo@novell.com

View File

@ -21,80 +21,17 @@
Name: multipath-tools
BuildRequires: device-mapper-devel libaio-devel readline-devel
Url: http://christophe.varoqui.free.fr/
License: BSD 3-clause (or similar) ; GPL v2 or later ; LGPL v2.1 or later ; Public Domain, Freeware ; MIT License (or similar)
License: BSD 3-clause (or similar) ; GPL v2 or later ; LGPL v2.1 or later ; Public Domain, Freeware ; MIT License (or similar)
Group: System/Base
Requires: device-mapper kpartx
PreReq: %insserv_prereq %fillup_prereq coreutils grep diffutils
PreReq: %insserv_prereq %fillup_prereq coreutils grep
AutoReqProv: on
Version: 0.4.8
Release: 41
Release: 42
Summary: Tools to Manage Multipathed Devices with the device-mapper
Source: multipath-tools-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Patch0: %{name}-git-update
Patch1: %{name}-sles11-alpha1-update
Patch2: %{name}-sles11-alpha3-update
Patch3: %{name}-check-get_inq-return-values
Patch4: %{name}-implement-map-resize
Patch5: %{name}-add-show-status-cmd
Patch6: %{name}-add-compellent-hwtable-entry
Patch7: %{name}-increase-bindings-file-lock-timeout
Patch8: %{name}-fixes-for-show-paths-format
Patch9: %{name}-add-show-wildcards-cmd
Patch10: %{name}-fopen-returns-NULL
Patch11: %{name}-read-verbosity-level-from-conf
Patch12: %{name}-kpartx-doesnt-remove-loop-device
Patch13: %{name}-missing-fixes-for-ontap
Patch14: %{name}-add-IBM-storage-to-hwtable
Patch15: %{name}-increase-loop-buffer-size
Patch16: %{name}-include-device-handler-modules
Patch17: %{name}-use-pthread_join
Patch18: %{name}-fixup-scsi_id-for-cciss
Patch19: %{name}-sysfs-subdir-reformat
Patch20: %{name}-dont-check-valid-context-in-get_state
Patch21: %{name}-link-directio-against-libaio
Patch22: %{name}-check-for-empty-mpvecs
Patch23: %{name}-dmraid-uuid-in-uppercase
Patch24: %{name}-handle-arguments-from-init-file
Patch25: %{name}-update-hp-hwtable
Patch26: %{name}-zero-lines-in-print.c
Patch27: %{name}-sles11-valgrind-fixes
Patch28: %{name}-adapt-to-new-sysfs-layout
Patch29: %{name}-basename-return-value
Patch30: %{name}-always-allocate-alias
Patch31: %{name}-use-sys-dev
Patch32: %{name}-rework-sysfs-device-handling
Patch33: %{name}-search-for-correct-hwe
Patch34: %{name}-make-params-local
Patch35: %{name}-allow-zero-paths
Patch36: %{name}-prio-weightedpath
Patch37: %{name}-crash-in-update-multipath
Patch38: %{name}-split-off-IBM-ESS
Patch39: %{name}-reload-map-for-ro-changes
Patch40: %{name}-set-max_fds-parameter-for-multipath
Patch41: %{name}-enhance-error-for-checkers
Patch42: %{name}-fix-weightedpath-merge-error
Patch43: %{name}-remove-kdev_t
Patch44: %{name}-add-missing-unlock-on-exit
Patch45: %{name}-fix-sysfs_attr_get_value
Patch46: %{name}-more-debugging-output
Patch47: %{name}-use-MALLOC-FREE-for-checker
Patch48: %{name}-do-not-reinitialize-prio-and-checker-list
Patch49: %{name}-display-checker-name-on-failure
Patch50: %{name}-dont-run-checkers-for-blocked-devices
Patch51: %{name}-implement-sysfs-attr-set-value
Patch52: %{name}-implement-dev_loss_tmo
Patch53: %{name}-use-default-for-dev_loss_tmo
Patch54: %{name}-print-dm-tables
Patch55: %{name}-shuffle-memarea-init
Patch56: %{name}-start-xdr_setsite
Patch57: %{name}-add-new-MSA-to-hwtable
Patch58: %{name}-quote-variable-in-mkinitrd-setup
Patch59: %{name}-update-dev_loss_tmo-handling
Patch60: %{name}-fix-directio-error-messages
Patch61: %{name}-update-sdev_state-handling
Patch62: %{name}-check-vector-defines
Patch63: %{name}-dont-access-blocked-devices-in-checkerloop
Patch0: %{name}-%{version}-opensuse-11.2.diff.bz2
%description
This package provides the tools to manage multipathed devices by
@ -118,7 +55,7 @@ Authors:
Christophe Varoqui <christophe.varoqui@free.fr>
%package -n kpartx
License: BSD 3-clause (or similar) ; GPL v2 or later ; LGPL v2.1 or later ; Public Domain, Freeware ; MIT License (or similar)
License: BSD 3-clause (or similar) ; GPL v2 or later ; LGPL v2.1 or later ; Public Domain, Freeware ; MIT License (or similar)
Summary: Manages partition tables on device-mapper devices
Group: System/Base
Requires: device-mapper
@ -136,69 +73,6 @@ Authors:
%prep
%setup -n multipath-tools-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%build
# This package failed when testing with -Wl,-as-needed being default.
@ -235,7 +109,8 @@ exit 0
%config /etc/init.d/multipathd
%config /etc/init.d/boot.multipath
%config /etc/udev/rules.d/71-multipath.rules
/lib/multipath
/%{_lib}/libmultipath.so
/%{_lib}/multipath
/sbin/multipath
/sbin/multipathd
%attr (0700, root, root) /var/cache/multipath
@ -263,327 +138,3 @@ exit 0
%{_mandir}/man8/kpartx.8*
%changelog
* Fri Jun 19 2009 coolo@novell.com
- disable as-needed for this package as it fails to build with it
* Mon Jan 26 2009 hare@suse.de
- Don't access blocked devices in checkerloop()
- Check for validity in VECTOR_XXX defines (bnc#469269,bnc#457465)
* Fri Jan 23 2009 hare@suse.de
- Update dev_loss_tmo handling (bnc#458393)
- Fix directio error messages
- Update sdev_state handling
* Mon Jan 19 2009 hare@suse.de
- Add new HP machines to hardware table (bnc#442133)
- Print device-mapper tables for debugging
- Properly quote variables in mkinitrd scripts (bnc#447966)
- shuffle call to memarea_init
- Add xdr_setsite in init scripts (bnc#459529)
* Tue Jan 13 2009 hare@suse.de
- Do not run checkers or prioritizers on blocked devices
(bnc#464155)
- Implement dev_loss_tmo and fast_io_fail_tmo (bnc#464155)
- Use default values for dev_loss_tmo and fast_io_fail_tmo
- Display checker and prio name on failure
- Add more debugging output
* Mon Jan 12 2009 hare@suse.de
- Set max_fds setting for multipath (bnc#457443)
- Enhance error messages for checker and prio loading (bnc#456214)
- Fix merge errors for prio_weightedpath (bnc#441007)
- Fix sysfs_attr_get_value (bnc#456747)
- Do not reinitialize prio and checker lists after config file
has been parsed (bnc#464373)
- Minor cleanups
* Thu Dec 04 2008 hare@suse.de
- Split off IBM ESS hwtable entries (bnc#439763)
- Reload map when device R/O setting changes (bnc#440959)
* Fri Nov 21 2008 hare@suse.de
- Add 'Weighted Paths' prioritizer (bnc#441007)
- Fix crashes in update_multipath
* Thu Nov 20 2008 hare@suse.de
- Valgrind fixes
* Add missing initialisation
* Always allocate memory for alias
* Check return value of basename
- Adapt to new sysfs layout (bnc#435215, bnc#445041)
- Use /sys/dev to speedup reverse lookups
- Rework sysfs device handling (bnc#435215, bnc#438031)
- Search for correct hardware entry during reconfigure (bnc#435688)
- Use local variables for device mapper params
- Allow zero paths for multipath maps
* Mon Nov 17 2008 hare@suse.de
- Update HP hardware table (bnc#442133)
- Zero out lines in print.c (bnc#445023)
* Mon Nov 10 2008 hare@suse.de
- Check for empty mpvecs in mpvec_garbage_collector() (bnc#437245)
- dmraid uuid starts with 'DMRAID' (bnc#439439)
- Handle arguments to multipathd from the init file
* Thu Nov 06 2008 ro@suse.de
- commenting multiline rpm macros is dangerous (read broken)
remove percent sign in commented macro lines
* Mon Nov 03 2008 hare@suse.de
- Use pthread_join() during shutdown to avoid crash (bnc#437245)
- Fixup '%%n' to handle '!' kernel device name syntax (bnc#435172)
- Use correct commandline for cciss scsi_id callouts (bnc#435172)
- Do not check for valid mp context in get_state() (bnc#433659)
- Link directio checker against libaio (bnc#433659)
- Use regmatch when checking for duplicates in hwtable (bnc#439763)
* Mon Oct 27 2008 hare@suse.de
- Patches from mainline:
* Increase bindings file lock timeout
* Fixes for 'show paths format'
* Add 'show wildcards' cli cmd
* Add support for IBM storage devices
- fopen() returns NULL on failure (bnc#432598)
- Read verbosity level from configuration file (bnc#388284)
- kpartx -l does not remove it's loop device (bnc#417266)
- Missing fixes for libprio ontap.c (bnc#426975)
- Increase buffer size in find_loop_by_file (bnc#436428)
- Include SCSI device handler modules for initrd (bnc#431877)
* Fri Sep 26 2008 hare@suse.de
- Implement map resize (FATE#302007)
- Handle cciss devices correctly (bnc#419123)
* Wed Sep 24 2008 ro@suse.de
- use udevadm info instead of udevinfo
* Wed Sep 03 2008 hare@suse.de
- Merge in fixes from upstream:
* Add IBM IPR to hardware table (bnc#419086)
* Add IBM DS4300 to hardware table
* Fix settings for scsi_id changes
- Call mkinitrd_setup during %%post and %%postun (bnc#413709)
* Thu Aug 28 2008 ro@suse.de
- fix init scripts
* Wed Jul 23 2008 hare@suse.de
- Update to version 0.4.8
- Include changes from SLES10
- Include mkinitrd scriptlets
* Wed May 28 2008 hare@suse.de
- Calculate correct partition offset in kpartx (bnc#394658)
* Fri May 09 2008 hare@suse.de
- Fixup kpartx rules (bnc#387667)
* Tue Apr 29 2008 hare@suse.de
- Merge in fixes from upstream
- Merge fixes from SLES10 SP2
* Wed Sep 19 2007 hare@suse.de
- Fixup generated dm_linear udev rules (#218122)
* Thu Aug 30 2007 hare@suse.de
- Rework dm_linear; udev rules should only be
created if the feature was activated (#302422)
* Fri Aug 10 2007 hare@suse.de
- Implement dm_linear (#218122)
* Thu Aug 02 2007 hare@suse.de
- Merge in latest fixes from upstream
- Remove local patches; merge with upstream
- Fix kpartx handling of extended partitions
- Use underscores for partition names (#293792)
* Mon May 21 2007 hare@suse.de
- Rework udev handling
- Split off kpartx package
* Mon May 14 2007 hare@suse.de
- Merge in latest fixes from upstream
- Add all SuSE specific files to git repository.
* Fri May 11 2007 hare@suse.de
- Include latest changes from upstream
- Remove libsysfs (242766)
- Handle extended partitions for kpartx
* Mon Dec 04 2006 dmueller@suse.de
- don't build as root
* Fri Nov 17 2006 hare@suse.de
- integrate upstream fixes
- update udev rule for YaST2 dmraid support (217807])
* Mon Nov 06 2006 hare@suse.de
- Really fixup udev rule (216167).
* Fri Oct 20 2006 ro@suse.de
- make it build
* Mon Sep 25 2006 hare@suse.de
- update to latest fixes from git tree
- remove fixes integrated in upstream
- fixup udev rule (#203688)
* Thu Sep 14 2006 ro@suse.de
- use device-mapper-devel in BuildRequires
* Thu Aug 31 2006 hare@suse.de
- include latest fixes from git tree
- update kpartx_id and udev rules to work
with dmraid.
- Fix return value for multipath -l
* Thu Aug 17 2006 ro@suse.de
- workaround problem in git-patch
normal patch can't do a "rename", so copy file first
* Tue Jul 11 2006 hare@suse.de
- Update to official version 0.4.7
- Refactor git update to apply to 0.4.7
* Wed Jun 28 2006 hare@suse.de
- Remove blacklisting of dasd device node,
use product_blacklist instead (#188688)
* Mon Jun 12 2006 hare@suse.de
- Add 72-multipath-compat.rules to create 'by-name'
symlink again for compability (#183663)
* Fri Jun 02 2006 hare@suse.de
- Merge in fixed from upstream
- Set device-mapper name correctly (#181127)
* Thu Jun 01 2006 hare@suse.de
- Merge in fixes from upstream
- Fixup aliasing handling
- Fix string length in pp_alua
- Use correct regexp patterns for hwtable (#177842)
- Fixup 71-multipath.rules to work correctly with the
updated device-mapper online/offline events (#176516 - LTC23961)
- Add kpartx_id for the updated 71-multipath.rules
* Mon May 22 2006 schwab@suse.de
- Don't strip binaries.
* Tue May 02 2006 hare@suse.de
- Merge in fixes from upstream
- Merged local patches
- Added hds_modular prioritizer
- Remove merged patches
- Allow for setting of maximum number of open files (#149979)
- Implement 'stop' for init scripts
* Mon Apr 10 2006 hare@suse.de
- Lowering priority for pp_tpc
- Split off DS6000 to fixup priority handler (#161347)
* Wed Apr 05 2006 hare@suse.de
- Disable debug messages in pp_tpc.
* Wed Mar 29 2006 hare@suse.de
- Explicitely create partitions at boot time (#159927)
* Thu Mar 23 2006 hare@suse.de
- Add hwtable entry for IBM 3526.
* Tue Mar 14 2006 hare@suse.de
- Fix another typo in mpath_id.
* Tue Mar 14 2006 hare@suse.de
- Fix typo in mpath_id.
* Mon Mar 13 2006 hare@suse.de
- Fix autobuild warnings.
- Include some minor fixed from upstream.
* Thu Mar 09 2006 hare@suse.de
- Add mpath_id program to call kpartx only on multipathed
devices (#149995 - LTC21557).
- Include latest fixes from upstream.
* Wed Feb 08 2006 hare@suse.de
- Add device blacklisting (#85778)
- Further manpage installation fixes (#146179, #147053, #147911)
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Thu Jan 19 2006 hare@suse.de
- Fix manpage installation.
* Tue Jan 17 2006 hare@suse.de
- Include latest git fixes
- Remove old patches which are now upstream
- Add new hwtable entry for shark (#142176)
* Fri Dec 16 2005 hare@suse.de
- Fix dependencies for /etc/init.d/boot.multipath
- Fix kpartx rules to generate proper partition names.
* Wed Dec 07 2005 hare@suse.de
- Update to multipath-tools-0.4.6
- Include latest git fixes
- Port patches from SLES9 SP3
* Mon Oct 31 2005 dmueller@suse.de
- don't build as root
* Mon Sep 05 2005 matz@suse.de
- Fix broken usage of self-defined syscall [#114933].
* Fri Aug 26 2005 hare@suse.de
- Fix kpartx DASD partition support
* Thu Aug 04 2005 hare@suse.de
- Add 'directio' path checker
- Add support for S/390 DASD (PAV enablement).
- Update to package from SLES9
* Thu Jun 23 2005 lmb@suse.de
- LUs with a WWN containing "fd" were blacklisted (#93562).
* Thu Jun 16 2005 lmb@suse.de
- Remove stray newline character from /dev/disk/by-name/ entries
(#85798, #86763)
- Clear /dev/disk/by-name/ on boot. (#85978)
- scsi_id now handles EMC Symmetrix; remove work-around for #86760.
* Wed Jun 15 2005 meissner@suse.de
- use RPM_OPT_FLAGS.
* Mon Jun 13 2005 ro@suse.de
- neededforbuild: udev -> sysfsutils
* Tue Jun 07 2005 lmb@suse.de
- Import fixes from upstream.
- Hardware table updates for IBM ESS and EMC CX (#81688).
- Reinstate paths correctly after failure/restore cycle (#85781,
[#86444]).
- Create map names again and fix segfault in devmap_name (#85798).
* Tue May 24 2005 hare@suse.de
- Fix segmentation fault with EMC Symmetrix (#85614).
- Update EMC Symmetrix entry in hwtable.
* Mon May 23 2005 hare@suse.de
- Add hwtable entry for IBM DS6000. (#63903)
- Do a rescan for devices if multipath command line option is set.
* Fri May 20 2005 hare@suse.de
- Fix devmap_name to use mapname and return proper status (#84748).
* Thu May 12 2005 lmb@suse.de
- Don't complain about default prio callout command (#81695).
- Reflect recent changes in boot.multipath as well as multipathd init
scripts.
- Actually fail paths when they are detected to be failed by multipathd
(#81679).
- killproc/startproc/checkproc can't be used with multipathd because of
the way the daemon switches to its own namespace (#80443).
* Mon May 09 2005 hare@suse.de
- Use proper path checker for SGI TPC arrays.
- Update hwtable entries for SGI TP9400 and SGI TP9500.
- Write correct PID file (#80443).
* Mon Apr 25 2005 lmb@suse.de
- Update to 0.4.4: pp_alua now licensed as GPL (#78628).
- multipath-tools-oom-adj.patch: oom_adj to a valid value.
* Thu Apr 21 2005 lmb@suse.de
- Update to 0.4.4-pre18 which fixes the multipathd to initialize
correctly in the absence of a configuration file (79239).
* Wed Apr 20 2005 lmb@suse.de
- Put multipath cache back into /dev because /var might not be mounted.
- Correct hwtable entry SGI TP9400, TP9500 and IBM 3542.
* Wed Apr 20 2005 lmb@suse.de
- Update to 0.4.4-pre16
- Build against device-mapper.1.01.xx correctly.
* Tue Apr 19 2005 lmb@suse.de
- Build w/o device-mapper update again.
* Mon Apr 18 2005 lmb@suse.de
- Update to 0.4.4-pre14
- Build versus device-mapper-1.01.01 to prevent deadlocks in
kernel-space.
- Fix devmap_name to work with udev.
- Fix startup of multipathd w/o configuration file present.
* Fri Apr 15 2005 lmb@suse.de
- Add path priority checker for EMC CLARiiON and make necessary
adjustments so that it gets called by default (#62491).
- Set the default udev dir to '/dev'
* Fri Apr 15 2005 hare@suse.de
- Fix to allocate default strings (#78056)
- Fix default entry for TPC9500.
* Wed Apr 13 2005 hare@suse.de
- Added pp_alua path priority checker.
- Update to multipath-tools-0.4.4-pre12.
* Mon Apr 11 2005 hare@suse.de
- Update to multipath-tools-0.4.4-pre10.
* Fri Apr 08 2005 hare@suse.de
- Update multipath to handle only true multipath devices (#62491).
- Update kpartx to use the device mapper target name if available.
- Add boot.multipath script for early set up of multipath targets.
* Thu Mar 31 2005 hare@suse.de
- Update devmap_name to select targets by table type (#62493).
* Tue Jan 25 2005 lmb@suse.de
- Update to 0.4.2 and fix some bugs + add support for the extended DM
multipath kernel module. (#47491)
* Thu Nov 11 2004 hare@suse.de
- Fix bugs to make it work on S/390 (#47491).
* Fri Nov 05 2004 hare@suse.de
- Update to version 0.3.6 (#47491).
- Fix multipath init script
- Install configuration file example.
- Install multipathd in /sbin instead of /usr/bin.
* Tue Jul 20 2004 fehr@suse.de
- updated README mp-tools-issues.pdf (see #40640)
* Wed Jun 09 2004 fehr@suse.de
- added pdf with README to package (see #40640)
* Thu Jun 03 2004 fehr@suse.de
- updated to version 0.2.1
- removed patches zero-currpath.patch and rm-newline-in-name.patch
already contained in 0.2.1
* Thu Jun 03 2004 fehr@suse.de
- added patch zero-currpath.patch (see bugzilla #40640)
* Wed May 26 2004 uli@suse.de
- fixed to build on s390x
* Wed May 26 2004 fehr@suse.de
- added patch rm-newline-in-name.patch (see bugzilla #40640)
* Tue May 25 2004 fehr@suse.de
- created initial version of a SuSE package from version 0.2.0 of
multipath tools