Refresh 0001-RH-queue-without-daemon.patch Refresh

0002-RH-path-checker.patch Modify
    0010-RH-multipath-rules-udev-changes.patch
Fix udev rules to use DM_SBIN_PATH when calling kpartx
install udev rules to /lib/udev/rules.d instead of /etc/udev/rules.d Modify
    0014-RH-add-hp_tur-checker.patch Add
    0003-for-upstream-default-configs.patch Add
    0016-RHBZ-554561-fix-init-error-msg.patch Add
    0017-RHBZ-554592-man-page-note.patch Add
    0018-RHBZ-554596-SUN-6540-config.patch Add
    0019-RHBZ-554598-fix-multipath-locking.patch Add
    0020-RHBZ-554605-fix-manual-failover.patch Add
    0021-RHBZ-548874-add-find-multipaths.patch
Added find_multipaths multipath.conf option
Added /sbin/mpathconf for simple editting of multipath.conf Add
    0022-RHBZ-557845-RHEL5-style-partitions.patch
Make kpartx deal with logical partitions like it did in RHEL5. Don't create
    a dm-device for the extended partition itself. Create the logical
    partitions on top of the dm-device for the whole disk.
This commit is contained in:
Benjamin Marzinski 2010-01-23 01:39:39 +00:00
parent dfebc4dab3
commit 814d7d2747
13 changed files with 1862 additions and 77 deletions

View File

@ -19,11 +19,11 @@ Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
multipathd/main.c | 5 +++++
6 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/libmultipath/config.h b/libmultipath/config.h
index 50a728c..86b1320 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -72,6 +72,7 @@ struct config {
Index: multipath-tools/libmultipath/config.h
===================================================================
--- multipath-tools.orig/libmultipath/config.h
+++ multipath-tools/libmultipath/config.h
@@ -74,6 +74,7 @@ struct config {
int pg_timeout;
int max_fds;
int force_reload;
@ -31,11 +31,11 @@ index 50a728c..86b1320 100644
int daemon;
int flush_on_last_del;
int attribute_flags;
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index ee4de68..7888e8e 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -333,6 +333,28 @@ def_no_path_retry_handler(vector strvec)
Index: multipath-tools/libmultipath/dict.c
===================================================================
--- multipath-tools.orig/libmultipath/dict.c
+++ multipath-tools/libmultipath/dict.c
@@ -362,6 +362,28 @@ def_no_path_retry_handler(vector strvec)
}
static int
@ -64,7 +64,7 @@ index ee4de68..7888e8e 100644
def_pg_timeout_handler(vector strvec)
{
int pg_timeout;
@@ -1846,6 +1868,18 @@ snprint_def_no_path_retry (char * buff, int len, void * data)
@@ -1944,6 +1966,18 @@ snprint_def_no_path_retry (char * buff,
}
static int
@ -83,7 +83,7 @@ index ee4de68..7888e8e 100644
snprint_def_pg_timeout (char * buff, int len, void * data)
{
if (conf->pg_timeout == DEFAULT_PGTIMEOUT)
@@ -1931,6 +1965,7 @@ init_keywords(void)
@@ -2029,6 +2063,7 @@ init_keywords(void)
install_keyword("max_fds", &max_fds_handler, &snprint_max_fds);
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);
@ -91,10 +91,10 @@ index ee4de68..7888e8e 100644
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);
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index afd1246..2e7a0d1 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
Index: multipath-tools/libmultipath/structs.h
===================================================================
--- multipath-tools.orig/libmultipath/structs.h
+++ multipath-tools/libmultipath/structs.h
@@ -63,6 +63,12 @@ enum pgstates {
PGSTATE_ACTIVE
};
@ -108,10 +108,10 @@ index afd1246..2e7a0d1 100644
enum pgtimeouts {
PGTIMEOUT_UNDEF,
PGTIMEOUT_NONE
diff --git a/multipath.conf.annotated b/multipath.conf.annotated
index c222da4..9afa615 100644
--- a/multipath.conf.annotated
+++ b/multipath.conf.annotated
Index: multipath-tools/multipath.conf.annotated
===================================================================
--- multipath-tools.orig/multipath.conf.annotated
+++ multipath-tools/multipath.conf.annotated
@@ -153,6 +153,15 @@
# no_path_retry queue
#
@ -128,10 +128,10 @@ index c222da4..9afa615 100644
# # name : user_friendly_names
# # scope : multipath
# # desc : If set to "yes", using the bindings file
diff --git a/multipath.conf.synthetic b/multipath.conf.synthetic
index 3e0fd6e..44d1329 100644
--- a/multipath.conf.synthetic
+++ b/multipath.conf.synthetic
Index: multipath-tools/multipath.conf.synthetic
===================================================================
--- multipath-tools.orig/multipath.conf.synthetic
+++ multipath-tools/multipath.conf.synthetic
@@ -16,6 +16,7 @@
# rr_weight priorities
# failback immediate
@ -140,10 +140,10 @@ index 3e0fd6e..44d1329 100644
# user_friendly_names no
# mode 644
# uid 0
diff --git a/multipathd/main.c b/multipathd/main.c
index 41a9bd0..90de6df 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
Index: multipath-tools/multipathd/main.c
===================================================================
--- multipath-tools.orig/multipathd/main.c
+++ multipath-tools/multipathd/main.c
@@ -1334,6 +1334,8 @@ child (void * param)
pthread_t check_thr, uevent_thr, uxlsnr_thr;
pthread_attr_t log_attr, misc_attr;
@ -163,6 +163,3 @@ index 41a9bd0..90de6df 100644
remove_maps_and_stop_waiters(vecs);
free_pathvec(vecs->pathvec, FREE_PATHS);
--
1.6.5.1

View File

@ -15,10 +15,10 @@ Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
multipathd/main.c | 21 +-------------
4 files changed, 52 insertions(+), 34 deletions(-)
diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c
index e06dc52..47107a2 100644
--- a/libmultipath/checkers/tur.c
+++ b/libmultipath/checkers/tur.c
Index: multipath-tools/libmultipath/checkers/tur.c
===================================================================
--- multipath-tools.orig/libmultipath/checkers/tur.c
+++ multipath-tools/libmultipath/checkers/tur.c
@@ -69,7 +69,6 @@ libcheck_check (struct checker * c)
case DID_NO_CONNECT:
case DID_BAD_TARGET:
@ -27,11 +27,11 @@ index e06dc52..47107a2 100644
case DID_TRANSPORT_FAILFAST:
break;
default:
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 98d1618..00aa5ea 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -579,10 +579,9 @@ struct sysfs_device *sysfs_device_from_path(struct path *pp)
Index: multipath-tools/libmultipath/discovery.c
===================================================================
--- multipath-tools.orig/libmultipath/discovery.c
+++ multipath-tools/libmultipath/discovery.c
@@ -616,10 +616,9 @@ struct sysfs_device *sysfs_device_from_p
}
int
@ -43,7 +43,7 @@ index 98d1618..00aa5ea 100644
pp->sysdev = sysfs_device_from_path(pp);
if (!pp->sysdev) {
@@ -604,6 +603,16 @@ path_offline (struct path * pp)
@@ -641,6 +640,16 @@ path_offline (struct path * pp)
return 1;
condlog(3, "%s: state = %s", pp->dev, buff);
@ -60,7 +60,7 @@ index 98d1618..00aa5ea 100644
if (!strncmp(buff, "offline", 7)) {
pp->offline = 1;
@@ -613,6 +622,21 @@ path_offline (struct path * pp)
@@ -650,6 +659,21 @@ path_offline (struct path * pp)
return 0;
}
@ -82,7 +82,7 @@ index 98d1618..00aa5ea 100644
extern int
sysfs_pathinfo(struct path * pp)
{
@@ -699,36 +723,43 @@ cciss_ioctl_pathinfo (struct path * pp, int mask)
@@ -736,36 +760,43 @@ cciss_ioctl_pathinfo (struct path * pp,
return 0;
}
@ -117,15 +117,15 @@ index 98d1618..00aa5ea 100644
- pp->state = PATH_DOWN;
- return 0;
+ return PATH_DOWN;
+ }
+ if (daemon) {
+ if (path_blocked(pp))
+ return PATH_PENDING;
+ checker_set_async(c);
}
- pp->state = checker_check(c);
- condlog(3, "%s: state = %i", pp->dev, pp->state);
- if (pp->state == PATH_DOWN && strlen(checker_message(c)))
+ if (daemon) {
+ if (path_blocked(pp))
+ return PATH_PENDING;
+ checker_set_async(c);
+ }
+ state = checker_check(c);
+ condlog(3, "%s: state = %i", pp->dev, state);
+ if (state == PATH_DOWN && strlen(checker_message(c)))
@ -136,7 +136,7 @@ index 98d1618..00aa5ea 100644
}
static int
@@ -813,8 +844,11 @@ pathinfo (struct path *pp, vector hwtable, int mask)
@@ -850,8 +881,11 @@ pathinfo (struct path *pp, vector hwtabl
cciss_ioctl_pathinfo(pp, mask))
goto blank;
@ -150,11 +150,11 @@ index 98d1618..00aa5ea 100644
/*
* Retrieve path priority, even for PATH_DOWN paths if it has never
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index 7283f36..17cd4af 100644
--- a/libmultipath/discovery.h
+++ b/libmultipath/discovery.h
@@ -30,6 +30,8 @@ int path_discovery (vector pathvec, struct config * conf, int flag);
Index: multipath-tools/libmultipath/discovery.h
===================================================================
--- multipath-tools.orig/libmultipath/discovery.h
+++ multipath-tools/libmultipath/discovery.h
@@ -30,6 +30,8 @@ int path_discovery (vector pathvec, stru
int do_tur (char *);
int devt2devname (char *, char *);
int path_offline (struct path *);
@ -163,11 +163,11 @@ index 7283f36..17cd4af 100644
int pathinfo (struct path *, vector hwtable, int mask);
struct path * store_pathinfo (vector pathvec, vector hwtable,
char * devname, int flag);
diff --git a/multipathd/main.c b/multipathd/main.c
index 90de6df..5d3625a 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -908,26 +908,9 @@ check_path (struct vectors * vecs, struct path * pp)
Index: multipath-tools/multipathd/main.c
===================================================================
--- multipath-tools.orig/multipathd/main.c
+++ multipath-tools/multipathd/main.c
@@ -908,26 +908,9 @@ check_path (struct vectors * vecs, struc
*/
pp->tick = conf->checkint;
@ -196,6 +196,3 @@ index 90de6df..5d3625a 100644
condlog(2, "%s: unusable path", pp->dev);
pathinfo(pp, conf->hwtable, 0);
return;
--
1.6.5.1

View File

@ -0,0 +1,56 @@
Index: multipath-tools/libmultipath/hwtable.c
===================================================================
--- multipath-tools.orig/libmultipath/hwtable.c
+++ multipath-tools/libmultipath/hwtable.c
@@ -425,6 +425,21 @@ static struct hwentry default_hw[] = {
.prio_name = PRIO_RDAC,
},
{
+ .vendor = "IBM",
+ .product = "1745|1746",
+ .getuid = DEFAULT_GETUID,
+ .features = "2 pg_init_retries 50",
+ .hwhandler = "1 rdac",
+ .selector = DEFAULT_SELECTOR,
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
+ .rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = 15,
+ .minio = DEFAULT_MINIO,
+ .checker_name = RDAC,
+ .prio_name = PRIO_RDAC,
+ },
+ {
/* IBM DS4700 */
.vendor = "IBM",
.product = "1814",
@@ -661,12 +676,13 @@ static struct hwentry default_hw[] = {
.vendor = "DELL",
.product = "MD3000",
.getuid = DEFAULT_GETUID,
- .features = "1 queue_if_no_path",
+ .features = "2 pg_init_retries 50",
.hwhandler = "1 rdac",
.selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = 15,
.minio = DEFAULT_MINIO,
.checker_name = RDAC,
.prio_name = PRIO_RDAC,
@@ -676,12 +692,13 @@ static struct hwentry default_hw[] = {
.vendor = "DELL",
.product = "MD3000i",
.getuid = DEFAULT_GETUID,
- .features = "1 queue_if_no_path",
+ .features = "2 pg_init_retries 50",
.hwhandler = "1 rdac",
.selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = 15,
.minio = DEFAULT_MINIO,
.checker_name = RDAC,
.prio_name = PRIO_RDAC,

View File

@ -6,13 +6,14 @@ Subject: [PATCH 10/12] RH: multipath rules + udev changes
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
:100644 100644 ac97749... 064196d... M multipath/multipath.rules
multipath/Makefile | 6 +++---
multipath/multipath.rules | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/multipath/multipath.rules b/multipath/multipath.rules
index ac97749..064196d 100644
--- a/multipath/multipath.rules
+++ b/multipath/multipath.rules
Index: multipath-tools/multipath/multipath.rules
===================================================================
--- multipath-tools.orig/multipath/multipath.rules
+++ multipath-tools/multipath/multipath.rules
@@ -1,7 +1,11 @@
-#
-# udev rules for multipathing.
@ -30,8 +31,28 @@ index ac97749..064196d 100644
+ENV{DM_SUSPENDED}=="1", GOTO="end_mpath"
+ENV{DM_UUID}!="mpath-?*", GOTO="end_mpath"
+ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath"
+RUN+="/sbin/kpartx -a -p p $tempnode"
+RUN+="$env{DM_SBIN_PATH}/kpartx -a -p p $tempnode"
+LABEL="end_mpath"
--
1.6.5.1
Index: multipath-tools/multipath/Makefile
===================================================================
--- multipath-tools.orig/multipath/Makefile
+++ multipath-tools/multipath/Makefile
@@ -21,15 +21,15 @@ $(EXEC): $(OBJS)
install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
- $(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d
- $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/etc/udev/rules.d/
+ $(INSTALL_PROGRAM) -d $(DESTDIR)/lib/udev/rules.d
+ $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/40-multipath.rules
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
$(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir)
uninstall:
- rm $(DESTDIR)/etc/udev/rules.d/multipath.rules
+ rm $(DESTDIR)/lib/udev/rules.d/multipath.rules
rm $(DESTDIR)$(bindir)/$(EXEC)
rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz

View File

@ -1,8 +1,9 @@
---
libmultipath/checkers.h | 3 +
libmultipath/checkers/Makefile | 4 +
libmultipath/checkers/tur.c | 110 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 117 insertions(+)
libmultipath/checkers/tur.c | 111 +++++++++++++++++++++++++++++++++++++++++
multipath.conf.annotated | 5 +
4 files changed, 121 insertions(+), 2 deletions(-)
Index: multipath-tools/libmultipath/checkers.h
===================================================================
@ -205,3 +206,26 @@ Index: multipath-tools/libmultipath/checkers/tur.c
MSG(c, MSG_TUR_UP);
return PATH_UP;
}
Index: multipath-tools/multipath.conf.annotated
===================================================================
--- multipath-tools.orig/multipath.conf.annotated
+++ multipath-tools/multipath.conf.annotated
@@ -86,7 +86,8 @@
# # name : path_checker, checker
# # scope : multipath & multipathd
# # desc : the default method used to determine the paths' state
-# # values : readsector0|tur|emc_clariion|hp_sw|directio|rdac|cciss_tur
+# # values : readsector0|tur|emc_clariion|hp_sw|directio|rdac|
+# cciss_tur|hp_tur
# # default : directio
# #
# path_checker directio
@@ -456,7 +457,7 @@
# # scope : multipathd
# # desc : path checking alorithm to use to check path state
# # values : readsector0|tur|emc_clariion|hp_sw|directio|rdac|
-# # cciss_tur
+# # cciss_tur|hp_tur
# #
# path_checker directio
#

View File

@ -0,0 +1,23 @@
---
multipathd/multipathd.init.redhat | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Index: multipath-tools/multipathd/multipathd.init.redhat
===================================================================
--- multipath-tools.orig/multipathd/multipathd.init.redhat
+++ multipath-tools/multipathd/multipathd.init.redhat
@@ -75,9 +75,11 @@ start() {
stop() {
root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/mtab)
- dm_num=`dmsetup info -c --noheadings -o minor $root_dev`
- root_dm_device="dm-$dm_num"
- [ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device
+ dm_num=`dmsetup info -c --noheadings -o minor $root_dev 2> /dev/null`
+ if [ $? -eq 0 ]; then
+ root_dm_device="dm-$dm_num"
+ [ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device
+ fi
echo -n $"Stopping $prog daemon: "
killproc $DAEMON

View File

@ -0,0 +1,17 @@
---
multipath/multipath.8 | 2 ++
1 file changed, 2 insertions(+)
Index: multipath-tools/multipath/multipath.8
===================================================================
--- multipath-tools.orig/multipath/multipath.8
+++ multipath-tools/multipath/multipath.8
@@ -75,6 +75,8 @@ is in.
is in the /dev/sdb (as shown by udev in the $DEVNAME variable) or major:minor format.
.I device
may alternatively be a multipath mapname
+.SH NOTES
+a map may be unused if, eg, the file system on it is not mounted or there are no open file descriptors against the device file, as in a raw device.
.SH "SEE ALSO"
.BR udev (8),
.BR dmsetup (8)

View File

@ -0,0 +1,57 @@
---
libmultipath/hwtable.c | 16 ++++++++++++++++
multipath.conf.defaults | 16 ++++++++++++++++
2 files changed, 32 insertions(+)
Index: multipath-tools/libmultipath/hwtable.c
===================================================================
--- multipath-tools.orig/libmultipath/hwtable.c
+++ multipath-tools/libmultipath/hwtable.c
@@ -959,6 +959,22 @@ static struct hwentry default_hw[] = {
.checker_name = RDAC,
.prio_name = PRIO_RDAC,
},
+ {
+ .vendor = "STK",
+ .product = "FLEXLINE 380",
+ .bl_product = "Universal Xport",
+ .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,
+ },
/*
* EOL
*/
Index: multipath-tools/multipath.conf.defaults
===================================================================
--- multipath-tools.orig/multipath.conf.defaults
+++ multipath-tools/multipath.conf.defaults
@@ -571,4 +571,20 @@
# path_checker rdac
# prio rdac
# }
+# device {
+# vendor "STK"
+# product "FLEXLINE 380"
+# product_blacklist "Universal Xport"
+# getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
+# features "0"
+# hardware_handler "1 rdac"
+# path_selector "round-robin 0"
+# path_grouping_policy group_by_prio
+# failback immediate
+# rr_weight uniform
+# no_path_retry queue
+# rr_min_io 1000
+# path_checker rdac
+# prio rdac
+# }
#}

View File

@ -0,0 +1,43 @@
---
libmultipath/configure.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
Index: multipath-tools/libmultipath/configure.c
===================================================================
--- multipath-tools.orig/libmultipath/configure.c
+++ multipath-tools/libmultipath/configure.c
@@ -284,6 +284,7 @@ lock_multipath (struct multipath * mpp,
struct pathgroup * pgp;
struct path * pp;
int i, j;
+ int x, y;
if (!mpp || !mpp->pg)
return 0;
@@ -294,12 +295,25 @@ lock_multipath (struct multipath * mpp,
vector_foreach_slot(pgp->paths, pp, j) {
if (lock && flock(pp->fd, LOCK_EX | LOCK_NB) &&
errno == EWOULDBLOCK)
- return 1;
+ goto fail;
else if (!lock)
flock(pp->fd, LOCK_UN);
}
}
return 0;
+fail:
+ vector_foreach_slot (mpp->pg, pgp, x) {
+ if (x > i)
+ return 1;
+ if (!pgp->paths)
+ continue;
+ vector_foreach_slot(pgp->paths, pp, y) {
+ if (x == i && y > j)
+ return 1;
+ flock(pp->fd, LOCK_UN);
+ }
+ }
+ return 1;
}
/*

View File

@ -0,0 +1,52 @@
---
libmultipath/pgpolicies.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
Index: multipath-tools/libmultipath/pgpolicies.c
===================================================================
--- multipath-tools.orig/libmultipath/pgpolicies.c
+++ multipath-tools/libmultipath/pgpolicies.c
@@ -205,7 +205,8 @@ out:
extern int
one_path_per_group (struct multipath * mp)
{
- int i;
+ int i, j;
+ unsigned int prio;
struct path * pp;
struct pathgroup * pgp;
@@ -217,16 +218,30 @@ one_path_per_group (struct multipath * m
for (i = 0; i < VECTOR_SIZE(mp->paths); i++) {
pp = VECTOR_SLOT(mp->paths, i);
+ prio = pp->priority;
+
+ vector_foreach_slot(mp->pg, pgp, j) {
+ pp = VECTOR_SLOT(pgp->paths, 0);
+
+ if (prio > pp->priority)
+ break;
+ }
+
pgp = alloc_pathgroup();
if (!pgp)
goto out;
- if (store_pathgroup(mp->pg, pgp))
+ if (store_path(pgp->paths, VECTOR_SLOT(mp->paths, i)))
goto out;
- if (store_path(pgp->paths, pp))
- goto out;
+ if (j < VECTOR_SIZE(mp->pg)) {
+ if (!vector_insert_slot(mp->pg, j, pgp))
+ goto out;
+ } else {
+ if (store_pathgroup(mp->pg, pgp))
+ goto out;
+ }
}
free_pathvec(mp->paths, KEEP_PATHS);
mp->paths = NULL;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,325 @@
---
kpartx/bsd.c | 35 ----------------
kpartx/dos.c | 7 +--
kpartx/kpartx.c | 121 +++++++-------------------------------------------------
kpartx/kpartx.h | 1
kpartx/sun.c | 35 ----------------
5 files changed, 24 insertions(+), 175 deletions(-)
Index: multipath-tools/kpartx/bsd.c
===================================================================
--- multipath-tools.orig/kpartx/bsd.c
+++ multipath-tools/kpartx/bsd.c
@@ -50,10 +50,10 @@ int
read_bsd_pt(int fd, struct slice all, struct slice *sp, int ns) {
struct bsd_disklabel *l;
struct bsd_partition *p;
- unsigned int offset = all.start, end;
+ unsigned int offset = all.start;
int max_partitions;
char *bp;
- int n = 0, i, j;
+ int n = 0;
bp = getblock(fd, offset+1); /* 1 sector suffices */
if (bp == NULL)
@@ -79,36 +79,5 @@ read_bsd_pt(int fd, struct slice all, st
break;
}
}
- /*
- * Convention has it that the bsd disklabel will always have
- * the 'c' partition spanning the entire disk.
- * So we have to check for contained slices.
- */
- for(i = 0; i < n; i++) {
- if (sp[i].size == 0)
- continue;
-
- end = sp[i].start + sp[i].size;
- for(j = 0; j < n; j ++) {
- if ( i == j )
- continue;
- if (sp[j].size == 0)
- continue;
-
- if (sp[i].start < sp[j].start) {
- if (end > sp[j].start &&
- end < sp[j].start + sp[j].size) {
- /* Invalid slice */
- fprintf(stderr,
- "bsd_disklabel: slice %d overlaps with %d\n", i , j);
- sp[i].size = 0;
- }
- } else {
- if (end <= sp[j].start + sp[j].size) {
- sp[i].container = j + 1;
- }
- }
- }
- }
return n;
}
Index: multipath-tools/kpartx/dos.c
===================================================================
--- multipath-tools.orig/kpartx/dos.c
+++ multipath-tools/kpartx/dos.c
@@ -16,7 +16,7 @@ is_extended(int type) {
}
static int
-read_extended_partition(int fd, struct partition *ep, int en,
+read_extended_partition(int fd, struct partition *ep,
struct slice *sp, int ns)
{
struct partition p;
@@ -53,7 +53,6 @@ read_extended_partition(int fd, struct p
if (n < ns) {
sp[n].start = here + le32_to_cpu(p.start_sect);
sp[n].size = le32_to_cpu(p.nr_sects);
- sp[n].container = en + 1;
n++;
} else {
fprintf(stderr,
@@ -98,7 +97,9 @@ read_dos_pt(int fd, struct slice all, st
break;
}
if (is_extended(p.sys_type)) {
- 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;
}
}
return n;
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)
int
main(int argc, char **argv){
- int fd, i, j, m, n, op, off, arg, c, d;
+ int fd, i, j, k, n, op, off, arg;
struct slice all;
struct pt *ptp;
enum action what = LIST;
@@ -350,49 +350,30 @@ main(int argc, char **argv){
else
continue;
+ /*
+ * test for overlap, as in the case of an extended partition
+ * zero their size to avoid mapping
+ */
+ for (j = 0; j < n; j++) {
+ for (k = j + 1; k < n; k++) {
+ if (slices[k].start > slices[j].start &&
+ slices[k].start < slices[j].start +
+ slices[j].size)
+ slices[j].size = 0;
+ }
+ }
+
switch(what) {
case LIST:
- for (j = 0, c = 0, m = 0; j < n; j++) {
+ for (j = 0; j < n; j++) {
if (slices[j].size == 0)
continue;
- if (slices[j].container > 0) {
- c++;
- continue;
- }
-
- slices[j].minor = m++;
printf("%s%s%d : 0 %" PRIu64 " %s %" PRIu64"\n",
mapname, delim, j+1,
slices[j].size, device,
slices[j].start);
}
- /* Loop to resolve contained slices */
- d = c;
- while (c) {
- for (j = 0; j < n; j++) {
- uint64_t start;
- int k = slices[j].container - 1;
-
- if (slices[j].size == 0)
- continue;
- if (slices[j].minor > 0)
- continue;
- if (slices[j].container == 0)
- continue;
- slices[j].minor = m++;
-
- start = slices[j].start - slices[k].start;
- printf("%s%s%d : 0 %" PRIu64 " /dev/dm-%d %" PRIu64 "\n",
- mapname, delim, j+1,
- slices[j].size,
- slices[k].minor, start);
- c--;
- }
- /* Terminate loop if nothing more to resolve */
- if (d == c)
- break;
- }
if (loopcreated && S_ISREG (buf.st_mode)) {
if (del_loop(device)) {
@@ -438,16 +419,10 @@ main(int argc, char **argv){
break;
case ADD:
- for (j = 0, c = 0; j < n; j++) {
+ for (j = 0; j < n; j++) {
if (slices[j].size == 0)
continue;
- /* Skip all contained slices */
- if (slices[j].container > 0) {
- c++;
- continue;
- }
-
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){
slices[j].minor, slices[j].size,
DM_TARGET, params);
}
- /* Loop to resolve contained slices */
- d = c;
- while (c) {
- for (j = 0; j < n; j++) {
- uint64_t start;
- int k = slices[j].container - 1;
-
- if (slices[j].size == 0)
- continue;
-
- /* Skip all existing slices */
- if (slices[j].minor > 0)
- continue;
-
- /* Skip all simple slices */
- if (slices[j].container == 0)
- continue;
-
- /* Check container slice */
- if (slices[k].size == 0)
- fprintf(stderr, "Invalid slice %d\n",
- k);
-
- if (safe_sprintf(partname, "%s%s%d",
- mapname, delim, j+1)) {
- fprintf(stderr, "partname too small\n");
- exit(1);
- }
- strip_slash(partname);
-
- start = slices[j].start - slices[k].start;
- if (safe_sprintf(params, "%d:%d %" PRIu64,
- slices[k].major,
- slices[k].minor,
- start)) {
- fprintf(stderr, "params too small\n");
- exit(1);
- }
-
- op = (dm_map_present(partname) ?
- DM_DEVICE_RELOAD : DM_DEVICE_CREATE);
-
- dm_addmap(op, partname, DM_TARGET, params,
- slices[j].size, uuid, j+1,
- buf.st_mode & 0777,
- buf.st_uid, buf.st_gid);
-
- if (op == DM_DEVICE_RELOAD)
- dm_simplecmd(DM_DEVICE_RESUME,
- partname, 1);
-
- dm_devn(partname, &slices[j].major,
- &slices[j].minor);
-
- if (verbose)
- printf("add map %s : 0 %" PRIu64 " %s %s\n",
- partname, slices[j].size,
- DM_TARGET, params);
- c--;
- }
- /* Terminate loop */
- if (d == c)
- break;
- }
break;
default:
Index: multipath-tools/kpartx/kpartx.h
===================================================================
--- multipath-tools.orig/kpartx/kpartx.h
+++ multipath-tools/kpartx/kpartx.h
@@ -24,7 +24,6 @@
struct slice {
uint64_t start;
uint64_t size;
- int container;
int major;
int minor;
};
Index: multipath-tools/kpartx/sun.c
===================================================================
--- multipath-tools.orig/kpartx/sun.c
+++ multipath-tools/kpartx/sun.c
@@ -62,8 +62,8 @@ int
read_sun_pt(int fd, struct slice all, struct slice *sp, int ns) {
struct sun_disk_label *l;
struct sun_raw_part *s;
- unsigned int offset = all.start, end;
- int i, j, n;
+ unsigned int offset = all.start;
+ int i, n;
char *bp;
bp = getblock(fd, offset);
@@ -95,37 +95,6 @@ read_sun_pt(int fd, struct slice all, st
break;
}
}
- /*
- * Convention has it that the SUN disklabel will always have
- * the 'c' partition spanning the entire disk.
- * So we have to check for contained slices.
- */
- for(i = 0; i < SUN_DISK_MAXPARTITIONS; i++) {
- if (sp[i].size == 0)
- continue;
-
- end = sp[i].start + sp[i].size;
- for(j = 0; j < SUN_DISK_MAXPARTITIONS; j ++) {
- if ( i == j )
- continue;
- if (sp[j].size == 0)
- continue;
-
- if (sp[i].start < sp[j].start) {
- if (end > sp[j].start &&
- end < sp[j].start + sp[j].size) {
- /* Invalid slice */
- fprintf(stderr,
- "sun_disklabel: slice %d overlaps with %d\n", i , j);
- sp[i].size = 0;
- }
- } else {
- if (end <= sp[j].start + sp[j].size) {
- sp[i].container = j + 1;
- }
- }
- }
- }
return n;
}

View File

@ -1,7 +1,7 @@
Summary: Tools to manage multipath devices using device-mapper
Name: device-mapper-multipath
Version: 0.4.9
Release: 11%{?dist}
Release: 12%{?dist}
License: GPL+
Group: System Environment/Base
URL: http://christophe.varoqui.free.fr/
@ -11,6 +11,7 @@ Source1: multipath.conf
# patch that should go upstream
Patch1: 0001-for-upstream-add-tpg_pref-prioritizer.patch
Patch2: 0002-for-upstream-add-tmo-config-options.patch
Patch3: 0003-for-upstream-default-configs.patch
# local patches
Patch1001: 0001-RH-queue-without-daemon.patch
Patch1002: 0002-RH-path-checker.patch
@ -27,6 +28,13 @@ Patch1012: 0012-RH-explicitly-disable-dm-udev-sync-support-in-kpartx.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
Patch1016: 0016-RHBZ-554561-fix-init-error-msg.patch
Patch1017: 0017-RHBZ-554592-man-page-note.patch
Patch1018: 0018-RHBZ-554596-SUN-6540-config.patch
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
# runtime
Requires: %{name}-libs = %{version}-%{release}
@ -72,6 +80,7 @@ kpartx manages partition creation and removal for device-mapper devices.
%setup -q -n multipath-tools
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
@ -87,6 +96,13 @@ kpartx manages partition creation and removal for device-mapper devices.
%patch1013 -p1
%patch1014 -p1
%patch1015 -p1
%patch1016 -p1
%patch1017 -p1
%patch1018 -p1
%patch1019 -p1
%patch1020 -p1
%patch1021 -p1
%patch1022 -p1
cp %{SOURCE1} .
%build
@ -108,8 +124,6 @@ make install \
# tree fix up
# install -m 0644 %{SOURCE1} %{buildroot}/etc/multipath.conf
install -d %{buildroot}/etc/multipath
mv %{buildroot}/etc/udev/rules.d/multipath.rules \
%{buildroot}/etc/udev/rules.d/40-multipath.rules
%clean
rm -rf %{buildroot}
@ -138,11 +152,12 @@ fi
%{_sbindir}/multipath
%{_sbindir}/multipathd
%{_sbindir}/cciss_id
%{_sbindir}/mpathconf
%{_initrddir}/multipathd
%{_mandir}/man5/multipath.conf.5.gz
%{_mandir}/man8/multipath.8.gz
%{_mandir}/man8/multipathd.8.gz
%config /etc/udev/rules.d/40-multipath.rules
%config /lib/udev/rules.d/40-multipath.rules
%doc AUTHOR COPYING FAQ
%doc multipath.conf multipath.conf.annotated
%doc multipath.conf.defaults multipath.conf.synthetic
@ -165,6 +180,27 @@ fi
%{_mandir}/man8/kpartx.8.gz
%changelog
* 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
- Modify 0010-RH-multipath-rules-udev-changes.patch
* Fix udev rules to use DM_SBIN_PATH when calling kpartx
* install udev rules to /lib/udev/rules.d instead of /etc/udev/rules.d
- Modify 0014-RH-add-hp_tur-checker.patch
- Add 0003-for-upstream-default-configs.patch
- Add 0016-RHBZ-554561-fix-init-error-msg.patch
- Add 0017-RHBZ-554592-man-page-note.patch
- Add 0018-RHBZ-554596-SUN-6540-config.patch
- Add 0019-RHBZ-554598-fix-multipath-locking.patch
- Add 0020-RHBZ-554605-fix-manual-failover.patch
- Add 0021-RHBZ-548874-add-find-multipaths.patch
* Added find_multipaths multipath.conf option
* Added /sbin/mpathconf for simple editting of multipath.conf
- Add 0022-RHBZ-557845-RHEL5-style-partitions.patch
* Make kpartx deal with logical partitions like it did in RHEL5.
Don't create a dm-device for the extended partition itself.
Create the logical partitions on top of the dm-device for the whole disk.
* Mon Nov 16 2009 Benjamin Marzinski <bmarzins@redhat.com> -0.4.9-11
- Add 0002-for-upstream-add-tmo-config-options.patch
* Add fail_io_fail_tmo and dev_loss_tmo multipath.conf options