Replace 0012-RH-explicitly-disable-dm-udev-sync-support-in-kpartx.patch

with 0012-RH-udev-sync-support.patch
Add udev sync support to kpartx and multipath. In kpartx it is disabled
    unless you use the -s option. Refresh
    0013-RH-add-weighted_prio-prioritizer.patch Refresh
    0021-RHBZ-548874-add-find-multipaths.patch Modify
    0022-RHBZ-557845-RHEL5-style-partitions.patch
kpartx now creates a 2 sector large device for dos extended partitions,
    just like the kernel does on the regular block devices. Add
    0023-RHBZ-557810-emc-invista-config.patch Add
    0024-RHBZ-565933-checker-timeout.patch
Multipath has a new option checker_timeout. If this is not set, all path
    checker functions with explicit timeouts use
    /sys/block/sd<x>/device/timeout. If this is set, they use it instead.
This commit is contained in:
Benjamin Marzinski 2010-02-16 22:59:48 +00:00
parent 814d7d2747
commit 6e6a296670
8 changed files with 914 additions and 68 deletions

View File

@ -1,29 +0,0 @@
From c104e104645fcf271956e174eca9ccbf0e443014 Mon Sep 17 00:00:00 2001
From: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Tue, 20 Oct 2009 15:17:13 +0200
Subject: [PATCH 12/12] RH: explicitly disable dm udev sync support in kpartx
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
:100644 100644 103ed0a... 9619edb... M kpartx/kpartx.c
kpartx/kpartx.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
index 103ed0a..9619edb 100644
--- a/kpartx/kpartx.c
+++ b/kpartx/kpartx.c
@@ -256,6 +256,10 @@ main(int argc, char **argv){
exit(1);
}
+#ifdef DM_COOKIE_MAGIC
+ dm_udev_set_sync_support(0);
+#endif
+
if (dm_prereq(DM_TARGET, 0, 0, 0) && (what == ADD || what == DELETE)) {
fprintf(stderr, "device mapper prerequisites not met\n");
exit(1);
--
1.6.5.1

View File

@ -0,0 +1,362 @@
---
kpartx/devmapper.c | 10 ++++++++--
kpartx/devmapper.h | 4 ++--
kpartx/kpartx.c | 22 ++++++++++++++++------
libmultipath/config.h | 2 ++
libmultipath/configure.c | 2 +-
libmultipath/devmapper.c | 29 +++++++++++++++++++----------
libmultipath/devmapper.h | 8 +++++---
multipath/main.c | 1 +
multipathd/main.c | 1 +
9 files changed, 55 insertions(+), 24 deletions(-)
Index: multipath-tools/kpartx/devmapper.c
===================================================================
--- multipath-tools.orig/kpartx/devmapper.c
+++ multipath-tools/kpartx/devmapper.c
@@ -52,8 +52,10 @@ dm_prereq (char * str, int x, int y, int
}
extern int
-dm_simplecmd (int task, const char *name, int no_flush) {
+dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie) {
int r = 0;
+ int udev_wait_flag = (task == DM_DEVICE_RESUME ||
+ task == DM_DEVICE_REMOVE);
struct dm_task *dmt;
if (!(dmt = dm_task_create(task)))
@@ -68,6 +70,8 @@ dm_simplecmd (int task, const char *name
if (no_flush)
dm_task_no_flush(dmt);
+ if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, 0))
+ goto out;
r = dm_task_run(dmt);
out:
@@ -78,7 +82,7 @@ dm_simplecmd (int task, const char *name
extern int
dm_addmap (int task, const char *name, const char *target,
const char *params, uint64_t size, const char *uuid, int part,
- mode_t mode, uid_t uid, gid_t gid) {
+ mode_t mode, uid_t uid, gid_t gid, uint32_t *cookie) {
int r = 0;
struct dm_task *dmt;
char *prefixed_uuid = NULL;
@@ -113,6 +117,8 @@ dm_addmap (int task, const char *name, c
dm_task_no_open_count(dmt);
+ if (task == DM_DEVICE_CREATE && !dm_task_set_cookie(dmt, cookie, 0))
+ goto addout;
r = dm_task_run (dmt);
addout:
Index: multipath-tools/kpartx/kpartx.c
===================================================================
--- multipath-tools.orig/kpartx/kpartx.c
+++ multipath-tools/kpartx/kpartx.c
@@ -82,7 +82,7 @@ initpts(void)
addpts("sun", read_sun_pt);
}
-static char short_opts[] = "ladgvp:t:";
+static char short_opts[] = "ladgvp:t:s";
/* Used in gpt.c */
int force_gpt=0;
@@ -96,6 +96,7 @@ usage(void) {
printf("\t-p set device name-partition number delimiter\n");
printf("\t-g force GUID partition table (GPT)\n");
printf("\t-v verbose\n");
+ printf("\t-s sync mode. Don't return until the partitions are created\n");
return 1;
}
@@ -198,7 +199,9 @@ main(int argc, char **argv){
int loopro = 0;
int hotplug = 0;
int loopcreated = 0;
+ int sync = 0;
struct stat buf;
+ uint32_t cookie = 0;
initpts();
init_crc32();
@@ -251,11 +254,17 @@ main(int argc, char **argv){
case 'd':
what = DELETE;
break;
+ case 's':
+ sync = 1;
+ break;
default:
usage();
exit(1);
}
+ if (!sync)
+ dm_udev_set_sync_support(0);
+
if (dm_prereq(DM_TARGET, 0, 0, 0) && (what == ADD || what == DELETE)) {
fprintf(stderr, "device mapper prerequisites not met\n");
exit(1);
@@ -413,8 +422,8 @@ main(int argc, char **argv){
if (!slices[j].size || !dm_map_present(partname))
continue;
- if (!dm_simplecmd(DM_DEVICE_REMOVE,
- partname, 0)) {
+ if (!dm_simplecmd(DM_DEVICE_REMOVE, partname,
+ 0, &cookie)) {
r++;
continue;
}
@@ -463,14 +472,14 @@ main(int argc, char **argv){
if (!dm_addmap(op, partname, DM_TARGET, params,
slices[j].size, uuid, j+1,
buf.st_mode & 0777, buf.st_uid,
- buf.st_gid)) {
+ buf.st_gid, &cookie)) {
fprintf(stderr, "create/reload failed on %s\n",
partname);
r++;
}
if (op == DM_DEVICE_RELOAD &&
- !dm_simplecmd(DM_DEVICE_RESUME,
- partname, 1)) {
+ !dm_simplecmd(DM_DEVICE_RESUME, partname,
+ 1, &cookie)) {
fprintf(stderr, "resume failed on %s\n",
partname);
r++;
@@ -557,6 +566,7 @@ main(int argc, char **argv){
if (n > 0)
break;
}
+ dm_udev_wait(cookie);
dm_lib_release();
dm_lib_exit();
Index: multipath-tools/kpartx/devmapper.h
===================================================================
--- multipath-tools.orig/kpartx/devmapper.h
+++ multipath-tools/kpartx/devmapper.h
@@ -3,9 +3,9 @@
#define MKDEV(ma,mi) ((mi & 0xff) | (ma << 8) | ((mi & ~0xff) << 12))
int dm_prereq (char *, int, int, int);
-int dm_simplecmd (int, const char *, int);
+int dm_simplecmd (int, const char *, int, uint32_t *);
int dm_addmap (int, const char *, const char *, const char *, uint64_t,
- const char *, int, mode_t, uid_t, gid_t);
+ const char *, int, mode_t, uid_t, gid_t, uint32_t *);
int dm_map_present (char *);
char * dm_mapname(int major, int minor);
dev_t dm_get_first_dep(char *devname);
Index: multipath-tools/libmultipath/config.h
===================================================================
--- multipath-tools.orig/libmultipath/config.h
+++ multipath-tools/libmultipath/config.h
@@ -2,6 +2,7 @@
#define _CONFIG_H
#include <sys/types.h>
+#include <stdint.h>
#define ORIGIN_DEFAULT 0
#define ORIGIN_CONFIG 1
@@ -84,6 +85,7 @@ struct config {
uid_t uid;
gid_t gid;
mode_t mode;
+ uint32_t cookie;
char * dev;
char * sysfs_dir;
Index: multipath-tools/libmultipath/devmapper.c
===================================================================
--- multipath-tools.orig/libmultipath/devmapper.c
+++ multipath-tools/libmultipath/devmapper.c
@@ -149,8 +149,10 @@ dm_prereq (void)
}
static int
-dm_simplecmd (int task, const char *name, int no_flush) {
+dm_simplecmd (int task, const char *name, int no_flush, int need_sync) {
int r = 0;
+ int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME ||
+ task == DM_DEVICE_REMOVE));
struct dm_task *dmt;
if (!(dmt = dm_task_create (task)))
@@ -166,6 +168,8 @@ dm_simplecmd (int task, const char *name
dm_task_no_flush(dmt); /* for DM_DEVICE_SUSPEND/RESUME */
#endif
+ if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, 0))
+ goto out;
r = dm_task_run (dmt);
out:
@@ -174,13 +178,13 @@ dm_simplecmd (int task, const char *name
}
extern int
-dm_simplecmd_flush (int task, const char *name) {
- return dm_simplecmd(task, name, 0);
+dm_simplecmd_flush (int task, const char *name, int needsync) {
+ return dm_simplecmd(task, name, 0, needsync);
}
extern int
dm_simplecmd_noflush (int task, const char *name) {
- return dm_simplecmd(task, name, 1);
+ return dm_simplecmd(task, name, 1, 1);
}
extern int
@@ -226,6 +230,9 @@ dm_addmap (int task, const char *target,
dm_task_no_open_count(dmt);
+ if (task == DM_DEVICE_CREATE &&
+ !dm_task_set_cookie(dmt, &conf->cookie, 0))
+ goto freeout;
r = dm_task_run (dmt);
freeout:
@@ -249,7 +256,7 @@ _dm_addmap_create (struct multipath *mpp
if (!r && dm_map_present(mpp->alias)) {
condlog(3, "%s: failed to load map (a path might be in use)",
mpp->alias);
- dm_flush_map(mpp->alias);
+ dm_flush_map_nosync(mpp->alias);
}
return r;
}
@@ -529,7 +536,7 @@ out:
}
extern int
-dm_flush_map (const char * mapname)
+_dm_flush_map (const char * mapname, int need_sync)
{
int r;
@@ -539,7 +546,7 @@ dm_flush_map (const char * mapname)
if (dm_type(mapname, TGT_MPATH) <= 0)
return 0; /* nothing to do */
- if (dm_remove_partmaps(mapname))
+ if (dm_remove_partmaps(mapname, need_sync))
return 1;
if (dm_get_opencount(mapname)) {
@@ -547,7 +554,7 @@ dm_flush_map (const char * mapname)
return 1;
}
- r = dm_simplecmd_flush(DM_DEVICE_REMOVE, mapname);
+ r = dm_simplecmd_flush(DM_DEVICE_REMOVE, mapname, need_sync);
if (r) {
condlog(4, "multipath map %s removed", mapname);
@@ -883,7 +890,7 @@ bad:
}
int
-dm_remove_partmaps (const char * mapname)
+dm_remove_partmaps (const char * mapname, int need_sync)
{
struct dm_task *dmt;
struct dm_names *names;
@@ -946,7 +953,7 @@ dm_remove_partmaps (const char * mapname
*/
condlog(4, "partition map %s removed",
names->name);
- dm_simplecmd_flush(DM_DEVICE_REMOVE, names->name);
+ dm_simplecmd_flush(DM_DEVICE_REMOVE, names->name, need_sync);
}
next = names->next;
@@ -1102,6 +1109,8 @@ dm_rename (char * old, char * new)
dm_task_no_open_count(dmt);
+ if (!dm_task_set_cookie(dmt, &conf->cookie, 0))
+ goto out;
if (!dm_task_run(dmt))
goto out;
Index: multipath-tools/libmultipath/devmapper.h
===================================================================
--- multipath-tools.orig/libmultipath/devmapper.h
+++ multipath-tools/libmultipath/devmapper.h
@@ -8,7 +8,7 @@
void dm_init(void);
int dm_prereq (void);
-int dm_simplecmd_flush (int, const char *);
+int dm_simplecmd_flush (int, const char *, int);
int dm_simplecmd_noflush (int, const char *);
int dm_addmap_create (struct multipath *mpp);
int dm_addmap_create_ro (struct multipath *mpp);
@@ -18,7 +18,9 @@ int dm_map_present (const char *);
int dm_get_map(char *, unsigned long long *, char *);
int dm_get_status(char *, char *);
int dm_type(const char *, char *);
-int dm_flush_map (const char *);
+int _dm_flush_map (const char *, int);
+#define dm_flush_map(mapname) _dm_flush_map(mapname, 1)
+#define dm_flush_map_nosync(mapname) _dm_flush_map(mapname, 0)
int dm_flush_maps (void);
int dm_fail_path(char * mapname, char * path);
int dm_reinstate_path(char * mapname, char * path);
@@ -31,7 +33,7 @@ int dm_get_maps (vector mp);
int dm_geteventnr (char *name);
int dm_get_minor (char *name);
char * dm_mapname(int major, int minor);
-int dm_remove_partmaps (const char * mapname);
+int dm_remove_partmaps (const char * mapname, int need_sync);
int dm_get_uuid(char *name, char *uuid);
int dm_get_info (char * mapname, struct dm_info ** dmi);
int dm_rename (char * old, char * new);
Index: multipath-tools/multipath/main.c
===================================================================
--- multipath-tools.orig/multipath/main.c
+++ multipath-tools/multipath/main.c
@@ -454,6 +454,7 @@ main (int argc, char *argv[])
condlog(3, "restart multipath configuration process");
out:
+ dm_udev_wait(conf->cookie);
sysfs_cleanup();
dm_lib_release();
Index: multipath-tools/multipathd/main.c
===================================================================
--- multipath-tools.orig/multipathd/main.c
+++ multipath-tools/multipathd/main.c
@@ -1396,6 +1396,7 @@ child (void * param)
exit(1);
}
conf->daemon = 1;
+ dm_udev_set_sync_support(0);
/*
* fetch and configure both paths and multipaths
*/
Index: multipath-tools/libmultipath/configure.c
===================================================================
--- multipath-tools.orig/libmultipath/configure.c
+++ multipath-tools/libmultipath/configure.c
@@ -373,7 +373,7 @@ domap (struct multipath * mpp)
if (!r)
r = dm_addmap_reload_ro(mpp);
if (r)
- r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias);
+ r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1);
break;
case ACT_RENAME:

View File

@ -1,7 +1,20 @@
Index: multipath-tools-091020/libmultipath/config.c
---
libmultipath/config.c | 10 ++
libmultipath/config.h | 4 +
libmultipath/dict.c | 92 ++++++++++++++++++++---
libmultipath/discovery.c | 56 +++++++-------
libmultipath/prio.h | 1
libmultipath/prioritizers/Makefile | 3
libmultipath/prioritizers/weighted.c | 139 +++++++++++++++++++++++++++++++++++
libmultipath/prioritizers/weighted.h | 8 ++
libmultipath/propsel.c | 11 ++
libmultipath/structs.h | 1
10 files changed, 286 insertions(+), 39 deletions(-)
Index: multipath-tools/libmultipath/config.c
===================================================================
--- multipath-tools-091020.orig/libmultipath/config.c
+++ multipath-tools-091020/libmultipath/config.c
--- multipath-tools.orig/libmultipath/config.c
+++ multipath-tools/libmultipath/config.c
@@ -156,6 +156,9 @@ free_hwe (struct hwentry * hwe)
if (hwe->prio_name)
FREE(hwe->prio_name);
@ -33,11 +46,11 @@ Index: multipath-tools-091020/libmultipath/config.c
merge_str(bl_product);
merge_num(pgpolicy);
merge_num(pgfailback);
Index: multipath-tools-091020/libmultipath/config.h
Index: multipath-tools/libmultipath/config.h
===================================================================
--- multipath-tools-091020.orig/libmultipath/config.h
+++ multipath-tools-091020/libmultipath/config.h
@@ -24,6 +24,7 @@ struct hwentry {
--- multipath-tools.orig/libmultipath/config.h
+++ multipath-tools/libmultipath/config.h
@@ -25,6 +25,7 @@ struct hwentry {
char * selector;
char * checker_name;
char * prio_name;
@ -45,7 +58,7 @@ Index: multipath-tools-091020/libmultipath/config.h
int pgpolicy;
int pgfailback;
@@ -42,6 +43,8 @@ struct mpentry {
@@ -43,6 +44,8 @@ struct mpentry {
char * alias;
char * getuid;
char * selector;
@ -54,7 +67,7 @@ Index: multipath-tools-091020/libmultipath/config.h
int pgpolicy;
int pgfailback;
@@ -95,6 +98,7 @@ struct config {
@@ -97,6 +100,7 @@ struct config {
char * hwhandler;
char * bindings_file;
char * prio_name;
@ -62,10 +75,10 @@ Index: multipath-tools-091020/libmultipath/config.h
char * checker_name;
vector keywords;
Index: multipath-tools-091020/libmultipath/dict.c
Index: multipath-tools/libmultipath/dict.c
===================================================================
--- multipath-tools-091020.orig/libmultipath/dict.c
+++ multipath-tools-091020/libmultipath/dict.c
--- multipath-tools.orig/libmultipath/dict.c
+++ multipath-tools/libmultipath/dict.c
@@ -139,11 +139,23 @@ def_getuid_callout_handler(vector strvec
static int
def_prio_handler(vector strvec)
@ -218,10 +231,10 @@ Index: multipath-tools-091020/libmultipath/dict.c
+ install_keyword("prio", &mp_prio_handler, &snprint_mp_prio);
install_sublevel_end();
}
Index: multipath-tools-091020/libmultipath/discovery.c
Index: multipath-tools/libmultipath/discovery.c
===================================================================
--- multipath-tools-091020.orig/libmultipath/discovery.c
+++ multipath-tools-091020/libmultipath/discovery.c
--- multipath-tools.orig/libmultipath/discovery.c
+++ multipath-tools/libmultipath/discovery.c
@@ -800,30 +800,6 @@ get_state (struct path * pp, int daemon)
}
@ -306,10 +319,10 @@ Index: multipath-tools-091020/libmultipath/discovery.c
return 0;
blank:
Index: multipath-tools-091020/libmultipath/prio.h
Index: multipath-tools/libmultipath/prio.h
===================================================================
--- multipath-tools-091020.orig/libmultipath/prio.h
+++ multipath-tools-091020/libmultipath/prio.h
--- multipath-tools.orig/libmultipath/prio.h
+++ multipath-tools/libmultipath/prio.h
@@ -24,6 +24,7 @@
#define PRIO_NETAPP "netapp"
#define PRIO_RANDOM "random"
@ -318,10 +331,10 @@ Index: multipath-tools-091020/libmultipath/prio.h
/*
* Value used to mark the fact prio was not defined
Index: multipath-tools-091020/libmultipath/prioritizers/Makefile
Index: multipath-tools/libmultipath/prioritizers/Makefile
===================================================================
--- multipath-tools-091020.orig/libmultipath/prioritizers/Makefile
+++ multipath-tools-091020/libmultipath/prioritizers/Makefile
--- multipath-tools.orig/libmultipath/prioritizers/Makefile
+++ multipath-tools/libmultipath/prioritizers/Makefile
@@ -13,7 +13,8 @@ LIBS = \
libprioalua.so \
libpriotpg_pref.so \
@ -332,10 +345,10 @@ Index: multipath-tools-091020/libmultipath/prioritizers/Makefile
CFLAGS += -I..
Index: multipath-tools-091020/libmultipath/prioritizers/weighted.c
Index: multipath-tools/libmultipath/prioritizers/weighted.c
===================================================================
--- /dev/null
+++ multipath-tools-091020/libmultipath/prioritizers/weighted.c
+++ multipath-tools/libmultipath/prioritizers/weighted.c
@@ -0,0 +1,139 @@
+/******************************************************************************
+*******************************************************************************
@ -476,10 +489,10 @@ Index: multipath-tools-091020/libmultipath/prioritizers/weighted.c
+{
+ return prio_weighted(pp);
+}
Index: multipath-tools-091020/libmultipath/propsel.c
Index: multipath-tools/libmultipath/propsel.c
===================================================================
--- multipath-tools-091020.orig/libmultipath/propsel.c
+++ multipath-tools-091020/libmultipath/propsel.c
--- multipath-tools.orig/libmultipath/propsel.c
+++ multipath-tools/libmultipath/propsel.c
@@ -312,14 +312,25 @@ select_getuid (struct path * pp)
extern int
select_prio (struct path * pp)
@ -506,10 +519,10 @@ Index: multipath-tools-091020/libmultipath/propsel.c
condlog(3, "%s: prio = %s (config file default)",
pp->dev, conf->prio_name);
return 0;
Index: multipath-tools-091020/libmultipath/structs.h
Index: multipath-tools/libmultipath/structs.h
===================================================================
--- multipath-tools-091020.orig/libmultipath/structs.h
+++ multipath-tools-091020/libmultipath/structs.h
--- multipath-tools.orig/libmultipath/structs.h
+++ multipath-tools/libmultipath/structs.h
@@ -142,6 +142,7 @@ struct path {
int priority;
int pgindex;
@ -518,10 +531,10 @@ Index: multipath-tools-091020/libmultipath/structs.h
struct prio * prio;
struct checker checker;
struct multipath * mpp;
Index: multipath-tools-091020/libmultipath/prioritizers/weighted.h
Index: multipath-tools/libmultipath/prioritizers/weighted.h
===================================================================
--- /dev/null
+++ multipath-tools-091020/libmultipath/prioritizers/weighted.h
+++ multipath-tools/libmultipath/prioritizers/weighted.h
@@ -0,0 +1,8 @@
+#ifndef _WEIGHTED_H
+#define _WEIGHTED_H

View File

@ -235,7 +235,7 @@ Index: multipath-tools/libmultipath/config.h
===================================================================
--- multipath-tools.orig/libmultipath/config.h
+++ multipath-tools/libmultipath/config.h
@@ -84,6 +84,7 @@ struct config {
@@ -85,6 +85,7 @@ struct config {
int attribute_flags;
int fast_io_fail;
unsigned int dev_loss;

View File

@ -88,7 +88,7 @@ Index: multipath-tools/kpartx/dos.c
- n += read_extended_partition(fd, &p, i, sp+n, ns-n);
+ n += read_extended_partition(fd, &p, sp+n, ns-n);
+ /* hide the extended partition itself */
+ sp[i].size = 0;
+ sp[i].size = 2;
}
}
return n;
@ -96,7 +96,7 @@ Index: multipath-tools/kpartx/kpartx.c
===================================================================
--- multipath-tools.orig/kpartx/kpartx.c
+++ multipath-tools/kpartx/kpartx.c
@@ -184,7 +184,7 @@ get_hotplug_device(void)
@@ -185,7 +185,7 @@ get_hotplug_device(void)
int
main(int argc, char **argv){
@ -105,7 +105,7 @@ Index: multipath-tools/kpartx/kpartx.c
struct slice all;
struct pt *ptp;
enum action what = LIST;
@@ -350,49 +350,30 @@ main(int argc, char **argv){
@@ -355,49 +355,30 @@ main(int argc, char **argv){
else
continue;
@ -169,7 +169,7 @@ Index: multipath-tools/kpartx/kpartx.c
if (loopcreated && S_ISREG (buf.st_mode)) {
if (del_loop(device)) {
@@ -438,16 +419,10 @@ main(int argc, char **argv){
@@ -443,16 +424,10 @@ main(int argc, char **argv){
break;
case ADD:
@ -187,7 +187,7 @@ Index: multipath-tools/kpartx/kpartx.c
if (safe_sprintf(partname, "%s%s%d",
mapname, delim, j+1)) {
fprintf(stderr, "partname too small\n");
@@ -488,70 +463,6 @@ main(int argc, char **argv){
@@ -493,70 +468,6 @@ main(int argc, char **argv){
slices[j].minor, slices[j].size,
DM_TARGET, params);
}

View File

@ -0,0 +1,52 @@
Index: multipath-tools/libmultipath/hwtable.c
===================================================================
--- multipath-tools.orig/libmultipath/hwtable.c
+++ multipath-tools/libmultipath/hwtable.c
@@ -282,6 +282,21 @@ static struct hwentry default_hw[] = {
.checker_name = EMC_CLARIION,
.prio_name = PRIO_EMC,
},
+ {
+ .vendor = "EMC",
+ .product = "Invista",
+ .bl_product = "LUNZ",
+ .getuid = DEFAULT_GETUID,
+ .features = DEFAULT_FEATURES,
+ .hwhandler = DEFAULT_HWHANDLER,
+ .selector = DEFAULT_SELECTOR,
+ .pgpolicy = MULTIBUS,
+ .pgfailback = FAILBACK_UNDEF,
+ .rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = 5,
+ .minio = DEFAULT_MINIO,
+ .prio_name = DEFAULT_PRIO,
+ },
/*
* Fujitsu controller family
*
Index: multipath-tools/multipath.conf.defaults
===================================================================
--- multipath-tools.orig/multipath.conf.defaults
+++ multipath-tools/multipath.conf.defaults
@@ -209,6 +209,21 @@
# prio emc
# }
# device {
+# vendor "EMC"
+# product "Invista"
+# product_blacklist "LUNZ"
+# getuid_callout "/lib/udev/scsi_id --whitelisted --page=pre-spc3-83 --device=/dev/%n"
+# features "0"
+# hardware_handler "0"
+# path_selector "round-robin 0"
+# path_grouping_policy multibus
+# rr_weight uniform
+# no_path_retry 5
+# rr_min_io 1000
+# path_checker tur
+# prio const
+# }
+# device {
# vendor "FSC"
# product "CentricStor"
# getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"

View File

@ -0,0 +1,428 @@
---
libmultipath/checkers.h | 15 +--------------
libmultipath/checkers/emc_clariion.c | 4 ++--
libmultipath/checkers/hp_sw.c | 12 ++++++------
libmultipath/checkers/libsg.c | 5 +++--
libmultipath/checkers/libsg.h | 3 ++-
libmultipath/checkers/rdac.c | 9 +++++----
libmultipath/checkers/readsector0.c | 2 +-
libmultipath/checkers/tur.c | 4 ++--
libmultipath/config.h | 1 +
libmultipath/dict.c | 29 +++++++++++++++++++++++++++++
libmultipath/discovery.c | 27 +++++++++++++++++++++++++++
libmultipath/discovery.h | 1 +
libmultipath/propsel.c | 19 +++++++++++++++++--
multipath.conf.annotated | 9 +++++++++
14 files changed, 106 insertions(+), 34 deletions(-)
Index: multipath-tools/libmultipath/checkers.h
===================================================================
--- multipath-tools.orig/libmultipath/checkers.h
+++ multipath-tools/libmultipath/checkers.h
@@ -69,20 +69,6 @@ enum path_check_state {
#define DEFAULT_CHECKER DIRECTIO
-/*
- * Overloaded storage response time can be very long.
- * SG_IO timouts after DEF_TIMEOUT milliseconds, and checkers interprets this
- * as a path failure. multipathd then proactively evicts the path from the DM
- * multipath table in this case.
- *
- * This generaly snow balls and ends up in full eviction and IO errors for end
- * users. Bad. This may also cause SCSI bus resets, causing disruption for all
- * local and external storage hardware users.
- *
- * Provision a long timeout. Longer than any real-world application would cope
- * with.
- */
-#define DEF_TIMEOUT 300000
#define ASYNC_TIMEOUT_SEC 30
/*
@@ -98,6 +84,7 @@ struct checker {
struct list_head node;
int fd;
int sync;
+ unsigned int timeout;
int disable;
char name[CHECKER_NAME_LEN];
char message[CHECKER_MSG_LEN]; /* comm with callers */
Index: multipath-tools/libmultipath/checkers/emc_clariion.c
===================================================================
--- multipath-tools.orig/libmultipath/checkers/emc_clariion.c
+++ multipath-tools/libmultipath/checkers/emc_clariion.c
@@ -113,7 +113,7 @@ int libcheck_check (struct checker * c)
io_hdr.dxferp = sense_buffer;
io_hdr.cmdp = inqCmdBlk;
io_hdr.sbp = sb;
- io_hdr.timeout = DEF_TIMEOUT;
+ io_hdr.timeout = c->timeout;
io_hdr.pack_id = 0;
if (ioctl(c->fd, SG_IO, &io_hdr) < 0) {
MSG(c, "emc_clariion_checker: sending query command failed");
@@ -182,7 +182,7 @@ int libcheck_check (struct checker * c)
unsigned char buf[4096];
memset(buf, 0, 4096);
- ret = sg_read(c->fd, &buf[0], sbb = &sb[0]);
+ ret = sg_read(c->fd, &buf[0], sbb = &sb[0], c->timeout);
if (ret == PATH_DOWN) {
hexadecimal_to_ascii(ct->wwn, wwnstr);
Index: multipath-tools/libmultipath/checkers/hp_sw.c
===================================================================
--- multipath-tools.orig/libmultipath/checkers/hp_sw.c
+++ multipath-tools/libmultipath/checkers/hp_sw.c
@@ -46,7 +46,7 @@ void libcheck_free (struct checker * c)
static 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, int noisy, unsigned int timeout)
{
unsigned char inqCmdBlk[INQUIRY_CMDLEN] =
{ INQUIRY_CMD, 0, 0, 0, 0, 0 };
@@ -70,7 +70,7 @@ do_inq(int sg_fd, int cmddt, int evpd, u
io_hdr.dxferp = resp;
io_hdr.cmdp = inqCmdBlk;
io_hdr.sbp = sense_b;
- io_hdr.timeout = DEF_TIMEOUT;
+ io_hdr.timeout = timeout;
if (ioctl(sg_fd, SG_IO, &io_hdr) < 0)
return 1;
@@ -98,7 +98,7 @@ do_inq(int sg_fd, int cmddt, int evpd, u
}
static int
-do_tur (int fd)
+do_tur (int fd, unsigned int timeout)
{
unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 };
struct sg_io_hdr io_hdr;
@@ -111,7 +111,7 @@ do_tur (int fd)
io_hdr.dxfer_direction = SG_DXFER_NONE;
io_hdr.cmdp = turCmdBlk;
io_hdr.sbp = sense_buffer;
- io_hdr.timeout = DEF_TIMEOUT;
+ io_hdr.timeout = timeout;
io_hdr.pack_id = 0;
if (ioctl(fd, SG_IO, &io_hdr) < 0)
@@ -128,12 +128,12 @@ libcheck_check (struct checker * c)
{
char buff[MX_ALLOC_LEN];
- if (0 != do_inq(c->fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) {
+ if (0 != do_inq(c->fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0, c->timeout)) {
MSG(c, MSG_HP_SW_DOWN);
return PATH_DOWN;
}
- if (do_tur(c->fd)) {
+ if (do_tur(c->fd, c->timeout)) {
MSG(c, MSG_HP_SW_GHOST);
return PATH_GHOST;
}
Index: multipath-tools/libmultipath/checkers/libsg.c
===================================================================
--- multipath-tools.orig/libmultipath/checkers/libsg.c
+++ multipath-tools/libmultipath/checkers/libsg.c
@@ -11,7 +11,8 @@
#include "../libmultipath/sg_include.h"
int
-sg_read (int sg_fd, unsigned char * buff, unsigned char * senseBuff)
+sg_read (int sg_fd, unsigned char * buff, unsigned char * senseBuff,
+ unsigned int timeout)
{
/* defaults */
int blocks = 1;
@@ -51,7 +52,7 @@ sg_read (int sg_fd, unsigned char * buff
io_hdr.dxferp = buff;
io_hdr.mx_sb_len = SENSE_BUFF_LEN;
io_hdr.sbp = senseBuff;
- io_hdr.timeout = DEF_TIMEOUT;
+ io_hdr.timeout = timeout;
io_hdr.pack_id = (int)start_block;
if (diop && *diop)
io_hdr.flags |= SG_FLAG_DIRECT_IO;
Index: multipath-tools/libmultipath/checkers/libsg.h
===================================================================
--- multipath-tools.orig/libmultipath/checkers/libsg.h
+++ multipath-tools/libmultipath/checkers/libsg.h
@@ -3,6 +3,7 @@
#define SENSE_BUFF_LEN 32
-int sg_read (int sg_fd, unsigned char * buff, unsigned char * senseBuff);
+int sg_read (int sg_fd, unsigned char * buff, unsigned char * senseBuff,
+ unsigned int timeout);
#endif /* _LIBSG_H */
Index: multipath-tools/libmultipath/checkers/rdac.c
===================================================================
--- multipath-tools.orig/libmultipath/checkers/rdac.c
+++ multipath-tools/libmultipath/checkers/rdac.c
@@ -18,7 +18,6 @@
#define INQUIRY_CMDLEN 6
#define INQUIRY_CMD 0x12
#define SENSE_BUFF_LEN 32
-#define RDAC_DEF_TIMEOUT 60000
#define SCSI_CHECK_CONDITION 0x2
#define SCSI_COMMAND_TERMINATED 0x22
#define SG_ERR_DRIVER_SENSE 0x08
@@ -43,7 +42,8 @@ void libcheck_free (struct checker * c)
}
static int
-do_inq(int sg_fd, unsigned int pg_op, void *resp, int mx_resp_len)
+do_inq(int sg_fd, unsigned int pg_op, void *resp, int mx_resp_len,
+ unsigned int timeout)
{
unsigned char inqCmdBlk[INQUIRY_CMDLEN] = { INQUIRY_CMD, 1, 0, 0, 0, 0 };
unsigned char sense_b[SENSE_BUFF_LEN];
@@ -62,7 +62,7 @@ do_inq(int sg_fd, unsigned int pg_op, vo
io_hdr.dxferp = resp;
io_hdr.cmdp = inqCmdBlk;
io_hdr.sbp = sense_b;
- io_hdr.timeout = RDAC_DEF_TIMEOUT;
+ io_hdr.timeout = timeout;
if (ioctl(sg_fd, SG_IO, &io_hdr) < 0)
return 1;
@@ -103,7 +103,8 @@ 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))) {
+ if (0 != do_inq(c->fd, 0xC9, &inq, sizeof(struct volume_access_inq),
+ c->timeout)) {
MSG(c, MSG_RDAC_DOWN);
return PATH_DOWN;
} else {
Index: multipath-tools/libmultipath/checkers/readsector0.c
===================================================================
--- multipath-tools.orig/libmultipath/checkers/readsector0.c
+++ multipath-tools/libmultipath/checkers/readsector0.c
@@ -29,7 +29,7 @@ int libcheck_check (struct checker * c)
unsigned char sbuf[SENSE_BUFF_LEN];
int ret;
- ret = sg_read(c->fd, &buf[0], &sbuf[0]);
+ ret = sg_read(c->fd, &buf[0], &sbuf[0], c->timeout);
switch (ret)
{
Index: multipath-tools/libmultipath/checkers/tur.c
===================================================================
--- multipath-tools.orig/libmultipath/checkers/tur.c
+++ multipath-tools/libmultipath/checkers/tur.c
@@ -63,7 +63,7 @@ retry:
io_hdr.dxferp = (unsigned char *)resp_buffer;
io_hdr.cmdp = inq_cmd;
io_hdr.sbp = sense_buffer;
- io_hdr.timeout = 60; // IOCTL timeout value.
+ io_hdr.timeout = c->timeout; // IOCTL timeout value.
if (ioctl(c->fd, SG_IO, &io_hdr) < 0) {
condlog(0, "SG_IO ioctl failed: %s", strerror(errno));
@@ -148,7 +148,7 @@ libcheck_check (struct checker * c)
io_hdr.dxfer_direction = SG_DXFER_NONE;
io_hdr.cmdp = turCmdBlk;
io_hdr.sbp = sense_buffer;
- io_hdr.timeout = DEF_TIMEOUT;
+ io_hdr.timeout = c->timeout;
io_hdr.pack_id = 0;
if (ioctl(c->fd, SG_IO, &io_hdr) < 0) {
MSG(c, MSG_TUR_DOWN);
Index: multipath-tools/libmultipath/config.h
===================================================================
--- multipath-tools.orig/libmultipath/config.h
+++ multipath-tools/libmultipath/config.h
@@ -80,6 +80,7 @@ struct config {
int max_fds;
int force_reload;
int queue_without_daemon;
+ int checker_timeout;
int daemon;
int flush_on_last_del;
int attribute_flags;
Index: multipath-tools/libmultipath/dict.c
===================================================================
--- multipath-tools.orig/libmultipath/dict.c
+++ multipath-tools/libmultipath/dict.c
@@ -396,6 +396,25 @@ def_queue_without_daemon(vector strvec)
}
static int
+def_checker_timeout_handler(vector strvec)
+{
+ unsigned int checker_timeout;
+ char *buff;
+
+ buff = set_value(strvec);
+ if (!buff)
+ return 1;
+
+ if (sscanf(buff, "%u", &checker_timeout) == 1)
+ conf->checker_timeout = checker_timeout;
+ else
+ conf->checker_timeout = 0;
+
+ free(buff);
+ return 0;
+}
+
+static int
def_pg_timeout_handler(vector strvec)
{
int pg_timeout;
@@ -2068,6 +2087,15 @@ snprint_def_queue_without_daemon (char *
}
static int
+snprint_def_checker_timeout (char *buff, int len, void *data)
+{
+ if (!conf->checker_timeout)
+ return 0;
+
+ return snprintf(buff, len, "%u", conf->checker_timeout);
+}
+
+static int
snprint_def_pg_timeout (char * buff, int len, void * data)
{
if (conf->pg_timeout == DEFAULT_PGTIMEOUT)
@@ -2166,6 +2194,7 @@ init_keywords(void)
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("queue_without_daemon", &def_queue_without_daemon, &snprint_def_queue_without_daemon);
+ install_keyword("checker_timeout", &def_checker_timeout_handler, &snprint_def_checker_timeout);
install_keyword("pg_timeout", &def_pg_timeout_handler, &snprint_def_pg_timeout);
install_keyword("flush_on_last_del", &def_flush_on_last_del_handler, &snprint_def_flush_on_last_del);
install_keyword("user_friendly_names", &names_handler, &snprint_def_user_friendly_names);
Index: multipath-tools/libmultipath/discovery.c
===================================================================
--- multipath-tools.orig/libmultipath/discovery.c
+++ multipath-tools/libmultipath/discovery.c
@@ -164,6 +164,31 @@ sysfs_get_dev (struct sysfs_device * dev
}
int
+sysfs_get_timeout(struct sysfs_device *dev, unsigned int *timeout)
+{
+ char *attr;
+ char attr_path[SYSFS_PATH_SIZE];
+ int r;
+ unsigned int t;
+
+ if (safe_sprintf(attr_path, "%s/device", dev->devpath))
+ return 1;
+
+ attr = sysfs_attr_get_value(dev->devpath, "timeout");
+ if (!attr)
+ return 1;
+
+ r = sscanf(attr, "%u\n", &t);
+
+ if (r != 1)
+ return 1;
+
+ *timeout = t * 1000;
+
+ return 0;
+}
+
+int
sysfs_get_size (struct sysfs_device * dev, unsigned long long * size)
{
char *attr;
@@ -791,6 +816,8 @@ get_state (struct path * pp, int daemon)
return PATH_PENDING;
checker_set_async(c);
}
+ if (!conf->checker_timeout)
+ sysfs_get_timeout(pp->sysdev, &(c->timeout));
state = checker_check(c);
condlog(3, "%s: state = %i", pp->dev, state);
if (state == PATH_DOWN && strlen(checker_message(c)))
Index: multipath-tools/libmultipath/propsel.c
===================================================================
--- multipath-tools.orig/libmultipath/propsel.c
+++ multipath-tools/libmultipath/propsel.c
@@ -16,6 +16,7 @@
#include "defaults.h"
#include "devmapper.h"
#include "prio.h"
+#include "discovery.h"
pgpolicyfn *pgpolicies[] = {
NULL,
@@ -274,17 +275,31 @@ select_checker(struct path *pp)
checker_get(c, pp->hwe->checker_name);
condlog(3, "%s: path checker = %s (controller setting)",
pp->dev, checker_name(c));
- return 0;
+ goto out;
}
if (conf->checker_name) {
checker_get(c, conf->checker_name);
condlog(3, "%s: path checker = %s (config file default)",
pp->dev, checker_name(c));
- return 0;
+ goto out;
}
checker_get(c, DEFAULT_CHECKER);
condlog(3, "%s: path checker = %s (internal default)",
pp->dev, checker_name(c));
+out:
+ if (conf->checker_timeout) {
+ c->timeout = conf->checker_timeout * 1000;
+ condlog(3, "%s: checker timeout = %u ms (config file default)",
+ pp->dev, c->timeout);
+ }
+ else if (sysfs_get_timeout(pp->sysdev, &c->timeout) == 0)
+ condlog(3, "%s: checker timeout = %u ms (sysfs setting)",
+ pp->dev, c->timeout);
+ else {
+ c->timeout = DEF_TIMEOUT;
+ condlog(3, "%s: checker timeout = %u ms (internal default)",
+ pp->dev, c->timeout);
+ }
return 0;
}
Index: multipath-tools/multipath.conf.annotated
===================================================================
--- multipath-tools.orig/multipath.conf.annotated
+++ multipath-tools/multipath.conf.annotated
@@ -202,6 +202,15 @@
# gid disk
#
# #
+# # name : checker_timeout
+# # scope : multipath & multipathd
+# # desc : The timeout to use for path checkers that issue scsi
+# # commands with an explicit timeout, in seconds.
+# # values : n > 0
+# # default : taken from /sys/block/sd<x>/device/timeout
+# checker_timeout 60
+#
+# #
# # name : fast_io_fail_tmo
# # scope : multipath & multipathd
# # desc : The number of seconds the scsi layer will wait after a
Index: multipath-tools/libmultipath/discovery.h
===================================================================
--- multipath-tools.orig/libmultipath/discovery.h
+++ multipath-tools/libmultipath/discovery.h
@@ -36,6 +36,7 @@ int pathinfo (struct path *, vector hwta
struct path * store_pathinfo (vector pathvec, vector hwtable,
char * devname, int flag);
int sysfs_set_scsi_tmo (struct multipath *mpp);
+int sysfs_get_timeout(struct sysfs_device *dev, unsigned int *timeout);
/*
* discovery bitmask

View File

@ -1,7 +1,7 @@
Summary: Tools to manage multipath devices using device-mapper
Name: device-mapper-multipath
Version: 0.4.9
Release: 12%{?dist}
Release: 13%{?dist}
License: GPL+
Group: System Environment/Base
URL: http://christophe.varoqui.free.fr/
@ -24,7 +24,7 @@ Patch1008: 0008-RH-Make-build-system-RH-Fedora-friendly.patch
Patch1009: 0009-RH-multipathd-blacklist-all-by-default.patch
Patch1010: 0010-RH-multipath-rules-udev-changes.patch
Patch1011: 0011-RH-fix-init-script-LSB-headers.patch
Patch1012: 0012-RH-explicitly-disable-dm-udev-sync-support-in-kpartx.patch
Patch1012: 0012-RH-udev-sync-support.patch
Patch1013: 0013-RH-add-weighted_prio-prioritizer.patch
Patch1014: 0014-RH-add-hp_tur-checker.patch
Patch1015: 0015-RH-add-multipathd-count-paths-cmd.patch
@ -35,6 +35,8 @@ Patch1019: 0019-RHBZ-554598-fix-multipath-locking.patch
Patch1020: 0020-RHBZ-554605-fix-manual-failover.patch
Patch1021: 0021-RHBZ-548874-add-find-multipaths.patch
Patch1022: 0022-RHBZ-557845-RHEL5-style-partitions.patch
Patch1023: 0023-RHBZ-557810-emc-invista-config.patch
Patch1024: 0024-RHBZ-565933-checker-timeout.patch
# runtime
Requires: %{name}-libs = %{version}-%{release}
@ -103,6 +105,8 @@ kpartx manages partition creation and removal for device-mapper devices.
%patch1020 -p1
%patch1021 -p1
%patch1022 -p1
%patch1023 -p1
%patch1024 -p1
cp %{SOURCE1} .
%build
@ -180,6 +184,22 @@ fi
%{_mandir}/man8/kpartx.8.gz
%changelog
* Tue Feb 16 2010 Benjamin Marzinski <bmarzins@redhat.com> -0.4.9-13
- Replace 0012-RH-explicitly-disable-dm-udev-sync-support-in-kpartx.patch
with 0012-RH-udev-sync-support.patch
* Add udev sync support to kpartx and multipath. In kpartx it is disabled
unless you use the -s option.
- Refresh 0013-RH-add-weighted_prio-prioritizer.patch
- Refresh 0021-RHBZ-548874-add-find-multipaths.patch
- Modify 0022-RHBZ-557845-RHEL5-style-partitions.patch
* kpartx now creates a 2 sector large device for dos extended
partitions, just like the kernel does on the regular block devices.
- Add 0023-RHBZ-557810-emc-invista-config.patch
- Add 0024-RHBZ-565933-checker-timeout.patch
* Multipath has a new option checker_timeout. If this is not set,
all path checker functions with explicit timeouts use
/sys/block/sd<x>/device/timeout. If this is set, they use it instead.
* Fri Jan 22 2010 Benjamin Marzinski <bmarzins@redhat.com> -0.4.9-12
- Refresh 0001-RH-queue-without-daemon.patch
- Refresh 0002-RH-path-checker.patch