This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPFire 3.x development tree".
The branch, master has been updated via 50d91a124d7bba86a29109f565d4682d6b8a3f7f (commit) via b6ae58926e838bd263d869d4e50381366680b0cc (commit) via 73ce4f12ecdfc64de27ab65e73bf00a0a94e573b (commit) via eb5926397c282973c89558e0ab9105b538dcbd11 (commit) via e0f83074249c0e07cae9fa6508eab57ceab75353 (commit) via ad0fe82a2ba18e96aed2935698d8277c6cce31d5 (commit) via 8f95d3a12e4467838f4a7a954c22fbf1b633de45 (commit) via 6070be30bbae86aefc9d0359f74220cc8d6c6bd0 (commit) via d36de30a3272db0a871075e8e1484f84ee8860e0 (commit) via 68c2a8d80ada4cf0aa87b71877fb121ffbe2a11c (commit) via c60454e2c7b5d4e97fd7a3678ab08267c020678b (commit) via dc01aad8ac12363c9d918977797b6afa41cd8c8b (commit) via 3af615d78a044b47f1b6dc1eea8717f1bd20abad (commit) from 036170af5332fb9530706ac9062e38d0fd8ae32f (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 50d91a124d7bba86a29109f565d4682d6b8a3f7f Author: Michael Tremer michael.tremer@ipfire.org Date: Thu Apr 8 11:34:52 2010 +0200
attr: Fix installation of manpages that got to a wrong place.
commit b6ae58926e838bd263d869d4e50381366680b0cc Merge: 73ce4f12ecdfc64de27ab65e73bf00a0a94e573b 6070be30bbae86aefc9d0359f74220cc8d6c6bd0 Author: Michael Tremer michael.tremer@ipfire.org Date: Tue Apr 6 22:19:49 2010 +0200
Merge remote branch 'stevee/multipath-tools'
commit 73ce4f12ecdfc64de27ab65e73bf00a0a94e573b Merge: eb5926397c282973c89558e0ab9105b538dcbd11 e0f83074249c0e07cae9fa6508eab57ceab75353 Author: Michael Tremer michael.tremer@ipfire.org Date: Tue Apr 6 20:47:33 2010 +0200
Merge remote branch 'stevee/ebtables'
commit eb5926397c282973c89558e0ab9105b538dcbd11 Author: Michael Tremer michael.tremer@ipfire.org Date: Tue Apr 6 20:29:31 2010 +0200
QA: Fix check for sonames.
Do not check files that are not a lib, actually.
commit e0f83074249c0e07cae9fa6508eab57ceab75353 Author: Schantl Stefan Stevee@ipfire.org Date: Mon Apr 5 21:51:35 2010 +0200
ebtables: Update to version 2.0.9-2.
commit ad0fe82a2ba18e96aed2935698d8277c6cce31d5 Author: Schantl Stefan Stevee@ipfire.org Date: Mon Apr 5 21:50:18 2010 +0200
ebtables: Reactivate paralellism build.
I disabled it for testing purposes and forgot to reactivate.
commit 8f95d3a12e4467838f4a7a954c22fbf1b633de45 Author: Schantl Stefan Stevee@ipfire.org Date: Mon Apr 5 21:46:53 2010 +0200
ebtables: Improve security to pass QA checks.
* Added patches for CFLAGS, install permissions and location. * Add -Wall CFLAG to improve security
commit 6070be30bbae86aefc9d0359f74220cc8d6c6bd0 Merge: dc01aad8ac12363c9d918977797b6afa41cd8c8b 036170af5332fb9530706ac9062e38d0fd8ae32f Author: Schantl Stefan Stevee@ipfire.org Date: Mon Apr 5 20:48:20 2010 +0200
Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire-3.x into multipath-tools
Conflicts: pkgs/toolchain/binutils-static/patches
commit d36de30a3272db0a871075e8e1484f84ee8860e0 Merge: 68c2a8d80ada4cf0aa87b71877fb121ffbe2a11c 036170af5332fb9530706ac9062e38d0fd8ae32f Author: Schantl Stefan Stevee@ipfire.org Date: Mon Apr 5 20:44:04 2010 +0200
Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire-3.x into iproute
Conflicts: pkgs/toolchain/binutils-static/patches
commit 68c2a8d80ada4cf0aa87b71877fb121ffbe2a11c Author: Schantl Stefan Stevee@ipfire.org Date: Sun Apr 4 21:51:27 2010 +0200
iproute2: Clean up naoki-makefile.
commit c60454e2c7b5d4e97fd7a3678ab08267c020678b Author: Schantl Stefan Stevee@ipfire.org Date: Sun Apr 4 21:50:02 2010 +0200
iproute2: Update to version 2.5.33.
Fixes issue #537.
commit dc01aad8ac12363c9d918977797b6afa41cd8c8b Author: Schantl Stefan Stevee@ipfire.org Date: Fri Apr 2 19:19:09 2010 +0200
multipath-tools: New package.
commit 3af615d78a044b47f1b6dc1eea8717f1bd20abad Author: Schantl Stefan Stevee@ipfire.org Date: Fri Apr 2 18:00:17 2010 +0200
libaio: New package.
-----------------------------------------------------------------------
Summary of changes: pkgs/core/attr/attr.nm | 3 +- pkgs/core/ebtables/ebtables.nm | 4 +- .../ebtables/patches/ebtables-2.0.8-cflags.patch | 19 + .../patches/ebtables-2.0.8-norootinst.patch | 63 ++ .../core/ebtables/patches/ebtables-2.0.9-lsb.patch | 106 ++ pkgs/core/iproute2/iproute2.nm | 6 +- .../patches/iproute2-2.6.29-1-opt_flags.patch | 12 - pkgs/core/{mpfr/mpfr.nm => libaio/libaio.nm} | 53 +- .../patches/libaio-0.3.109-install-to-slash.patch | 30 + .../fuse.nm => multipath-tools/multipath-tools.nm} | 29 +- .../patches/0001-RH-queue-without-daemon.patch | 165 +++ ...001-for-upstream-add-tpg_pref-prioritizer.patch | 123 +++ .../patches/0002-RH-path-checker.patch | 198 ++++ .../0002-for-upstream-add-tmo-config-options.patch | 511 +++++++++ .../patches/0003-RH-root-init-script.patch | 84 ++ .../0003-for-upstream-default-configs.patch | 56 + .../patches/0004-RH-fix-kpartx.patch | 48 + .../multipath-tools/patches/0005-RH-cciss_id.patch | 219 ++++ .../patches/0006-RH-move-bindings.patch | 56 + .../patches/0007-RH-do-not-remove.patch | 39 + ...8-RH-Make-build-system-RH-Fedora-friendly.patch | 62 ++ ...09-RH-multipathd-blacklist-all-by-default.patch | 70 ++ .../0010-RH-multipath-rules-udev-changes.patch | 58 + .../0011-RH-fix-init-script-LSB-headers.patch | 29 + .../patches/0012-RH-udev-sync-support.patch | 362 ++++++ .../0013-RH-add-weighted_prio-prioritizer.patch | 546 +++++++++ .../patches/0014-RH-add-hp_tur-checker.patch | 231 ++++ .../0015-RH-add-multipathd-count-paths-cmd.patch | 150 +++ .../0016-RHBZ-554561-fix-init-error-msg.patch | 23 + .../patches/0017-RHBZ-554592-man-page-note.patch | 17 + .../patches/0018-RHBZ-554596-SUN-6540-config.patch | 57 + .../0019-RHBZ-554598-fix-multipath-locking.patch | 43 + .../0020-RHBZ-554605-fix-manual-failover.patch | 52 + .../0021-RHBZ-548874-add-find-multipaths.patch | 1153 ++++++++++++++++++++ .../0022-RHBZ-557845-RHEL5-style-partitions.patch | 325 ++++++ .../0023-RHBZ-557810-emc-invista-config.patch | 52 + .../patches/0024-RHBZ-565933-checker-timeout.patch | 428 ++++++++ tools/quality-agent.d/050-libs-soname | 4 + 38 files changed, 5424 insertions(+), 62 deletions(-) create mode 100644 pkgs/core/ebtables/patches/ebtables-2.0.8-cflags.patch create mode 100644 pkgs/core/ebtables/patches/ebtables-2.0.8-norootinst.patch create mode 100644 pkgs/core/ebtables/patches/ebtables-2.0.9-lsb.patch delete mode 100644 pkgs/core/iproute2/patches/iproute2-2.6.29-1-opt_flags.patch copy pkgs/core/{mpfr/mpfr.nm => libaio/libaio.nm} (66%) create mode 100644 pkgs/core/libaio/patches/libaio-0.3.109-install-to-slash.patch copy pkgs/core/{fuse/fuse.nm => multipath-tools/multipath-tools.nm} (77%) create mode 100644 pkgs/core/multipath-tools/patches/0001-RH-queue-without-daemon.patch create mode 100644 pkgs/core/multipath-tools/patches/0001-for-upstream-add-tpg_pref-prioritizer.patch create mode 100644 pkgs/core/multipath-tools/patches/0002-RH-path-checker.patch create mode 100644 pkgs/core/multipath-tools/patches/0002-for-upstream-add-tmo-config-options.patch create mode 100644 pkgs/core/multipath-tools/patches/0003-RH-root-init-script.patch create mode 100644 pkgs/core/multipath-tools/patches/0003-for-upstream-default-configs.patch create mode 100644 pkgs/core/multipath-tools/patches/0004-RH-fix-kpartx.patch create mode 100644 pkgs/core/multipath-tools/patches/0005-RH-cciss_id.patch create mode 100644 pkgs/core/multipath-tools/patches/0006-RH-move-bindings.patch create mode 100644 pkgs/core/multipath-tools/patches/0007-RH-do-not-remove.patch create mode 100644 pkgs/core/multipath-tools/patches/0008-RH-Make-build-system-RH-Fedora-friendly.patch create mode 100644 pkgs/core/multipath-tools/patches/0009-RH-multipathd-blacklist-all-by-default.patch create mode 100644 pkgs/core/multipath-tools/patches/0010-RH-multipath-rules-udev-changes.patch create mode 100644 pkgs/core/multipath-tools/patches/0011-RH-fix-init-script-LSB-headers.patch create mode 100644 pkgs/core/multipath-tools/patches/0012-RH-udev-sync-support.patch create mode 100644 pkgs/core/multipath-tools/patches/0013-RH-add-weighted_prio-prioritizer.patch create mode 100644 pkgs/core/multipath-tools/patches/0014-RH-add-hp_tur-checker.patch create mode 100644 pkgs/core/multipath-tools/patches/0015-RH-add-multipathd-count-paths-cmd.patch create mode 100644 pkgs/core/multipath-tools/patches/0016-RHBZ-554561-fix-init-error-msg.patch create mode 100644 pkgs/core/multipath-tools/patches/0017-RHBZ-554592-man-page-note.patch create mode 100644 pkgs/core/multipath-tools/patches/0018-RHBZ-554596-SUN-6540-config.patch create mode 100644 pkgs/core/multipath-tools/patches/0019-RHBZ-554598-fix-multipath-locking.patch create mode 100644 pkgs/core/multipath-tools/patches/0020-RHBZ-554605-fix-manual-failover.patch create mode 100644 pkgs/core/multipath-tools/patches/0021-RHBZ-548874-add-find-multipaths.patch create mode 100644 pkgs/core/multipath-tools/patches/0022-RHBZ-557845-RHEL5-style-partitions.patch create mode 100644 pkgs/core/multipath-tools/patches/0023-RHBZ-557810-emc-invista-config.patch create mode 100644 pkgs/core/multipath-tools/patches/0024-RHBZ-565933-checker-timeout.patch
Difference in files: diff --git a/pkgs/core/attr/attr.nm b/pkgs/core/attr/attr.nm index ba9877f..743ebfd 100644 --- a/pkgs/core/attr/attr.nm +++ b/pkgs/core/attr/attr.nm @@ -47,7 +47,8 @@ PKG_TARBALL = $(THISAPP).tar.gz
CONFIGURE_OPTIONS += \ --bindir=/bin \ - --enable-shared + --enable-shared \ + --mandir=/usr/share/man
define STAGE_INSTALL_CMDS -mkdir -pv $(BUILDROOT)/{,usr/}lib diff --git a/pkgs/core/ebtables/ebtables.nm b/pkgs/core/ebtables/ebtables.nm index 5eb314e..b09783c 100644 --- a/pkgs/core/ebtables/ebtables.nm +++ b/pkgs/core/ebtables/ebtables.nm @@ -25,7 +25,7 @@ include $(PKGROOT)/Include
PKG_NAME = ebtables -PKG_VER = v2.0.9-1 +PKG_VER = v2.0.9-2 PKG_REL = 0
PKG_MAINTAINER = @@ -42,7 +42,7 @@ endef
PKG_TARBALL = $(THISAPP).tar.gz
-CFLAGS += -fno-stack-protector # XXX Why do we need this? +CFLAGS += -Wall
define QUALITY_AGENT_WHITELIST_RPATH /sbin/ebtables-restore \ diff --git a/pkgs/core/ebtables/patches/ebtables-2.0.8-cflags.patch b/pkgs/core/ebtables/patches/ebtables-2.0.8-cflags.patch new file mode 100644 index 0000000..1e34a9e --- /dev/null +++ b/pkgs/core/ebtables/patches/ebtables-2.0.8-cflags.patch @@ -0,0 +1,19 @@ +diff -up ebtables-v2.0.8-1/extensions/Makefile.BAD ebtables-v2.0.8-1/extensions/Makefile +--- ebtables-v2.0.8-1/extensions/Makefile.BAD 2007-08-23 09:52:37.000000000 -0400 ++++ ebtables-v2.0.8-1/extensions/Makefile 2007-08-23 09:52:50.000000000 -0400 +@@ -11,13 +11,13 @@ EXT_LIBSI+=$(foreach T,$(EXT_FUNC), -leb + EXT_LIBSI+=$(foreach T,$(EXT_TABLES), -lebtable_$(T)) + + extensions/ebt_%.so: extensions/ebt_%.o +- $(CC) -shared -o $@ -lc $< -nostartfiles ++ $(CC) $(CFLAGS) -shared -o $@ -lc $< -nostartfiles + + extensions/libebt_%.so: extensions/ebt_%.so + mv $< $@ + + extensions/ebtable_%.so: extensions/ebtable_%.o +- $(CC) -shared -o $@ -lc $< -nostartfiles ++ $(CC) $(CFLAGS) -shared -o $@ -lc $< -nostartfiles + + extensions/libebtable_%.so: extensions/ebtable_%.so + mv $< $@ diff --git a/pkgs/core/ebtables/patches/ebtables-2.0.8-norootinst.patch b/pkgs/core/ebtables/patches/ebtables-2.0.8-norootinst.patch new file mode 100644 index 0000000..d475928 --- /dev/null +++ b/pkgs/core/ebtables/patches/ebtables-2.0.8-norootinst.patch @@ -0,0 +1,63 @@ +diff -up ebtables-v2.0.8-2/Makefile.orig ebtables-v2.0.8-2/Makefile +--- ebtables-v2.0.8-2/Makefile.orig 2007-09-21 13:27:20.000000000 -0400 ++++ ebtables-v2.0.8-2/Makefile 2007-10-28 15:09:01.000000000 -0400 +@@ -154,28 +154,28 @@ tmp3:=$(shell printf $(PIPE) | sed 's// + .PHONY: scripts + scripts: ebtables-save ebtables.sysv ebtables-config + cat ebtables-save | sed 's/__EXEC_PATH__/$(tmp1)/g' > ebtables-save_ +- install -m 0755 -o root -g root ebtables-save_ $(DESTDIR)$(BINDIR)/ebtables-save ++ install -m 0755 ebtables-save_ $(DESTDIR)$(BINDIR)/ebtables-save + cat ebtables.sysv | sed 's/__EXEC_PATH__/$(tmp1)/g' | sed 's/__SYSCONFIG__/$(tmp2)/g' > ebtables.sysv_ +- install -m 0755 -o root -g root ebtables.sysv_ $(DESTDIR)$(INITDIR)/ebtables ++ install -m 0755 ebtables.sysv_ $(DESTDIR)$(INITDIR)/ebtables + cat ebtables-config | sed 's/__SYSCONFIG__/$(tmp2)/g' > ebtables-config_ +- install -m 0600 -o root -g root ebtables-config_ $(DESTDIR)$(SYSCONFIGDIR)/ebtables-config ++ install -m 0600 ebtables-config_ $(DESTDIR)$(SYSCONFIGDIR)/ebtables-config + rm -f ebtables-save_ ebtables.sysv_ ebtables-config_ + + $(MANDIR)/man8/ebtables.8: ebtables.8 + mkdir -p $(DESTDIR)$(@D) + sed 's/$$(VERSION)/$(PROGVERSION)/' ebtables.8 | sed 's/$$(DATE)/$(PROGDATE)/' > ebtables.8_ +- install -m 0644 -o root -g root ebtables.8_ $(DESTDIR)$@ ++ install -m 0644 ebtables.8_ $(DESTDIR)$@ + rm -f ebtables.8_ + + $(ETHERTYPESFILE): ethertypes + mkdir -p $(DESTDIR)$(@D) +- install -m 0644 -o root -g root $< $(DESTDIR)$@ ++ install -m 0644 $< $(DESTDIR)$@ + + .PHONY: exec + exec: ebtables ebtables-restore + mkdir -p $(DESTDIR)$(BINDIR) +- install -m 0755 -o root -g root $(PROGNAME) $(DESTDIR)$(BINDIR)/$(PROGNAME) +- install -m 0755 -o root -g root ebtables-restore $(DESTDIR)$(BINDIR)/ebtables-restore ++ install -m 0755 $(PROGNAME) $(DESTDIR)$(BINDIR)/$(PROGNAME) ++ install -m 0755 ebtables-restore $(DESTDIR)$(BINDIR)/ebtables-restore + + .PHONY: install + install: $(MANDIR)/man8/ebtables.8 $(ETHERTYPESFILE) exec scripts +@@ -199,18 +199,18 @@ release: + rm -f extensions/ebt_inat.c + rm -rf $(CVSDIRS) + mkdir -p include/linux/netfilter_bridge +- install -m 0644 -o root -g root \ ++ install -m 0644 \ + $(KERNEL_INCLUDES)/linux/netfilter_bridge.h include/linux/ + # To keep possible compile error complaints about undefined ETH_P_8021Q + # off my back +- install -m 0644 -o root -g root \ ++ install -m 0644 \ + $(KERNEL_INCLUDES)/linux/if_ether.h include/linux/ +- install -m 0644 -o root -g root \ ++ install -m 0644 \ + $(KERNEL_INCLUDES)/linux/types.h include/linux/ +- install -m 0644 -o root -g root \ ++ install -m 0644 \ + $(KERNEL_INCLUDES)/linux/netfilter_bridge/*.h \ + include/linux/netfilter_bridge/ +- install -m 0644 -o root -g root \ ++ install -m 0644 \ + include/ebtables.h include/linux/netfilter_bridge/ + make clean + touch * diff --git a/pkgs/core/ebtables/patches/ebtables-2.0.9-lsb.patch b/pkgs/core/ebtables/patches/ebtables-2.0.9-lsb.patch new file mode 100644 index 0000000..721deea --- /dev/null +++ b/pkgs/core/ebtables/patches/ebtables-2.0.9-lsb.patch @@ -0,0 +1,106 @@ +diff -up ebtables-v2.0.9-1/ebtables.sysv.lsb ebtables-v2.0.9-1/ebtables.sysv +--- ebtables-v2.0.9-1/ebtables.sysv.lsb 2010-01-15 11:39:31.000000000 +0100 ++++ ebtables-v2.0.9-1/ebtables.sysv 2010-01-15 12:52:24.000000000 +0100 +@@ -18,9 +18,9 @@ source /etc/sysconfig/network + # Check that networking is up. + [ ${NETWORKING} = "no" ] && exit 0 + +-[ -x __EXEC_PATH__/ebtables ] || exit 1 +-[ -x __EXEC_PATH__/ebtables-save ] || exit 1 +-[ -x __EXEC_PATH__/ebtables-restore ] || exit 1 ++[ -x __EXEC_PATH__/ebtables ] || exit 5 ++[ -x __EXEC_PATH__/ebtables-save ] || exit 5 ++[ -x __EXEC_PATH__/ebtables-restore ] || exit 5 + + RETVAL=0 + prog="ebtables" +@@ -39,6 +39,7 @@ config=__SYSCONFIG__/$prog-config + [ -f "$config" ] && . "$config" + + start() { ++ [ "$EUID" != "0" ] && exit 4 + echo -n $"Starting $desc ($prog): " + if [ "$EBTABLES_BINARY_FORMAT" = "yes" ]; then + for table in $(ls __SYSCONFIG__/ebtables.* 2>/dev/null | sed -e 's/.*ebtables.//' -e '/save/d' ); do +@@ -50,7 +51,7 @@ start() { + + if [ $RETVAL -eq 0 ]; then + success "$prog startup" +- rm -f /var/lock/subsys/$prog ++ touch "/var/lock/subsys/$prog" + else + failure "$prog startup" + fi +@@ -58,6 +59,7 @@ start() { + } + + stop() { ++ [ "$EUID" != "0" ] && exit 4 + echo -n $"Stopping $desc ($prog): " + for table in $(grep '^ebtable_' /proc/modules | sed -e 's/ebtable_([^ ]*).*/\1/'); do + __EXEC_PATH__/ebtables -t $table --init-table || RETVAL=1 +@@ -71,7 +73,7 @@ stop() { + + if [ $RETVAL -eq 0 ]; then + success "$prog shutdown" +- rm -f /var/lock/subsys/$prog ++ rm -f "/var/lock/subsys/$prog" + else + failure "$prog shutdown" + fi +@@ -79,11 +81,13 @@ stop() { + } + + restart() { ++ [ "$EBTABLES_SAVE_ON_RESTART" = "yes" ] && save + stop + start + } + + save() { ++ [ "$EUID" != "0" ] && exit 4 + echo -n $"Saving $desc ($prog): " + if [ "$EBTABLES_TEXT_FORMAT" = "yes" ]; then + if [ -e __SYSCONFIG__/ebtables ]; then +@@ -116,30 +120,34 @@ save() { + + case "$1" in + start) ++ [ -f "/var/lock/subsys/$prog" ] && exit 0 + start + ;; + stop) + [ "$EBTABLES_SAVE_ON_STOP" = "yes" ] && save + stop + ;; +- restart|reload) +- [ "$EBTABLES_SAVE_ON_RESTART" = "yes" ] && save ++ restart|force-reload) + restart + ;; +- condrestart) +- [ -e /var/lock/subsys/$prog ] && restart +- RETVAL=$? ++ reload) ++ [ ! -f "/var/lock/subsys/$prog" ] && exit 7 ++ restart ++ ;; ++ condrestart|try-restart) ++ [ ! -e "/var/lock/subsys/$prog" ] && exit 0 ++ restart + ;; + save) + save + ;; + status) ++ [ -f "/var/lock/subsys/$prog" ] && RETVAL=0 || RETVAL=3 + __EXEC_PATH__/ebtables-save +- RETVAL=$? + ;; + *) + echo $"Usage $0 {start|stop|restart|condrestart|save|status}" +- RETVAL=1 ++ RETVAL=2 + esac + + exit $RETVAL diff --git a/pkgs/core/iproute2/iproute2.nm b/pkgs/core/iproute2/iproute2.nm index 94c29a0..29d01df 100644 --- a/pkgs/core/iproute2/iproute2.nm +++ b/pkgs/core/iproute2/iproute2.nm @@ -25,7 +25,7 @@ include $(PKGROOT)/Include
PKG_NAME = iproute2 -PKG_VER = 2.6.29-1 +PKG_VER = 2.6.33 PKG_REL = 0
PKG_MAINTAINER = @@ -45,10 +45,6 @@ endef
PKG_TARBALL = $(THISAPP).tar.bz2
-############################################################################### -# Installation Details -############################################################################### - define STAGE_PREPARE_CMDS cd $(DIR_APP) && sed -i -e "s@DESTDIR=.*@DESTDIR=@" \ -e "s@/share/@/usr/share/@g" Makefile diff --git a/pkgs/core/iproute2/patches/iproute2-2.6.29-1-opt_flags.patch b/pkgs/core/iproute2/patches/iproute2-2.6.29-1-opt_flags.patch deleted file mode 100644 index aea7362..0000000 --- a/pkgs/core/iproute2/patches/iproute2-2.6.29-1-opt_flags.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up iproute2-2.6.29/Makefile.opt iproute2-2.6.29/Makefile ---- iproute2-2.6.29/Makefile.opt 2008-08-12 14:19:58.000000000 +0200 -+++ iproute2-2.6.29/Makefile 2008-08-12 14:21:42.000000000 +0200 -@@ -22,7 +22,7 @@ ADDLIB+=ipx_ntop.o ipx_pton.o - - CC = gcc - HOSTCC = gcc --CCOPTS = -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -+CCOPTS = -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall $(OPT_FLAGS) - CFLAGS = $(CCOPTS) -I../include $(DEFINES) - YACCFLAGS = -d -t -v - diff --git a/pkgs/core/libaio/libaio.nm b/pkgs/core/libaio/libaio.nm new file mode 100644 index 0000000..9ac7bb4 --- /dev/null +++ b/pkgs/core/libaio/libaio.nm @@ -0,0 +1,66 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007, 2008 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see http://www.gnu.org/licenses/. # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include $(PKGROOT)/Include + +PKG_NAME = libaio +PKG_VER = 0.3.109 +PKG_REL = 0 + +PKG_MAINTAINER = +PKG_GROUP = System/Libraries +PKG_URL = ftp://ftp.kernel.org/pub/linux/libs/aio/ +PKG_LICENSE = LGPLv2+ +PKG_SUMMARY = Linux-native asynchronous I/O access library. + +PKG_PACKAGES += $(PKG_NAME_REAL)-devel + +define PKG_DESCRIPTION + The Linux-native asynchronous I/O facility ("async I/O", or "aio") \ + has a richer API and capability set than the simple POSIX async I/O \ + facility. This library, libaio, provides the Linux-native API for \ + async I/O. The POSIX async I/O facility requires this library in \ + order to provide kernel-accelerated async I/O capabilities, as do \ + applications which require the Linux-native async I/O API. +endef + +PKG_BUILD_DEPS+= e2fsprogs + +PKG_TARBALL = $(THISAPP).tar.bz2 + +define STAGE_BUILD + cd $(DIR_APP) && make $(PARALLELISMFLAGS) +endef + +define STAGE_TEST + # Only do a partcheck, because a full check requires a + # loop device, which isn't avialable. + cd $(DIR_APP) && make partcheck +endef + +define STAGE_INSTALL_CMDS + # Modify links to be relative + ln -svf libaio.so.1 $(BUILDROOT)/usr/lib/libaio.so + ln -svf libaio.so.1.0.1 $(BUILDROOT)/usr/lib/libaio.so.1 +endef diff --git a/pkgs/core/libaio/patches/libaio-0.3.109-install-to-slash.patch b/pkgs/core/libaio/patches/libaio-0.3.109-install-to-slash.patch new file mode 100644 index 0000000..7779a9c --- /dev/null +++ b/pkgs/core/libaio/patches/libaio-0.3.109-install-to-slash.patch @@ -0,0 +1,30 @@ +diff -up libaio-0.3.107/src/Makefile.orig libaio-0.3.107/src/Makefile +--- libaio-0.3.107/src/Makefile.orig 2009-01-20 10:07:31.520105235 -0500 ++++ libaio-0.3.107/src/Makefile 2009-01-20 10:08:51.199104930 -0500 +@@ -1,6 +1,7 @@ + prefix=/usr +-includedir=$(prefix)/include +-libdir=$(prefix)/lib ++includedir=/usr/include ++libdir=/usr/lib ++usrlibdir=/usr/lib + + ARCH := $(shell uname -m | sed -e s/i.86/i386/) + CFLAGS := -nostdlib -nostartfiles -Wall -I. -g -fomit-frame-pointer -O2 -fPIC +@@ -51,11 +52,11 @@ $(libname): $(libaio_sobjs) libaio.map + $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS) + + install: $(all_targets) +- install -D -m 644 libaio.h $(includedir)/libaio.h +- install -D -m 644 libaio.a $(libdir)/libaio.a +- install -D -m 755 $(libname) $(libdir)/$(libname) +- ln -sf $(libname) $(libdir)/$(soname) +- ln -sf $(libname) $(libdir)/libaio.so ++ install -D -m 644 libaio.h $(DESTDIR)$(includedir)/libaio.h ++ install -D -m 644 libaio.a $(DESTDIR)$(usrlibdir)/libaio.a ++ install -D -m 755 $(libname) $(DESTDIR)$(libdir)/$(libname) ++ ln -sf $(libdir)/$(libname) $(DESTDIR)$(libdir)/$(soname) ++ ln -sf $(libdir)/$(libname) $(DESTDIR)$(usrlibdir)/libaio.so + + $(libaio_objs): libaio.h + diff --git a/pkgs/core/multipath-tools/multipath-tools.nm b/pkgs/core/multipath-tools/multipath-tools.nm new file mode 100644 index 0000000..647b473 --- /dev/null +++ b/pkgs/core/multipath-tools/multipath-tools.nm @@ -0,0 +1,55 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007, 2008 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see http://www.gnu.org/licenses/. # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include $(PKGROOT)/Include + +PKG_NAME = multipath-tools +PKG_VER = 0.4.9 +PKG_REL = 0 + +PKG_MAINTAINER = +PKG_GROUP = System/Base +PKG_URL = http://christophe.varoqui.free.fr/ +PKG_LICENSE = GPL+ +PKG_SUMMARY = Tools to manage multipath devices using device-mapper. + +PKG_BUILD_DEPS+= gzip +PKG_DEPS += libaio lvm2 ncurses readline + +define PKG_DESCRIPTION + This package provides tools to manage multipath devices by \ + instructing the device-mapper multipath kernel module what to do. +endef + +PKG_TARBALL = $(PKG_NAME)-091027.tar.gz + +DIR_APP = $(DIR_SRC)/$(PKG_NAME) + +define STAGE_BUILD + cd $(DIR_APP) && make +endef + +define STAGE_INSTALL_CMDS + rm -rf $(BUILDROOT)/etc/rc.d +endef diff --git a/pkgs/core/multipath-tools/patches/0001-RH-queue-without-daemon.patch b/pkgs/core/multipath-tools/patches/0001-RH-queue-without-daemon.patch new file mode 100644 index 0000000..3834bfc --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0001-RH-queue-without-daemon.patch @@ -0,0 +1,165 @@ +From 8191fb07d8212e29ad44370abb60e174e1c34bb5 Mon Sep 17 00:00:00 2001 +From: Fabio M. Di Nitto fdinitto@redhat.com +Date: Tue, 13 Oct 2009 08:15:15 +0200 +Subject: [PATCH 01/12] RH: queue without daemon + +Signed-off-by: Fabio M. Di Nitto fdinitto@redhat.com +--- +:100644 100644 50a728c... 86b1320... M libmultipath/config.h +:100644 100644 ee4de68... 7888e8e... M libmultipath/dict.c +:100644 100644 afd1246... 2e7a0d1... M libmultipath/structs.h +:100644 100644 c222da4... 9afa615... M multipath.conf.annotated +:100644 100644 3e0fd6e... 44d1329... M multipath.conf.synthetic +:100644 100644 41a9bd0... 90de6df... M multipathd/main.c + libmultipath/config.h | 1 + + libmultipath/dict.c | 35 +++++++++++++++++++++++++++++++++++ + libmultipath/structs.h | 6 ++++++ + multipath.conf.annotated | 9 +++++++++ + multipath.conf.synthetic | 1 + + multipathd/main.c | 5 +++++ + 6 files changed, 57 insertions(+), 0 deletions(-) + +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; ++ int queue_without_daemon; + 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 +@@ -362,6 +362,28 @@ def_no_path_retry_handler(vector strvec) + } + + static int ++def_queue_without_daemon(vector strvec) ++{ ++ char * buff; ++ ++ buff = set_value(strvec); ++ if (!buff) ++ return 1; ++ ++ if (!strncmp(buff, "off", 3) || !strncmp(buff, "no", 2) || ++ !strncmp(buff, "0", 1)) ++ conf->queue_without_daemon = QUE_NO_DAEMON_OFF; ++ else if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) || ++ !strncmp(buff, "1", 1)) ++ conf->queue_without_daemon = QUE_NO_DAEMON_ON; ++ else ++ conf->queue_without_daemon = QUE_NO_DAEMON_UNDEF; ++ ++ free(buff); ++ return 0; ++} ++ ++static int + def_pg_timeout_handler(vector strvec) + { + int pg_timeout; +@@ -1944,6 +1966,18 @@ snprint_def_no_path_retry (char * buff, + } + + static int ++snprint_def_queue_without_daemon (char * buff, int len, void * data) ++{ ++ switch (conf->queue_without_daemon) { ++ case QUE_NO_DAEMON_OFF: ++ return snprintf(buff, len, "no"); ++ case QUE_NO_DAEMON_ON: ++ return snprintf(buff, len, "yes"); ++ } ++ return 0; ++} ++ ++static int + snprint_def_pg_timeout (char * buff, int len, void * data) + { + if (conf->pg_timeout == DEFAULT_PGTIMEOUT) +@@ -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); ++ install_keyword("queue_without_daemon", &def_queue_without_daemon, &snprint_def_queue_without_daemon); + 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/structs.h +=================================================================== +--- multipath-tools.orig/libmultipath/structs.h ++++ multipath-tools/libmultipath/structs.h +@@ -63,6 +63,12 @@ enum pgstates { + PGSTATE_ACTIVE + }; + ++enum queue_without_daemon_states { ++ QUE_NO_DAEMON_UNDEF, ++ QUE_NO_DAEMON_OFF, ++ QUE_NO_DAEMON_ON, ++}; ++ + enum pgtimeouts { + PGTIMEOUT_UNDEF, + PGTIMEOUT_NONE +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 + # + # # ++# # name : queue_without_daemon ++# # scope : multipathd ++# # desc : If set to "no", multipathd will disable queueing for all ++# # devices when it is shut down. ++# # values : yes|no ++# # default : yes ++# queue_without_daemon no ++# ++# # + # # name : user_friendly_names + # # scope : multipath + # # desc : If set to "yes", using the bindings file +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 + # no_path_retry fail ++# queue_without_daemon no + # user_friendly_names no + # mode 644 + # uid 0 +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; + struct vectors * vecs; ++ struct multipath * mpp; ++ int i; + + mlockall(MCL_CURRENT | MCL_FUTURE); + +@@ -1422,6 +1424,9 @@ child (void * param) + */ + block_signal(SIGHUP, NULL); + lock(vecs->lock); ++ if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF) ++ vector_foreach_slot(vecs->mpvec, mpp, i) ++ dm_queue_if_no_path(mpp->alias, 0); + remove_maps_and_stop_waiters(vecs); + free_pathvec(vecs->pathvec, FREE_PATHS); + diff --git a/pkgs/core/multipath-tools/patches/0001-for-upstream-add-tpg_pref-prioritizer.patch b/pkgs/core/multipath-tools/patches/0001-for-upstream-add-tpg_pref-prioritizer.patch new file mode 100644 index 0000000..93b0af2 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0001-for-upstream-add-tpg_pref-prioritizer.patch @@ -0,0 +1,123 @@ +From faf6bfc96b98562626e0ea12aecb582032ff4cab Mon Sep 17 00:00:00 2001 +From: Fabio M. Di Nitto fdinitto@redhat.com +Date: Mon, 19 Oct 2009 07:02:02 +0200 +Subject: [PATCH 1/1] for-upstream: add tpg_pref prioritizer + +Signed-off-by: Fabio M. Di Nitto fdinitto@redhat.com +--- +:100644 100644 fc9277f... 1f40859... M libmultipath/prio.h +:100644 100644 949a60a... 5021c04... M libmultipath/prioritizers/Makefile +:100644 100644 0048a44... 22513ab... M libmultipath/prioritizers/alua.c +:100644 100644 0531052... cd9c29d... M libmultipath/prioritizers/alua_rtpg.c +:100644 100644 bddbbdd... daf95a6... M libmultipath/prioritizers/alua_spc3.h + libmultipath/prio.h | 1 + + libmultipath/prioritizers/Makefile | 10 ++++++++++ + libmultipath/prioritizers/alua.c | 7 +++++++ + libmultipath/prioritizers/alua_rtpg.c | 4 ++++ + libmultipath/prioritizers/alua_spc3.h | 6 ++++++ + 5 files changed, 28 insertions(+), 0 deletions(-) + +diff --git a/libmultipath/prio.h b/libmultipath/prio.h +index fc9277f..1f40859 100644 +--- a/libmultipath/prio.h ++++ b/libmultipath/prio.h +@@ -16,6 +16,7 @@ + * Known prioritizers for use in hwtable.c + */ + #define PRIO_ALUA "alua" ++#define PRIO_TPG_PREF "tpg_pref" + #define PRIO_CONST "const" + #define PRIO_EMC "emc" + #define PRIO_HDS "hds" +diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile +index 949a60a..5021c04 100644 +--- a/libmultipath/prioritizers/Makefile ++++ b/libmultipath/prioritizers/Makefile +@@ -11,6 +11,7 @@ LIBS = \ + libprioemc.so \ + libpriordac.so \ + libprioalua.so \ ++ libpriotpg_pref.so \ + libprionetapp.so \ + libpriohds.so + +@@ -21,9 +22,18 @@ all: $(LIBS) + libprioalua.so: alua.o alua_rtpg.o + $(CC) $(SHARED_FLAGS) -o $@ $^ + ++libpriotpg_pref.so: pref.o pref_rtpg.o ++ $(CC) $(SHARED_FLAGS) -o $@ $^ ++ + libprio%.so: %.o + $(CC) $(SHARED_FLAGS) -o $@ $^ + ++pref.o: alua.c ++ $(CC) $(CFLAGS) -DTPG_PREF -c -o $@ $< ++ ++pref_rtpg.o: alua_rtpg.c ++ $(CC) $(CFLAGS) -DTPG_PREF -c -o $@ $< ++ + install: $(LIBS) + $(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(libdir) + +diff --git a/libmultipath/prioritizers/alua.c b/libmultipath/prioritizers/alua.c +index 0048a44..22513ab 100644 +--- a/libmultipath/prioritizers/alua.c ++++ b/libmultipath/prioritizers/alua.c +@@ -28,6 +28,12 @@ + int + get_alua_info(int fd) + { ++#ifdef TPG_PREF ++ char * aas_string[] = { ++ [AAS_OPTIMIZED] = "preferred", ++ [AAS_STANDBY] = "non-preferred", ++ }; ++#else + char * aas_string[] = { + [AAS_OPTIMIZED] = "active/optimized", + [AAS_NON_OPTIMIZED] = "active/non-optimized", +@@ -35,6 +41,7 @@ get_alua_info(int fd) + [AAS_UNAVAILABLE] = "unavailable", + [AAS_TRANSITIONING] = "transitioning between states", + }; ++#endif + int rc; + int tpg; + +diff --git a/libmultipath/prioritizers/alua_rtpg.c b/libmultipath/prioritizers/alua_rtpg.c +index 0531052..cd9c29d 100644 +--- a/libmultipath/prioritizers/alua_rtpg.c ++++ b/libmultipath/prioritizers/alua_rtpg.c +@@ -293,7 +293,11 @@ get_asymmetric_access_state(int fd, unsigned int tpg) + "group.\n"); + } else { + PRINT_DEBUG("pref=%i\n", dscr->b0); ++#ifdef TPG_PREF ++ rc = rtpg_tpg_dscr_get_pref(dscr); ++#else + rc = rtpg_tpg_dscr_get_aas(dscr); ++#endif + } + } + } +diff --git a/libmultipath/prioritizers/alua_spc3.h b/libmultipath/prioritizers/alua_spc3.h +index bddbbdd..daf95a6 100644 +--- a/libmultipath/prioritizers/alua_spc3.h ++++ b/libmultipath/prioritizers/alua_spc3.h +@@ -302,6 +302,12 @@ rtpg_tpg_dscr_get_aas(struct rtpg_tpg_dscr *d) + return (d->b0 & 0x0f); + } + ++static inline int ++rtpg_tpg_dscr_get_pref(struct rtpg_tpg_dscr *d) ++{ ++ return ((d->b0 & 0x80)?AAS_OPTIMIZED:AAS_STANDBY); ++} ++ + struct rtpg_data { + unsigned char length[4]; /* size-4 */ + struct rtpg_tpg_dscr data[0]; +-- +1.6.5.1 + diff --git a/pkgs/core/multipath-tools/patches/0002-RH-path-checker.patch b/pkgs/core/multipath-tools/patches/0002-RH-path-checker.patch new file mode 100644 index 0000000..37864ed --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0002-RH-path-checker.patch @@ -0,0 +1,198 @@ +From f9ddbc18b7580f75c15bf6f3e10f08d6f016caca Mon Sep 17 00:00:00 2001 +From: Fabio M. Di Nitto fdinitto@redhat.com +Date: Tue, 13 Oct 2009 08:18:00 +0200 +Subject: [PATCH 02/12] RH: path checker + +Signed-off-by: Fabio M. Di Nitto fdinitto@redhat.com +--- +:100644 100644 e06dc52... 47107a2... M libmultipath/checkers/tur.c +:100644 100644 98d1618... 00aa5ea... M libmultipath/discovery.c +:100644 100644 7283f36... 17cd4af... M libmultipath/discovery.h +:100644 100644 90de6df... 5d3625a... M multipathd/main.c + libmultipath/checkers/tur.c | 1 - + libmultipath/discovery.c | 62 +++++++++++++++++++++++++++++++++--------- + libmultipath/discovery.h | 2 + + multipathd/main.c | 21 +------------- + 4 files changed, 52 insertions(+), 34 deletions(-) + +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: + case DID_ABORT: +- case DID_TRANSPORT_DISRUPTED: + case DID_TRANSPORT_FAILFAST: + break; + default: +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 +-path_offline (struct path * pp) ++path_state (struct path * pp, char * buff) + { + struct sysfs_device * parent; +- char buff[SCSI_STATE_SIZE]; + + pp->sysdev = sysfs_device_from_path(pp); + if (!pp->sysdev) { +@@ -641,6 +640,16 @@ path_offline (struct path * pp) + return 1; + + condlog(3, "%s: state = %s", pp->dev, buff); ++ return 0; ++} ++ ++int ++path_offline (struct path * pp) ++{ ++ char buff[SCSI_STATE_SIZE]; ++ ++ if (path_state(pp, buff)) ++ return 1; + + if (!strncmp(buff, "offline", 7)) { + pp->offline = 1; +@@ -650,6 +659,21 @@ path_offline (struct path * pp) + return 0; + } + ++int ++path_blocked (struct path * pp) ++{ ++ char buff[SCSI_STATE_SIZE]; ++ ++ if (pp->bus != SYSFS_BUS_SCSI) ++ return 0; ++ if (path_state(pp, buff)) ++ return 0; ++ if (!strncmp(buff, "blocked", 7)) { ++ return 1; ++ } ++ return 0; ++} ++ + extern int + sysfs_pathinfo(struct path * pp) + { +@@ -736,36 +760,43 @@ cciss_ioctl_pathinfo (struct path * pp, + return 0; + } + +-static int +-get_state (struct path * pp) ++int ++get_state (struct path * pp, int daemon) + { + struct checker * c = &pp->checker; ++ int state; + + condlog(3, "%s: get_state", pp->dev); + + if (!checker_selected(c)) { ++ if (daemon) ++ pathinfo(pp, conf->hwtable, DI_SYSFS); + 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; + } + } + if (path_offline(pp)) { + condlog(3, "%s: path offline", pp->dev); +- pp->state = PATH_DOWN; +- return 0; ++ return PATH_DOWN; + } +- 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))) + condlog(3, "%s: checker msg is "%s"", + pp->dev, checker_message(c)); +- return 0; ++ return state; + } + + static int +@@ -850,8 +881,11 @@ pathinfo (struct path *pp, vector hwtabl + 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, 0); ++ if (pp->state == PATH_UNCHECKED || pp->state == PATH_WILD) ++ goto blank; ++ } + + /* + * Retrieve path priority, even for PATH_DOWN paths if it has never +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 *); ++int get_state (struct path * pp, int daemon); ++int path_blocked (struct path *); + int pathinfo (struct path *, vector hwtable, int mask); + struct path * store_pathinfo (vector pathvec, vector hwtable, + char * devname, int flag); +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; + +- if (!checker_selected(&pp->checker)) { +- pathinfo(pp, conf->hwtable, DI_SYSFS); +- select_checker(pp); +- } +- if (!checker_selected(&pp->checker)) { +- condlog(0, "%s: checker is not set", pp->dev); +- return; +- } +- /* +- * Set checker in async mode. +- * Honored only by checker implementing the said mode. +- */ +- checker_set_async(&pp->checker); +- +- if (path_offline(pp)) +- newstate = PATH_DOWN; +- else +- newstate = checker_check(&pp->checker); ++ newstate = get_state(pp, 1); + +- if (newstate < 0) { ++ if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) { + condlog(2, "%s: unusable path", pp->dev); + pathinfo(pp, conf->hwtable, 0); + return; diff --git a/pkgs/core/multipath-tools/patches/0002-for-upstream-add-tmo-config-options.patch b/pkgs/core/multipath-tools/patches/0002-for-upstream-add-tmo-config-options.patch new file mode 100644 index 0000000..dba3659 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0002-for-upstream-add-tmo-config-options.patch @@ -0,0 +1,511 @@ +--- + libmultipath/config.h | 4 + + libmultipath/configure.c | 3 + + libmultipath/dict.c | 102 +++++++++++++++++++++++++++++++++++++++++++++ + libmultipath/discovery.c | 37 ++++++++++++++++ + libmultipath/discovery.h | 1 + libmultipath/propsel.c | 42 ++++++++++++++++++ + libmultipath/propsel.h | 2 + libmultipath/structs.h | 2 + libmultipath/sysfs.c | 56 ++++++++++++++++++++++++ + libmultipath/sysfs.h | 3 - + multipath.conf.annotated | 38 ++++++++++++++++ + multipath/multipath.conf.5 | 15 ++++++ + 12 files changed, 303 insertions(+), 2 deletions(-) + +Index: multipath-tools-091020/multipath.conf.annotated +=================================================================== +--- multipath-tools-091020.orig/multipath.conf.annotated ++++ multipath-tools-091020/multipath.conf.annotated +@@ -191,6 +191,25 @@ + # # default : determined by the process + # gid disk + # ++# # ++# # name : fast_io_fail_tmo ++# # scope : multipath & multipathd ++# # desc : The number of seconds the scsi layer will wait after a ++# # problem has been detected on a FC remote port before failing ++# # IO to devices on that remote port. ++# # values : off | n >= 0 (smaller than dev_loss_tmo) ++# # default : determined by the OS ++# fast_io_fail_tmo 5 ++# ++# # ++# # name : dev_loss_tmo ++# # scope : multipath & multipathd ++# # desc : The number of seconds the scsi layer will wait after a ++# # problem has been detected on a FC remote port before ++# # removing it from the system. ++# # values : n > 0 ++# # default : determined by the OS ++# dev_loss_tmo 600 + #} + # + ## +@@ -504,7 +523,6 @@ + # # desc : If set to "yes", multipathd will disable queueing + # # when the last path to a device has been deleted. + # # values : yes|no +-# # default : no + # # + # flush_on_last_del yes + # +@@ -514,6 +532,24 @@ + # # desc : product strings to blacklist for this vendor + # # + # product_blacklist LUN_Z ++# ++# # ++# # name : fast_io_fail_tmo ++# # scope : multipath & multipathd ++# # desc : The number of seconds the scsi layer will wait after ++# # a problem has been detected on a FC remote port ++# # before failing IO to devices on that remote port. ++# # values : off | n >= 0 (smaller than dev_loss_tmo) ++# fast_io_fail_tmo 5 ++# ++# # ++# # name : dev_loss_tmo ++# # scope : multipath & multipathd ++# # desc : The number of seconds the scsi layer will wait after ++# # a problem has been detected on a FC remote port ++# # before removing it from the system. ++# # values : n > 0 ++# dev_loss_tmo 600 + # } + # device { + # vendor "COMPAQ " +Index: multipath-tools-091020/multipath/multipath.conf.5 +=================================================================== +--- multipath-tools-091020.orig/multipath/multipath.conf.5 ++++ multipath-tools-091020/multipath/multipath.conf.5 +@@ -240,6 +240,17 @@ this to the system limit from /proc/sys/ + maximum number of open fds is taken from the calling process. It is usually + 1024. To be safe, this should be set to the maximum number of paths plus 32, + if that number is greated than 1024. ++.TP ++.B fast_io_fail_tmo ++Specify the number of seconds the scsi layer will wait after a problem has been ++detected on a FC remote port before failing IO to devices on that remote port. ++This should be smaller than dev_loss_tmo. Setting this to ++.I off ++will disable the timeout. ++.TP ++.B dev_loss_tmo ++Specify the number of seconds the scsi layer will wait after a problem has ++been detected on a FC remote port before removing it from the system. + . + .SH "blacklist section" + The +@@ -384,6 +395,10 @@ section: + .B no_path_retry + .TP + .B rr_min_io ++.TP ++.B fast_io_fail_tmo ++.TP ++.B dev_loss_tmo + .RE + .PD + .LP +Index: multipath-tools-091020/libmultipath/dict.c +=================================================================== +--- multipath-tools-091020.orig/libmultipath/dict.c ++++ multipath-tools-091020/libmultipath/dict.c +@@ -37,6 +37,35 @@ polling_interval_handler(vector strvec) + } + + static int ++def_fast_io_fail_handler(vector strvec) ++{ ++ char * buff; ++ ++ buff = set_value(strvec); ++ if (strlen(buff) == 3 && !strcmp(buff, "off")) ++ conf->fast_io_fail = -1; ++ else if (sscanf(buff, "%d", &conf->fast_io_fail) != 1 || ++ conf->fast_io_fail < -1) ++ conf->fast_io_fail = 0; ++ ++ FREE(buff); ++ return 0; ++} ++ ++static int ++def_dev_loss_handler(vector strvec) ++{ ++ char * buff; ++ ++ buff = set_value(strvec); ++ if (sscanf(buff, "%u", &conf->dev_loss) != 1) ++ conf->dev_loss = 0; ++ ++ FREE(buff); ++ return 0; ++} ++ ++static int + verbosity_handler(vector strvec) + { + char * buff; +@@ -628,6 +657,37 @@ bl_product_handler(vector strvec) + } + + static int ++hw_fast_io_fail_handler(vector strvec) ++{ ++ char * buff; ++ struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); ++ ++ buff = set_value(strvec); ++ if (strlen(buff) == 3 && !strcmp(buff, "off")) ++ hwe->fast_io_fail = -1; ++ else if (sscanf(buff, "%d", &hwe->fast_io_fail) != 1 || ++ hwe->fast_io_fail < -1) ++ hwe->fast_io_fail = 0; ++ ++ FREE(buff); ++ return 0; ++} ++ ++static int ++hw_dev_loss_handler(vector strvec) ++{ ++ char * buff; ++ struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); ++ ++ buff = set_value(strvec); ++ if (sscanf(buff, "%u", &hwe->dev_loss) != 1) ++ hwe->dev_loss = 0; ++ ++ FREE(buff); ++ return 0; ++} ++ ++static int + hw_pgpolicy_handler(vector strvec) + { + char * buff; +@@ -1390,6 +1450,26 @@ snprint_mp_flush_on_last_del (char * buf + } + + static int ++snprint_hw_fast_io_fail(char * buff, int len, void * data) ++{ ++ struct hwentry * hwe = (struct hwentry *)data; ++ if (!hwe->fast_io_fail) ++ return 0; ++ if (hwe->fast_io_fail == -1) ++ return snprintf(buff, len, "off"); ++ return snprintf(buff, len, "%d", hwe->fast_io_fail); ++} ++ ++static int ++snprint_hw_dev_loss(char * buff, int len, void * data) ++{ ++ struct hwentry * hwe = (struct hwentry *)data; ++ if (!hwe->dev_loss) ++ return 0; ++ return snprintf(buff, len, "%u", hwe->dev_loss); ++} ++ ++static int + snprint_hw_vendor (char * buff, int len, void * data) + { + struct hwentry * hwe = (struct hwentry *)data; +@@ -1640,6 +1720,24 @@ snprint_def_polling_interval (char * buf + } + + static int ++snprint_def_fast_io_fail(char * buff, int len, void * data) ++{ ++ if (!conf->fast_io_fail) ++ return 0; ++ if (conf->fast_io_fail == -1) ++ return snprintf(buff, len, "off"); ++ return snprintf(buff, len, "%d", conf->fast_io_fail); ++} ++ ++static int ++snprint_def_dev_loss(char * buff, int len, void * data) ++{ ++ if (!conf->dev_loss) ++ return 0; ++ return snprintf(buff, len, "%u", conf->dev_loss); ++} ++ ++static int + snprint_def_verbosity (char * buff, int len, void * data) + { + if (conf->checkint == DEFAULT_VERBOSITY) +@@ -1937,6 +2035,8 @@ init_keywords(void) + install_keyword("mode", &def_mode_handler, &snprint_def_mode); + install_keyword("uid", &def_uid_handler, &snprint_def_uid); + install_keyword("gid", &def_gid_handler, &snprint_def_gid); ++ install_keyword("fast_io_fail_tmo", &def_fast_io_fail_handler, &snprint_def_fast_io_fail); ++ install_keyword("dev_loss_tmo", &def_dev_loss_handler, &snprint_def_dev_loss); + __deprecated install_keyword("default_selector", &def_selector_handler, NULL); + __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); + __deprecated install_keyword("default_getuid_callout", &def_getuid_callout_handler, NULL); +@@ -1991,6 +2091,8 @@ init_keywords(void) + 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("flush_on_last_del", &hw_flush_on_last_del_handler, &snprint_hw_flush_on_last_del); ++ install_keyword("fast_io_fail_tmo", &hw_fast_io_fail_handler, &snprint_hw_fast_io_fail); ++ install_keyword("dev_loss_tmo", &hw_dev_loss_handler, &snprint_hw_dev_loss); + install_sublevel_end(); + + install_keyword_root("multipaths", &multipaths_handler); +Index: multipath-tools-091020/libmultipath/config.h +=================================================================== +--- multipath-tools-091020.orig/libmultipath/config.h ++++ multipath-tools-091020/libmultipath/config.h +@@ -31,6 +31,8 @@ struct hwentry { + int minio; + int pg_timeout; + int flush_on_last_del; ++ int fast_io_fail; ++ unsigned int dev_loss; + char * bl_product; + }; + +@@ -75,6 +77,8 @@ struct config { + int daemon; + int flush_on_last_del; + int attribute_flags; ++ int fast_io_fail; ++ unsigned int dev_loss; + uid_t uid; + gid_t gid; + mode_t mode; +Index: multipath-tools-091020/libmultipath/propsel.c +=================================================================== +--- multipath-tools-091020.orig/libmultipath/propsel.c ++++ multipath-tools-091020/libmultipath/propsel.c +@@ -428,6 +428,48 @@ select_pg_timeout(struct multipath *mp) + } + + extern int ++select_fast_io_fail(struct multipath *mp) ++{ ++ if (mp->hwe && mp->hwe->fast_io_fail) { ++ mp->fast_io_fail = mp->hwe->fast_io_fail; ++ if (mp->fast_io_fail == -1) ++ condlog(3, "%s: fast_io_fail_tmo = off (controller default)", mp->alias); ++ else ++ condlog(3, "%s: fast_io_fail_tmo = %d (controller default)", mp->alias, mp->fast_io_fail); ++ return 0; ++ } ++ if (conf->fast_io_fail) { ++ mp->fast_io_fail = conf->fast_io_fail; ++ if (mp->fast_io_fail == -1) ++ condlog(3, "%s: fast_io_fail_tmo = off (config file default)", mp->alias); ++ else ++ condlog(3, "%s: fast_io_fail_tmo = %d (config file default)", mp->alias, mp->fast_io_fail); ++ return 0; ++ } ++ mp->fast_io_fail = 0; ++ return 0; ++} ++ ++extern int ++select_dev_loss(struct multipath *mp) ++{ ++ if (mp->hwe && mp->hwe->dev_loss) { ++ mp->dev_loss = mp->hwe->dev_loss; ++ condlog(3, "%s: dev_loss_tmo = %u (controller default)", ++ mp->alias, mp->dev_loss); ++ return 0; ++ } ++ if (conf->dev_loss) { ++ mp->dev_loss = conf->dev_loss; ++ condlog(3, "%s: dev_loss_tmo = %u (config file default)", ++ mp->alias, mp->dev_loss); ++ return 0; ++ } ++ mp->dev_loss = 0; ++ return 0; ++} ++ ++extern int + select_flush_on_last_del(struct multipath *mp) + { + if (mp->flush_on_last_del == FLUSH_IN_PROGRESS) +Index: multipath-tools-091020/libmultipath/structs.h +=================================================================== +--- multipath-tools-091020.orig/libmultipath/structs.h ++++ multipath-tools-091020/libmultipath/structs.h +@@ -166,6 +166,8 @@ struct multipath { + int pg_timeout; + int flush_on_last_del; + int attribute_flags; ++ int fast_io_fail; ++ unsigned int dev_loss; + uid_t uid; + gid_t gid; + mode_t mode; +Index: multipath-tools-091020/libmultipath/configure.c +=================================================================== +--- multipath-tools-091020.orig/libmultipath/configure.c ++++ multipath-tools-091020/libmultipath/configure.c +@@ -70,7 +70,10 @@ setup_map (struct multipath * mpp) + select_mode(mpp); + select_uid(mpp); + select_gid(mpp); ++ select_fast_io_fail(mpp); ++ select_dev_loss(mpp); + ++ sysfs_set_scsi_tmo(mpp); + /* + * assign paths to path groups -- start with no groups and all paths + * in mpp->paths +Index: multipath-tools-091020/libmultipath/discovery.c +=================================================================== +--- multipath-tools-091020.orig/libmultipath/discovery.c ++++ multipath-tools-091020/libmultipath/discovery.c +@@ -204,6 +204,43 @@ sysfs_get_fc_nodename (struct sysfs_devi + return 1; + } + ++int ++sysfs_set_scsi_tmo (struct multipath *mpp) ++{ ++ char attr_path[SYSFS_PATH_SIZE]; ++ struct path *pp; ++ int i; ++ char value[11]; ++ ++ if (!mpp->dev_loss && !mpp->fast_io_fail) ++ return 0; ++ vector_foreach_slot(mpp->paths, pp, i) { ++ if (safe_snprintf(attr_path, SYSFS_PATH_SIZE, ++ "/class/fc_remote_ports/rport-%d:%d-%d", ++ pp->sg_id.host_no, pp->sg_id.channel, ++ pp->sg_id.scsi_id)) { ++ condlog(0, "attr_path '/class/fc_remote_ports/rport-%d:%d-%d' too large", pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.scsi_id); ++ return 1; ++ } ++ if (mpp->dev_loss){ ++ snprintf(value, 11, "%u", mpp->dev_loss); ++ if (sysfs_attr_set_value(attr_path, "dev_loss_tmo", ++ value)) ++ return 1; ++ } ++ if (mpp->fast_io_fail){ ++ if (mpp->fast_io_fail == -1) ++ sprintf(value, "off"); ++ else ++ snprintf(value, 11, "%u", mpp->fast_io_fail); ++ if (sysfs_attr_set_value(attr_path, "fast_io_fail", ++ value)) ++ return 1; ++ } ++ } ++ return 0; ++} ++ + static int + opennode (char * dev, int mode) + { +Index: multipath-tools-091020/libmultipath/propsel.h +=================================================================== +--- multipath-tools-091020.orig/libmultipath/propsel.h ++++ multipath-tools-091020/libmultipath/propsel.h +@@ -15,3 +15,5 @@ int select_minio(struct multipath *mp); + int select_mode(struct multipath *mp); + int select_uid(struct multipath *mp); + int select_gid(struct multipath *mp); ++int select_fast_io_fail(struct multipath *mp); ++int select_dev_loss(struct multipath *mp); +Index: multipath-tools-091020/libmultipath/discovery.h +=================================================================== +--- multipath-tools-091020.orig/libmultipath/discovery.h ++++ multipath-tools-091020/libmultipath/discovery.h +@@ -33,6 +33,7 @@ int path_offline (struct path *); + int pathinfo (struct path *, vector hwtable, int mask); + struct path * store_pathinfo (vector pathvec, vector hwtable, + char * devname, int flag); ++int sysfs_set_scsi_tmo (struct multipath *mpp); + + /* + * discovery bitmask +Index: multipath-tools-091020/libmultipath/sysfs.c +=================================================================== +--- multipath-tools-091020.orig/libmultipath/sysfs.c ++++ multipath-tools-091020/libmultipath/sysfs.c +@@ -356,6 +356,62 @@ void sysfs_device_put(struct sysfs_devic + return; + } + ++int ++sysfs_attr_set_value(const char *devpath, const char *attr_name, ++ const char *value) ++{ ++ char path_full[PATH_SIZE]; ++ int sysfs_len; ++ struct stat statbuf; ++ int fd, value_len, ret = -1; ++ ++ dbg("open '%s'/'%s'", devpath, attr_name); ++ sysfs_len = snprintf(path_full, PATH_SIZE, "%s%s/%s", sysfs_path, ++ devpath, attr_name); ++ if (sysfs_len >= PATH_SIZE || sysfs_len < 0) { ++ if (sysfs_len < 0) ++ dbg("cannot copy sysfs path %s%s/%s : %s", sysfs_path, ++ devpath, attr_name, strerror(errno)); ++ else ++ dbg("sysfs_path %s%s/%s too large", sysfs_path, ++ devpath, attr_name); ++ goto out; ++ } ++ ++ if (stat(path_full, &statbuf) != 0) { ++ dbg("stat '%s' failed: %s" path_full, strerror(errno)); ++ goto out; ++ } ++ ++ /* skip directories */ ++ if (S_ISDIR(statbuf.st_mode)) ++ goto out; ++ ++ if ((statbuf.st_mode & S_IWUSR) == 0) ++ goto out; ++ ++ fd = open(path_full, O_WRONLY); ++ if (fd < 0) { ++ dbg("attribute '%s' can not be opened: %s", ++ path_full, strerror(errno)); ++ goto out; ++ } ++ value_len = strlen(value) + 1; ++ ret = write(fd, value, value_len); ++ if (ret == value_len) ++ ret = 0; ++ else if (ret < 0) ++ dbg("write to %s failed: %s", path_full, strerror(errno)); ++ else { ++ dbg("tried to write %d to %s. Wrote %d\n", value_len, ++ path_full, ret); ++ ret = -1; ++ } ++out: ++ return ret; ++} ++ ++ + char *sysfs_attr_get_value(const char *devpath, const char *attr_name) + { + char path_full[PATH_SIZE]; +Index: multipath-tools-091020/libmultipath/sysfs.h +=================================================================== +--- multipath-tools-091020.orig/libmultipath/sysfs.h ++++ multipath-tools-091020/libmultipath/sysfs.h +@@ -22,5 +22,6 @@ void sysfs_device_put(struct sysfs_devic + 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); +- ++int sysfs_attr_set_value(const char *devpath, const char *attr_name, ++ const char *value); + #endif diff --git a/pkgs/core/multipath-tools/patches/0003-RH-root-init-script.patch b/pkgs/core/multipath-tools/patches/0003-RH-root-init-script.patch new file mode 100644 index 0000000..c687537 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0003-RH-root-init-script.patch @@ -0,0 +1,84 @@ +From e6a23cc9de85a66d774567515592bdbdba7b2ca4 Mon Sep 17 00:00:00 2001 +From: Fabio M. Di Nitto fdinitto@redhat.com +Date: Tue, 13 Oct 2009 08:19:01 +0200 +Subject: [PATCH 03/12] RH: root init script + +Signed-off-by: Fabio M. Di Nitto fdinitto@redhat.com +--- +:100644 100644 ee776f0... e46b1b8... M multipathd/multipathd.init.redhat + multipathd/multipathd.init.redhat | 38 ++++++++++++++++++++++++++++++++++++- + 1 files changed, 37 insertions(+), 1 deletions(-) + +diff --git a/multipathd/multipathd.init.redhat b/multipathd/multipathd.init.redhat +index ee776f0..e46b1b8 100644 +--- a/multipathd/multipathd.init.redhat ++++ b/multipathd/multipathd.init.redhat +@@ -2,7 +2,7 @@ + # + # multipathd Starts the multipath daemon + # +-# chkconfig: - 13 87 ++# chkconfig: - 06 87 + # description: Manages device-mapper multipath devices + + ### BEGIN INIT INFO +@@ -17,6 +17,7 @@ prog=`basename $DAEMON` + initdir=/etc/rc.d/init.d + lockdir=/var/lock/subsys + sysconfig=/etc/sysconfig ++syspath=/sys/block + + + . $initdir/functions +@@ -25,6 +26,36 @@ test -r $sysconfig/$prog && . $sysconfig/$prog + + RETVAL=0 + ++teardown_slaves() ++{ ++pushd $1 > /dev/null ++if [ -d "slaves" ]; then ++for slave in slaves/*; ++do ++ if [ "$slave" = "slaves/*" ]; then ++ read dev < $1/dev ++ tablename=`dmsetup table --target multipath | sed -n "s/(.*): .* $dev .*/\1/p"` ++ if ! [ -z $tablename ]; then ++ echo "Root is on a multipathed device, multipathd can not be stopped" ++ exit 1 ++ fi ++ else ++ local_slave=`readlink -f $slave`; ++ teardown_slaves $local_slave; ++ fi ++ done ++ ++else ++ read dev < $1/dev ++ tablename=`dmsetup table --target multipath | sed -n "s/(.*): .* $dev .*/\1/p"` ++ if ! [ -z $tablename ]; then ++ echo "Root is on a multipathed device, multipathd can not be stopped" ++ exit 1 ++ fi ++fi ++popd > /dev/null ++} ++ + # + # See how we were called. + # +@@ -39,6 +70,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 ++ + echo -n $"Stopping $prog daemon: " + killproc $DAEMON + RETVAL=$? +-- +1.6.5.1 + diff --git a/pkgs/core/multipath-tools/patches/0003-for-upstream-default-configs.patch b/pkgs/core/multipath-tools/patches/0003-for-upstream-default-configs.patch new file mode 100644 index 0000000..fdd6347 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0003-for-upstream-default-configs.patch @@ -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, diff --git a/pkgs/core/multipath-tools/patches/0004-RH-fix-kpartx.patch b/pkgs/core/multipath-tools/patches/0004-RH-fix-kpartx.patch new file mode 100644 index 0000000..a28294d --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0004-RH-fix-kpartx.patch @@ -0,0 +1,48 @@ +From 8d443fe2c58e22166426438e6f6d5757934f7b31 Mon Sep 17 00:00:00 2001 +From: Fabio M. Di Nitto fdinitto@redhat.com +Date: Tue, 13 Oct 2009 08:23:42 +0200 +Subject: [PATCH 04/12] RH: fix kpartx + +Signed-off-by: Fabio M. Di Nitto fdinitto@redhat.com +--- +:100644 100644 b61a81f... 103ed0a... M kpartx/kpartx.c + kpartx/kpartx.c | 6 ++++-- + 1 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c +index b61a81f..103ed0a 100644 +--- a/kpartx/kpartx.c ++++ b/kpartx/kpartx.c +@@ -488,6 +488,7 @@ main(int argc, char **argv){ + d = c; + while (c) { + for (j = 0; j < n; j++) { ++ uint64_t start; + int k = slices[j].container - 1; + + if (slices[j].size == 0) +@@ -498,7 +499,7 @@ main(int argc, char **argv){ + continue; + + /* Skip all simple slices */ +- if (k < 0) ++ if (slices[j].container == 0) + continue; + + /* Check container slice */ +@@ -513,10 +514,11 @@ main(int argc, char **argv){ + } + strip_slash(partname); + ++ start = slices[j].start - slices[k].start; + if (safe_sprintf(params, "%d:%d %" PRIu64, + slices[k].major, + slices[k].minor, +- slices[j].start)) { ++ start)) { + fprintf(stderr, "params too small\n"); + exit(1); + } +-- +1.6.5.1 + diff --git a/pkgs/core/multipath-tools/patches/0005-RH-cciss_id.patch b/pkgs/core/multipath-tools/patches/0005-RH-cciss_id.patch new file mode 100644 index 0000000..bf61664 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0005-RH-cciss_id.patch @@ -0,0 +1,219 @@ +From a3db7def912c2fd3756cfd99c1165db075281caa Mon Sep 17 00:00:00 2001 +From: Fabio M. Di Nitto fdinitto@redhat.com +Date: Tue, 13 Oct 2009 09:26:02 +0200 +Subject: [PATCH 05/12] RH: cciss_id + +Signed-off-by: Fabio M. Di Nitto fdinitto@redhat.com +--- +:100644 100644 54be0a5... 7e4b7b1... M Makefile +:000000 100644 0000000... 6db12a4... A cciss_id/Makefile +:000000 100644 0000000... 091b5fe... A cciss_id/cciss_id.c + Makefile | 3 +- + cciss_id/Makefile | 47 +++++++++++++++++++ + cciss_id/cciss_id.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 177 insertions(+), 1 deletions(-) + +diff --git a/Makefile b/Makefile +index 54be0a5..7e4b7b1 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,7 +25,8 @@ BUILDDIRS = \ + libmultipath/checkers \ + multipath \ + multipathd \ +- kpartx ++ kpartx \ ++ cciss_id + + ifeq ($(MULTIPATH_VERSION),) + VERSION = $(shell basename ${PWD} | cut -d'-' -f3) +diff --git a/cciss_id/Makefile b/cciss_id/Makefile +new file mode 100644 +index 0000000..6db12a4 +--- /dev/null ++++ b/cciss_id/Makefile +@@ -0,0 +1,47 @@ ++ ++# ***************************************************************************** ++# * * ++# * (C) Copyright 2007 Hewlett-Packard Development Company, L.P * ++# * * ++# * This program is free software; you can redistribute it and/or modify it * ++# * under the terms of the GNU General Public License as published by the Free* ++# * Software Foundation; either version 2 of the License, or (at your option)* ++# * any later version. * ++# * * ++# * This program is distributed in the hope that it will be useful, but * ++# * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY* ++# * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * ++# * for more details. * ++# * * ++# * You should have received a copy of the GNU General Public License along * ++# * with this program; if not, write to the Free Software Foundation, Inc., * ++# * 675 Mass Ave, Cambridge, MA 02139, USA. * ++# * * ++# * * ++# * * ++# * * ++# ***************************************************************************** ++ ++include ../Makefile.inc ++ ++OBJS = cciss_id.o ++CFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes ++ ++LDFLAGS = -ldevmapper ++ ++EXEC = cciss_id ++ ++all: $(EXEC) ++ ++$(EXEC): $(OBJS) ++ $(CC) $(OBJS) -o $(EXEC) $(LDFLAGS) ++ ++install: ++ $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) ++ $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ ++ ++uninstall: ++ rm $(DESTDIR)$(bindir)/$(EXEC) ++ ++clean: ++ rm -f core.* *.o $(EXEC) *.gz +diff --git a/cciss_id/cciss_id.c b/cciss_id/cciss_id.c +new file mode 100644 +index 0000000..091b5fe +--- /dev/null ++++ b/cciss_id/cciss_id.c +@@ -0,0 +1,128 @@ ++/* ++ ***************************************************************************** ++ * * ++ * (C) Copyright 2007 Hewlett-Packard Development Company, L.P * ++ * * ++ * This program is free software; you can redistribute it and/or modify it * ++ * under the terms of the GNU General Public License as published by the Free* ++ * Software Foundation; either version 2 of the License, or (at your option)* ++ * any later version. * ++ * * ++ * This program is distributed in the hope that it will be useful, but * ++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY* ++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * ++ * for more details. * ++ * * ++ * You should have received a copy of the GNU General Public License along * ++ * with this program; if not, write to the Free Software Foundation, Inc., * ++ * 675 Mass Ave, Cambridge, MA 02139, USA. * ++ * * ++ * * ++ * * ++ * * ++ ***************************************************************************** ++*/ ++ ++#include <sys/types.h> ++#include <sys/stat.h> ++#include <sys/ioctl.h> ++#include <fcntl.h> ++#include <unistd.h> ++#include <stdio.h> ++#include <stdlib.h> ++#include <errno.h> ++#include <string.h> ++ ++#include <linux/cciss_ioctl.h> ++ ++#define LEN_PAGE83_CCISSDEV 0x20 /* Page length of 83h for cciss devices */ ++#define LEN_DEVICEFILE 255 /* Length of device file name */ ++#define PATH_CCISSDEV "/dev/cciss/" /* Path of CCISS devices */ ++int main(int argc, char *argv[]) ++{ ++ const int resp_len = LEN_PAGE83_CCISSDEV; ++ unsigned char resp[resp_len+1]; ++ char dev_name[LEN_DEVICEFILE] = "\0" ; ++ unsigned int lun_id = 0; ++ int fd, status, i; ++ struct stat file_stat; ++ ++ LogvolInfo_struct lvi; // logical "volume" info ++ IOCTL_Command_struct cic; // cciss ioctl command ++ ++ if(argc < 2) { ++ fprintf(stderr, "Usage: %s /dev/cciss/cNdN\n", argv[0]); ++ return -1; ++ } ++ ++ if ( strncmp(PATH_CCISSDEV, argv[1], strlen(PATH_CCISSDEV) ) != 0 ) { ++ if ( strchr(argv[1], '!') ) { ++ sprintf(dev_name, "%s%s", PATH_CCISSDEV, ++ strchr(argv[1], '!')+1); ++ } ++ //fprintf(stderr, "dev_name is: -%s-", dev_name); ++ } else { ++ sprintf(dev_name, "%s", argv[1]); ++ } ++ ++ if (stat(dev_name, &file_stat) < 0) { ++ fprintf (stderr, "Stat failed for file %s. Errno=%d\n", dev_name, errno); ++ return -1; ++ } ++ if (!S_ISBLK(file_stat.st_mode)) { ++ fprintf (stderr, "File %s is not a block device. \n", dev_name); ++ return -1; ++ } ++ ++ ++ if((fd = open(dev_name, O_RDWR)) < 0) { ++ fprintf(stderr, "Open failed for file %s. Errno=%d\n", dev_name, errno); ++ return -1; ++ } ++ ++ if (ioctl(fd, CCISS_GETLUNINFO, &lvi) < 0) { ++ fprintf(stderr, "IOCTL failure CCISS_GETLUNINFO for file %s Errno=%d\n", dev_name, errno); ++ close(fd); ++ return -1; ++ } else { ++ lun_id = lvi.LunID; ++ } ++ ++ memset(&cic, 0, sizeof(IOCTL_Command_struct)); ++ memset(resp, 0, resp_len+1); ++ cic.LUN_info.LogDev.Mode = 0x01; /* logical volume addressing */ ++ cic.LUN_info.LogDev.VolId = lun_id & 0x3FFFFFFF; ++ cic.Request.CDBLen = 6; ++ cic.Request.Type.Type = TYPE_CMD; // It is a command. ++ cic.Request.Type.Attribute = ATTR_SIMPLE; ++ cic.Request.Type.Direction = XFER_READ; // Read ++ cic.Request.Timeout = 0; // Don't time out ++ cic.Request.CDB[0] = 0x12; ++ cic.Request.CDB[1] = 0x01; /* EVPD (enable vital product data) */ ++ cic.Request.CDB[2] = 0x83; ++ cic.Request.CDB[4] = resp_len & 0xFF; ++ cic.buf_size = resp_len; ++ cic.buf = resp; ++ status = ioctl(fd, CCISS_PASSTHRU, &cic); ++ if(status) { ++ fprintf(stderr, "IOCTL failure CCISS_PASSTHRU for file %s Errno=%d\n", dev_name, errno); ++ close(fd); ++ return -1; ++ } ++ else { ++ if ((cic.error_info.CommandStatus | cic.error_info.ScsiStatus )) { ++ fprintf(stderr, "CCISS command status error for Inquiry on %s\n", ++ dev_name); ++ close(fd); ++ return -1; ++ } ++ printf("3"); ++ for(i=8; i<24; i++) ++ /* printf("Buff[%d] =%x\n", i, resp[i]); */ ++ printf("%02x", resp[i]); ++ printf("\n"); ++ } ++ ++ close(fd); ++ return 0; ++} +-- +1.6.5.1 + diff --git a/pkgs/core/multipath-tools/patches/0006-RH-move-bindings.patch b/pkgs/core/multipath-tools/patches/0006-RH-move-bindings.patch new file mode 100644 index 0000000..c26b5e8 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0006-RH-move-bindings.patch @@ -0,0 +1,56 @@ +From ff4c0c9ccbf8abe4a67c2a6cceef07bda9d38d7d Mon Sep 17 00:00:00 2001 +From: Fabio M. Di Nitto fdinitto@redhat.com +Date: Tue, 13 Oct 2009 09:26:25 +0200 +Subject: [PATCH 06/12] RH: move bindings + +Signed-off-by: Fabio M. Di Nitto fdinitto@redhat.com +--- +:100644 100644 84e5d6b... 5a38d25... M libmultipath/defaults.h +:100644 100644 9afa615... 7b6453f... M multipath.conf.annotated +:100644 100644 a165e4e... 4340e51... M multipath/multipath.conf.5 + libmultipath/defaults.h | 2 +- + multipath.conf.annotated | 2 +- + multipath/multipath.conf.5 | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h +index 84e5d6b..5a38d25 100644 +--- a/libmultipath/defaults.h ++++ b/libmultipath/defaults.h +@@ -19,6 +19,6 @@ + #define DEFAULT_PIDFILE "/var/run/multipathd.pid" + #define DEFAULT_SOCKET "/var/run/multipathd.sock" + #define DEFAULT_CONFIGFILE "/etc/multipath.conf" +-#define DEFAULT_BINDINGS_FILE "/var/lib/multipath/bindings" ++#define DEFAULT_BINDINGS_FILE "/etc/multipath/bindings" + + char * set_default (char * str); +diff --git a/multipath.conf.annotated b/multipath.conf.annotated +index 9afa615..7b6453f 100644 +--- a/multipath.conf.annotated ++++ b/multipath.conf.annotated +@@ -165,7 +165,7 @@ + # # name : user_friendly_names + # # scope : multipath + # # desc : If set to "yes", using the bindings file +-# # /var/lib/multipath/bindings to assign a persistent and ++# # /etc/multipath/bindings to assign a persistent and + # # unique alias to the multipath, in the form of mpath<n>. + # # If set to "no" use the WWID as the alias. In either case + # # this be will be overriden by any specific aliases in this +diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 +index a165e4e..4340e51 100644 +--- a/multipath/multipath.conf.5 ++++ b/multipath/multipath.conf.5 +@@ -224,7 +224,7 @@ for never stop queueing. Default is 0. + If set to + .I yes + , using the bindings file +-.I /var/lib/multipath/bindings ++.I /etc/multipath/bindings + to assign a persistent and unique alias to the multipath, in the form of mpath<n>. + If set to + .I no +-- +1.6.5.1 + diff --git a/pkgs/core/multipath-tools/patches/0007-RH-do-not-remove.patch b/pkgs/core/multipath-tools/patches/0007-RH-do-not-remove.patch new file mode 100644 index 0000000..1b27c76 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0007-RH-do-not-remove.patch @@ -0,0 +1,39 @@ +From b3519ef2eda768672d47c61f0acf8c87d74db427 Mon Sep 17 00:00:00 2001 +From: Fabio M. Di Nitto fdinitto@redhat.com +Date: Tue, 13 Oct 2009 09:33:59 +0200 +Subject: [PATCH 07/12] RH: do not remove + +Signed-off-by: Fabio M. Di Nitto fdinitto@redhat.com +--- +:100644 100644 5d3625a... 244b8d5... M multipathd/main.c + multipathd/main.c | 13 ++++++++++++- + 1 files changed, 12 insertions(+), 1 deletions(-) + +diff --git a/multipathd/main.c b/multipathd/main.c +index 5d3625a..244b8d5 100644 +--- a/multipathd/main.c ++++ b/multipathd/main.c +@@ -290,8 +290,19 @@ ev_add_map (struct sysfs_device * dev, struct vectors * vecs) + static int + uev_remove_map (struct sysfs_device * dev, struct vectors * vecs) + { ++ struct multipath * mpp; ++ + condlog(2, "%s: remove map (uevent)", dev->kernel); +- return ev_remove_map(dev->kernel, vecs); ++ ++ mpp = find_mp_by_str(vecs->mpvec, dev->kernel); ++ if (!mpp) { ++ condlog(2, "%s: devmap not registered, can't remove", ++ dev->kernel); ++ return 0; ++ } ++ orphan_paths(vecs->pathvec, mpp); ++ remove_map_and_stop_waiter(mpp, vecs, 1); ++ return 0; + } + + int +-- +1.6.5.1 + diff --git a/pkgs/core/multipath-tools/patches/0008-RH-Make-build-system-RH-Fedora-friendly.patch b/pkgs/core/multipath-tools/patches/0008-RH-Make-build-system-RH-Fedora-friendly.patch new file mode 100644 index 0000000..9e6e3a0 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0008-RH-Make-build-system-RH-Fedora-friendly.patch @@ -0,0 +1,62 @@ +From f5e11246063b07d6dce6d37d3b74662475baa981 Mon Sep 17 00:00:00 2001 +From: Fabio M. Di Nitto fdinitto@redhat.com +Date: Thu, 15 Oct 2009 04:39:27 +0200 +Subject: [PATCH 08/12] RH: Make build system RH/Fedora friendly + +Signed-off-by: Fabio M. Di Nitto fdinitto@redhat.com +--- +:100644 100644 7ec25d5... 06fb625... M Makefile.inc +:100644 100644 21e4ad4... 06d79c0... M kpartx/Makefile +:100644 100644 32d9ef5... 25e1483... M multipathd/Makefile + Makefile.inc | 2 +- + kpartx/Makefile | 8 ++++---- + multipathd/Makefile | 1 + + 3 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/Makefile.inc b/Makefile.inc +index 7ec25d5..06fb625 100644 +--- a/Makefile.inc ++++ b/Makefile.inc +@@ -28,7 +28,7 @@ libudevdir = ${prefix}/lib/udev + multipathdir = $(TOPDIR)/libmultipath + mandir = $(prefix)/usr/share/man/man8 + man5dir = $(prefix)/usr/share/man/man5 +-rcdir = $(prefix)/etc/init.d ++rcdir = $(prefix)/etc/rc.d/init.d + syslibdir = $(prefix)/$(LIB) + libdir = $(prefix)/$(LIB)/multipath + +diff --git a/kpartx/Makefile b/kpartx/Makefile +index 21e4ad4..06d79c0 100644 +--- a/kpartx/Makefile ++++ b/kpartx/Makefile +@@ -20,10 +20,10 @@ $(EXEC): $(OBJS) + install: $(EXEC) $(EXEC).8 + $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir) +- $(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir) +- $(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir) +- $(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d +- $(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)/etc/udev/rules.d/ ++# $(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir) ++# $(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir) ++# $(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d ++# $(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)/etc/udev/rules.d/ + $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) + +diff --git a/multipathd/Makefile b/multipathd/Makefile +index 32d9ef5..25e1483 100644 +--- a/multipathd/Makefile ++++ b/multipathd/Makefile +@@ -35,6 +35,7 @@ install: + $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(rcdir) ++ $(INSTALL_PROGRAM) -m 755 multipathd.init.redhat $(DESTDIR)$(rcdir)/$(EXEC) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) + +-- +1.6.5.1 + diff --git a/pkgs/core/multipath-tools/patches/0009-RH-multipathd-blacklist-all-by-default.patch b/pkgs/core/multipath-tools/patches/0009-RH-multipathd-blacklist-all-by-default.patch new file mode 100644 index 0000000..df4b4c7 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0009-RH-multipathd-blacklist-all-by-default.patch @@ -0,0 +1,70 @@ +From 61b2002c6b2752c15b431e400cd614edc8c5b039 Mon Sep 17 00:00:00 2001 +From: Fabio M. Di Nitto fdinitto@redhat.com +Date: Mon, 19 Oct 2009 07:05:45 +0200 +Subject: [PATCH 09/12] RH: multipathd blacklist all by default + +If there is no configuration installed on the system, blacklist +everything by default. + +BZ#528059 + +Signed-off-by: Fabio M. Di Nitto fdinitto@redhat.com +--- +:100644 100644 e7e962e... 5aa1ab0... M libmultipath/config.c +:100644 100644 86b1320... 7e90e75... M libmultipath/config.h + libmultipath/config.c | 18 +++++++++++++++++- + libmultipath/config.h | 1 + + 2 files changed, 18 insertions(+), 1 deletions(-) + +diff --git a/libmultipath/config.c b/libmultipath/config.c +index e7e962e..5aa1ab0 100644 +--- a/libmultipath/config.c ++++ b/libmultipath/config.c +@@ -19,6 +19,7 @@ + #include "blacklist.h" + #include "defaults.h" + #include "prio.h" ++#include "version.h" + + static int + hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2) +@@ -463,8 +464,23 @@ load_config (char * file) + condlog(0, "error parsing config file"); + goto out; + } ++ } else { ++ condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices."); ++ condlog(0, "A default multipath.conf file is located at"); ++ condlog(0, ++"/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", ++ MULTIPATH_VERSION(VERSION_CODE)); ++ conf->blist_devnode = vector_alloc(); ++ if (!conf->blist_devnode) { ++ condlog(0, "cannot allocate blacklist\n"); ++ goto out; ++ } ++ if (store_ble(conf->blist_devnode, strdup(".*"), ++ ORIGIN_NO_CONFIG)) { ++ condlog(0, "cannot store default no-config blacklist\n"); ++ goto out; ++ } + } +- + /* + * remove duplica in hwtable. config file takes precedence + * over build-in hwtable +diff --git a/libmultipath/config.h b/libmultipath/config.h +index 86b1320..7e90e75 100644 +--- a/libmultipath/config.h ++++ b/libmultipath/config.h +@@ -5,6 +5,7 @@ + + #define ORIGIN_DEFAULT 0 + #define ORIGIN_CONFIG 1 ++#define ORIGIN_NO_CONFIG 2 + + enum devtypes { + DEV_NONE, +-- +1.6.5.1 + diff --git a/pkgs/core/multipath-tools/patches/0010-RH-multipath-rules-udev-changes.patch b/pkgs/core/multipath-tools/patches/0010-RH-multipath-rules-udev-changes.patch new file mode 100644 index 0000000..4250ec7 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0010-RH-multipath-rules-udev-changes.patch @@ -0,0 +1,58 @@ +From 5a43356b54c2672441ce67cd9602904a5df04117 Mon Sep 17 00:00:00 2001 +From: Fabio M. Di Nitto fdinitto@redhat.com +Date: Mon, 19 Oct 2009 07:07:01 +0200 +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 +++++++++++------- + 2 files changed, 14 insertions(+), 10 deletions(-) + +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. +-# The persistent symlinks are created with the kpartx rules +-# +- +-# socket for uevents +-SUBSYSTEM=="block", RUN+="socket:/org/kernel/dm/multipath_event" ++# multipath wants the devmaps presented as meaninglful device names ++# so name them after their devmap name ++SUBSYSTEM!="block", GOTO="end_mpath" ++RUN+="socket:/org/kernel/dm/multipath_event" ++KERNEL!="dm-*", GOTO="end_mpath" ++ACTION!="change", GOTO="end_mpath" ++ENV{DM_SUSPENDED}=="1", GOTO="end_mpath" ++ENV{DM_UUID}!="mpath-?*", GOTO="end_mpath" ++ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath" ++RUN+="$env{DM_SBIN_PATH}/kpartx -a -p p $tempnode" ++LABEL="end_mpath" +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 diff --git a/pkgs/core/multipath-tools/patches/0011-RH-fix-init-script-LSB-headers.patch b/pkgs/core/multipath-tools/patches/0011-RH-fix-init-script-LSB-headers.patch new file mode 100644 index 0000000..4e305ad --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0011-RH-fix-init-script-LSB-headers.patch @@ -0,0 +1,29 @@ +From 887b0721d29eed45621b5a7fefaf462378cc9dcd Mon Sep 17 00:00:00 2001 +From: Fabio M. Di Nitto fdinitto@redhat.com +Date: Mon, 19 Oct 2009 08:33:07 +0200 +Subject: [PATCH 11/12] RH: fix init script LSB headers + +Signed-off-by: Fabio M. Di Nitto fdinitto@redhat.com +--- +:100644 100644 e46b1b8... cfc9cf5... M multipathd/multipathd.init.redhat + multipathd/multipathd.init.redhat | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/multipathd/multipathd.init.redhat b/multipathd/multipathd.init.redhat +index e46b1b8..cfc9cf5 100644 +--- a/multipathd/multipathd.init.redhat ++++ b/multipathd/multipathd.init.redhat +@@ -7,6 +7,10 @@ + + ### BEGIN INIT INFO + # Provides: multipathd ++# Required-Start: ++# Required-Stop: ++# Default-Start: ++# Default-Stop: + # Short-Description: Control multipathd + # Description: This service monitors and manages + # device-mapper multipath devices +-- +1.6.5.1 + diff --git a/pkgs/core/multipath-tools/patches/0012-RH-udev-sync-support.patch b/pkgs/core/multipath-tools/patches/0012-RH-udev-sync-support.patch new file mode 100644 index 0000000..b30828c --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0012-RH-udev-sync-support.patch @@ -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: diff --git a/pkgs/core/multipath-tools/patches/0013-RH-add-weighted_prio-prioritizer.patch b/pkgs/core/multipath-tools/patches/0013-RH-add-weighted_prio-prioritizer.patch new file mode 100644 index 0000000..63b493b --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0013-RH-add-weighted_prio-prioritizer.patch @@ -0,0 +1,546 @@ +--- + 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.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); + ++ if (hwe->prio_args) ++ FREE(hwe->prio_args); ++ + if (hwe->bl_product) + FREE(hwe->bl_product); + +@@ -195,6 +198,12 @@ free_mpe (struct mpentry * mpe) + if (mpe->alias) + FREE(mpe->alias); + ++ if (mpe->prio_name) ++ FREE(mpe->prio_name); ++ ++ if (mpe->prio_args) ++ FREE(mpe->prio_args); ++ + FREE(mpe); + } + +@@ -279,6 +288,7 @@ merge_hwe (struct hwentry * hwe1, struct + merge_str(selector); + merge_str(checker_name); + merge_str(prio_name); ++ merge_str(prio_args); + merge_str(bl_product); + merge_num(pgpolicy); + merge_num(pgfailback); +Index: multipath-tools/libmultipath/config.h +=================================================================== +--- 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; ++ char * prio_args; + + int pgpolicy; + int pgfailback; +@@ -43,6 +44,8 @@ struct mpentry { + char * alias; + char * getuid; + char * selector; ++ char * prio_name; ++ char * prio_args; + + int pgpolicy; + int pgfailback; +@@ -97,6 +100,7 @@ struct config { + char * hwhandler; + char * bindings_file; + char * prio_name; ++ char * prio_args; + char * checker_name; + + vector keywords; +Index: multipath-tools/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) + { +- conf->prio_name = set_value(strvec); ++ char *name, *args; + +- if (!conf->prio_name) ++ name = set_value(strvec); ++ if (!name) + return 1; + ++ args = strpbrk(name, " \t"); ++ if (args) { ++ *args = 0; ++ while(*++args && isblank(*args)); /* Do nothing */ ++ } ++ ++ conf->prio_name = STRDUP(name); ++ if (args && *args) ++ conf->prio_args = STRDUP(args); ++ ++ FREE(name); + return 0; + } + +@@ -806,16 +818,27 @@ hw_handler_handler(vector strvec) + static int + hw_prio_handler(vector strvec) + { ++ char *name, *args; + struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); + + if (!hwe) + return 1; + +- hwe->prio_name = set_value(strvec); +- +- if (!hwe->prio_name) ++ name = set_value(strvec); ++ if (!name) + return 1; + ++ args = strpbrk(name, " \t"); ++ if (args) { ++ *args = 0; ++ while(*++args && isblank(*args)); /* Do nothing */ ++ } ++ ++ hwe->prio_name = STRDUP(name); ++ if (args && *args) ++ hwe->prio_args = STRDUP(args); ++ ++ FREE(name); + return 0; + } + +@@ -1293,6 +1316,33 @@ mp_flush_on_last_del_handler(vector strv + return 0; + } + ++static int ++mp_prio_handler(vector strvec) ++{ ++ char *name, *args; ++ struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable); ++ ++ if (!mpe) ++ return 1; ++ ++ name = set_value(strvec); ++ if (!name) ++ return 1; ++ ++ args = strpbrk(name, " \t"); ++ if (args) { ++ *args = 0; ++ while(*++args && isblank(*args)); /* Do nothing */ ++ } ++ ++ mpe->prio_name = STRDUP(name); ++ if (args && *args) ++ mpe->prio_args = STRDUP(args); ++ ++ FREE(name); ++ return 0; ++} ++ + /* + * config file keywords printing + */ +@@ -1472,6 +1522,20 @@ snprint_mp_flush_on_last_del (char * buf + } + + static int ++snprint_mp_prio (char * buff, int len, void * data) ++{ ++ struct mpentry * mpe = (struct mpentry *)data; ++ ++ if (!mpe->prio_name) ++ return 0; ++ if (!strcmp(mpe->prio_name, conf->prio_name) && !mpe->prio_args) ++ return 0; ++ if (!mpe->prio_args) ++ return snprintf(buff, len, "%s", mpe->prio_name); ++ return snprintf(buff, len, "%s %s", mpe->prio_name, mpe->prio_args); ++} ++ ++static int + snprint_hw_fast_io_fail(char * buff, int len, void * data) + { + struct hwentry * hwe = (struct hwentry *)data; +@@ -1545,10 +1609,11 @@ snprint_hw_prio (char * buff, int len, v + + if (!hwe->prio_name) + return 0; +- if (!strcmp(hwe->prio_name, conf->prio_name)) ++ if (!strcmp(hwe->prio_name, conf->prio_name) && !hwe->prio_args) + return 0; +- +- return snprintf(buff, len, "%s", hwe->prio_name); ++ if (!hwe->prio_args) ++ return snprintf(buff, len, "%s", hwe->prio_name); ++ return snprintf(buff, len, "%s %s", hwe->prio_name, hwe->prio_args); + } + + static int +@@ -1837,10 +1902,14 @@ snprint_def_prio (char * buff, int len, + return 0; + + if (strlen(conf->prio_name) == strlen(DEFAULT_PRIO) && +- !strcmp(conf->prio_name, DEFAULT_PRIO)) ++ !strcmp(conf->prio_name, DEFAULT_PRIO) && !conf->prio_args) + return 0; +- +- return snprintf(buff, len, "%s", conf->prio_name); ++ ++ if (!conf->prio_args) ++ return snprintf(buff, len, "%s", conf->prio_name); ++ else ++ return snprintf(buff, len, "%s %s", conf->prio_name, ++ conf->prio_args); + } + + static int +@@ -2146,5 +2215,6 @@ init_keywords(void) + install_keyword("mode", &mp_mode_handler, &snprint_mp_mode); + install_keyword("uid", &mp_uid_handler, &snprint_mp_uid); + install_keyword("gid", &mp_gid_handler, &snprint_mp_gid); ++ install_keyword("prio", &mp_prio_handler, &snprint_mp_prio); + install_sublevel_end(); + } +Index: multipath-tools/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) + } + + static int +-get_prio (struct path * pp) +-{ +- if (!pp) +- return 0; +- +- if (!pp->prio) { +- select_prio(pp); +- if (!pp->prio) { +- condlog(3, "%s: no prio selected", pp->dev); +- return 1; +- } +- } +- pp->priority = prio_getprio(pp->prio, pp); +- if (pp->priority < 0) { +- condlog(3, "%s: %s prio error", pp->dev, prio_name(pp->prio)); +- pp->priority = PRIO_UNDEF; +- return 1; +- } +- condlog(3, "%s: %s prio = %u", +- pp->dev, prio_name(pp->prio), pp->priority); +- return 0; +-} +- +-static int + get_uid (struct path * pp) + { + char buff[CALLOUT_MAX_SIZE]; +@@ -850,6 +826,32 @@ get_uid (struct path * pp) + return 0; + } + ++static int ++get_prio (struct path * pp) ++{ ++ if (!pp) ++ return 0; ++ ++ if (!pp->prio) { ++ if (!strlen(pp->wwid)) ++ get_uid(pp); ++ select_prio(pp); ++ if (!pp->prio) { ++ condlog(3, "%s: no prio selected", pp->dev); ++ return 1; ++ } ++ } ++ pp->priority = prio_getprio(pp->prio, pp); ++ if (pp->priority < 0) { ++ condlog(3, "%s: %s prio error", pp->dev, prio_name(pp->prio)); ++ pp->priority = PRIO_UNDEF; ++ return 1; ++ } ++ condlog(3, "%s: %s prio = %u", ++ pp->dev, prio_name(pp->prio), pp->priority); ++ return 0; ++} ++ + extern int + pathinfo (struct path *pp, vector hwtable, int mask) + { +@@ -887,6 +889,9 @@ pathinfo (struct path *pp, vector hwtabl + goto blank; + } + ++ if (mask & DI_WWID && !strlen(pp->wwid)) ++ get_uid(pp); ++ + /* + * Retrieve path priority, even for PATH_DOWN paths if it has never + * been successfully obtained before. +@@ -895,9 +900,6 @@ pathinfo (struct path *pp, vector hwtabl + (pp->state != PATH_DOWN || pp->priority == PRIO_UNDEF)) + get_prio(pp); + +- if (mask & DI_WWID && !strlen(pp->wwid)) +- get_uid(pp); +- + return 0; + + blank: +Index: multipath-tools/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" + #define PRIO_RDAC "rdac" ++#define PRIO_WEIGHTED "weighted" + + /* + * Value used to mark the fact prio was not defined +Index: multipath-tools/libmultipath/prioritizers/Makefile +=================================================================== +--- multipath-tools.orig/libmultipath/prioritizers/Makefile ++++ multipath-tools/libmultipath/prioritizers/Makefile +@@ -13,7 +13,8 @@ LIBS = \ + libprioalua.so \ + libpriotpg_pref.so \ + libprionetapp.so \ +- libpriohds.so ++ libpriohds.so \ ++ libprioweighted.so \ + + CFLAGS += -I.. + +Index: multipath-tools/libmultipath/prioritizers/weighted.c +=================================================================== +--- /dev/null ++++ multipath-tools/libmultipath/prioritizers/weighted.c +@@ -0,0 +1,139 @@ ++/****************************************************************************** ++******************************************************************************* ++** ++** Copyright (C) 2009 Red Hat, Inc. All rights reserved. ++** ++** This copyrighted material is made available to anyone wishing to use, ++** modify, copy, or redistribute it subject to the terms and conditions ++** of the GNU General Public License v.2. ++** ++******************************************************************************* ++******************************************************************************/ ++ ++/* This prioritizer is based on a path's device name or its H:T:B:L. Both of ++ * these can change when the node is rebooted, and can differ from node to ++ * node. (i.e. there is no guarantee that sda will point to the same device ++ * after a reboot) If you use this prioritizer, it may be necessary to ++ * manually edit /etc/multipath.conf after any reboot ++ * ++ * Format: ++ * prio "weighted hbtl <regex> <prio> [<regex> <prio>] ++ * prio "weighted devname <regex> <prio> [<regex> <prio>] ++ * ++ * Examples: ++ * prio "weighted hbtl 4:* 2 3:.:.:. 1" ++ * prio "weighted devname sda 2 sde 1" ++ * ++ */ ++ ++#include <string.h> ++#include <prio.h> ++#include <debug.h> ++#include <regex.h> ++ ++#include "weighted.h" ++ ++#define DEFAULT_WEIGHTED_PRIO 0 ++ ++#define pp_weighted_log(prio, fmt, args...) \ ++ condlog(prio, "%s: weighted prio: " fmt, dev, ##args) ++ ++static char * ++next_str(char **str) ++{ ++ char *next; ++ ++ do { ++ next = strsep(str, " \t"); ++ } while (next && strcmp(next, "") == 0); ++ return next; ++} ++ ++ ++static int ++match (char *dev, char *target, char *regex_str, char *prio_str, ++ unsigned int *prio) ++{ ++ ++ regex_t regex; ++ int err, ret = 0; ++ char *errbuf; ++ size_t errbuf_size; ++ unsigned int prio_match; ++ ++ if (sscanf(prio_str, "%u", &prio_match) != 1) { ++ condlog(0, "%s: weighted prio: invalid prio '%s'", dev, ++ prio_str); ++ return 0; ++ } ++ err = regcomp(®ex, regex_str, REG_EXTENDED|REG_NOSUB); ++ if (err) { ++ errbuf_size = regerror(err, ®ex, NULL, 0); ++ errbuf = malloc(errbuf_size); ++ regerror(err, ®ex, errbuf, errbuf_size); ++ condlog(0, "%s: weighted prio: cannot compile regex '%s' : %s", ++ dev, regex_str, errbuf); ++ free(errbuf); ++ return 0; ++ } ++ if (regexec(®ex, target, 0, NULL, 0) == 0) { ++ *prio = prio_match; ++ ret = 1; ++ } ++ ++ regfree(®ex); ++ return ret; ++} ++ ++int ++prio_weighted(struct path * pp) ++{ ++ char target[FILE_NAME_SIZE]; ++ char *buff, *args, *ptr, *prio_str; ++ unsigned int prio = DEFAULT_WEIGHTED_PRIO; ++ char *regex_str = NULL; ++ int regex_size = 0; ++ ++ if (!pp->prio_args) ++ return DEFAULT_WEIGHTED_PRIO; ++ buff = args = strdup(pp->prio_args); ++ ptr = next_str(&args); ++ ++ if (strcasecmp(ptr, "hbtl") == 0) ++ sprintf(target, "%d:%d:%d:%d", pp->sg_id.host_no, ++ pp->sg_id.channel, pp->sg_id.scsi_id, pp->sg_id.lun); ++ else if (strcasecmp(ptr, "devname") == 0) ++ strcpy(target, pp->dev); ++ else { ++ condlog(0, "%s: weighted prio: invalid argument. Want 'hbtl' or 'devname'. Got '%s'", pp->dev, ptr); ++ goto out; ++ } ++ ++ while ((ptr = next_str(&args)) != NULL) { ++ ++ prio_str = next_str(&args); ++ if (!prio_str) { ++ condlog(0, "%s weighted prio: missing prio for regex '%s'", pp->dev, ptr); ++ goto out; ++ } ++ if (!regex_str || regex_size < strlen(ptr) + 3){ ++ regex_size = strlen(ptr) + 3; ++ regex_str = realloc(regex_str, regex_size); ++ } ++ sprintf(regex_str, "%s%s%s", (ptr[0] == '^')? "" : "^", ++ ptr, (ptr[strlen(ptr)-1] == '$')? "" : "$"); ++ if (match(pp->dev, target, regex_str, prio_str, &prio)) ++ break; ++ } ++out: ++ free(buff); ++ if (regex_str) ++ free(regex_str); ++ return prio; ++} ++ ++int ++getprio(struct path * pp) ++{ ++ return prio_weighted(pp); ++} +Index: multipath-tools/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) + { ++ struct mpentry * mpe; ++ ++ if ((mpe = find_mpe(pp->wwid)) && mpe->prio_name) { ++ pp->prio = prio_lookup(mpe->prio_name); ++ pp->prio_args = mpe->prio_args; ++ condlog(3, "%s: prio = %s (LUN setting)", ++ pp->dev, mpe->prio_name); ++ return 0; ++ } + if (pp->hwe && pp->hwe->prio_name) { + pp->prio = prio_lookup(pp->hwe->prio_name); ++ pp->prio_args = pp->hwe->prio_args; + 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_args = conf->prio_args; + condlog(3, "%s: prio = %s (config file default)", + pp->dev, conf->prio_name); + return 0; +Index: multipath-tools/libmultipath/structs.h +=================================================================== +--- multipath-tools.orig/libmultipath/structs.h ++++ multipath-tools/libmultipath/structs.h +@@ -142,6 +142,7 @@ struct path { + int priority; + int pgindex; + char * getuid; ++ char * prio_args; + struct prio * prio; + struct checker checker; + struct multipath * mpp; +Index: multipath-tools/libmultipath/prioritizers/weighted.h +=================================================================== +--- /dev/null ++++ multipath-tools/libmultipath/prioritizers/weighted.h +@@ -0,0 +1,8 @@ ++#ifndef _WEIGHTED_H ++#define _WEIGHTED_H ++ ++#define PRIO_WEIGHTED "weighted" ++ ++int prio_weighted(struct path *pp); ++ ++#endif diff --git a/pkgs/core/multipath-tools/patches/0014-RH-add-hp_tur-checker.patch b/pkgs/core/multipath-tools/patches/0014-RH-add-hp_tur-checker.patch new file mode 100644 index 0000000..33dd43a --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0014-RH-add-hp_tur-checker.patch @@ -0,0 +1,231 @@ +--- + libmultipath/checkers.h | 3 + + libmultipath/checkers/Makefile | 4 + + libmultipath/checkers/tur.c | 111 +++++++++++++++++++++++++++++++++++++++++ + multipath.conf.annotated | 5 + + 4 files changed, 121 insertions(+), 2 deletions(-) + +Index: multipath-tools/libmultipath/checkers.h +=================================================================== +--- multipath-tools.orig/libmultipath/checkers.h ++++ multipath-tools/libmultipath/checkers.h +@@ -60,6 +60,7 @@ enum path_check_state { + + #define DIRECTIO "directio" + #define TUR "tur" ++#define HP_TUR "hp_tur" + #define HP_SW "hp_sw" + #define RDAC "rdac" + #define EMC_CLARIION "emc_clariion" +@@ -91,6 +92,7 @@ enum path_check_state { + #define CHECKER_MSG_LEN 256 + #define CHECKER_DEV_LEN 256 + #define LIB_CHECKER_NAMELEN 256 ++#define WWID_SIZE 128 + + struct checker { + struct list_head node; +@@ -99,6 +101,7 @@ struct checker { + int disable; + char name[CHECKER_NAME_LEN]; + char message[CHECKER_MSG_LEN]; /* comm with callers */ ++ char wwid[WWID_SIZE]; /* LUN wwid */ + void * context; /* store for persistent data */ + void ** mpcontext; /* store for persistent data shared + multipath-wide. Use MALLOC if +Index: multipath-tools/libmultipath/checkers/Makefile +=================================================================== +--- multipath-tools.orig/libmultipath/checkers/Makefile ++++ multipath-tools/libmultipath/checkers/Makefile +@@ -8,6 +8,7 @@ LIBS= \ + libcheckcciss_tur.so \ + libcheckreadsector0.so \ + libchecktur.so \ ++ libcheckhp_tur.so \ + libcheckdirectio.so \ + libcheckemc_clariion.so \ + libcheckhp_sw.so \ +@@ -23,6 +24,9 @@ libcheckdirectio.so: libsg.o directio.o + libcheck%.so: libsg.o %.o + $(CC) $(SHARED_FLAGS) -o $@ $^ + ++hp_tur.o: tur.c ++ $(CC) $(CFLAGS) -DCHECK_WWID -c -o $@ $< ++ + install: + $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(libdir) + +Index: multipath-tools/libmultipath/checkers/tur.c +=================================================================== +--- multipath-tools.orig/libmultipath/checkers/tur.c ++++ multipath-tools/libmultipath/checkers/tur.c +@@ -15,14 +15,101 @@ + + #include "checkers.h" + ++#include "../libmultipath/debug.h" + #include "../libmultipath/sg_include.h" + + #define TUR_CMD_LEN 6 + #define HEAVY_CHECK_COUNT 10 + ++#ifdef CHECK_WWID ++#define MSG_TUR_UP "HP tur checker reports path is up" ++#define MSG_TUR_DOWN "HP tur checker reports path is down" ++#define MSG_TUR_GHOST "HP tur checker reports path is in standby state" ++#define EVPD 0x01 ++#define PAGE_83 0x83 ++#define INQUIRY_CMD 0x12 ++#define INQUIRY_CMDLEN 6 ++#define SCSI_INQ_BUFF_LEN 96 ++#else + #define MSG_TUR_UP "tur checker reports path is up" + #define MSG_TUR_DOWN "tur checker reports path is down" + #define MSG_TUR_GHOST "tur checker reports path is in standby state" ++#endif ++ ++#ifdef CHECK_WWID ++static int ++do_inq(struct checker * c, char * wwid) ++{ ++ int ret = -1; ++ unsigned char inq_cmd[INQUIRY_CMDLEN] = ++ {INQUIRY_CMD, EVPD, PAGE_83, 0, SCSI_INQ_BUFF_LEN, 0 }; ++ unsigned char sense_buffer[32]; ++ unsigned char resp_buffer[SCSI_INQ_BUFF_LEN]; ++ char *pbuff; ++ ++ int m,k; ++ int retry_tur = 5; ++ struct sg_io_hdr io_hdr; ++ ++retry: ++ memset(resp_buffer, 0, sizeof(resp_buffer)); ++ memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); ++ ++ io_hdr.interface_id = 'S'; ++ io_hdr.cmd_len = sizeof(inq_cmd); ++ io_hdr.mx_sb_len = sizeof(sense_buffer); ++ io_hdr.dxfer_direction = -3; // Data transfer from the device. ++ io_hdr.dxfer_len = sizeof(resp_buffer); ++ io_hdr.dxferp = (unsigned char *)resp_buffer; ++ io_hdr.cmdp = inq_cmd; ++ io_hdr.sbp = sense_buffer; ++ io_hdr.timeout = 60; // IOCTL timeout value. ++ ++ if (ioctl(c->fd, SG_IO, &io_hdr) < 0) { ++ condlog(0, "SG_IO ioctl failed: %s", strerror(errno)); ++ return ret; ++ } ++ if (io_hdr.info & SG_INFO_OK_MASK){ ++ int key = 0, asc, ascq; ++ ++ if (io_hdr.host_status == DID_BUS_BUSY || ++ io_hdr.host_status == DID_ERROR || ++ io_hdr.host_status == DID_TRANSPORT_DISRUPTED) { ++ if (--retry_tur) ++ goto retry; ++ } ++ if (io_hdr.sb_len_wr > 3) { ++ if (io_hdr.sbp[0] == 0x72 || io_hdr.sbp[0] == 0x73) { ++ key = io_hdr.sbp[1] & 0x0f; ++ asc = io_hdr.sbp[2]; ++ ascq = io_hdr.sbp[3]; ++ } else if (io_hdr.sb_len_wr > 13 && ++ ((io_hdr.sbp[0] & 0x7f) == 0x70 || ++ (io_hdr.sbp[0] & 0x7f) == 0x71)) { ++ key = io_hdr.sbp[2] & 0x0f; ++ asc = io_hdr.sbp[12]; ++ ascq = io_hdr.sbp[13]; ++ } ++ } ++ if (key == 0x6) { ++ /* Unit Attention, retry */ ++ if (--retry_tur) ++ goto retry; ++ } ++ return ret; ++ } ++ ++ pbuff = (char *) resp_buffer; ++ ++ wwid[0] = '3'; ++ for (m = 8, k = 1; m < 11; ++m, k+=2) ++ sprintf(&wwid[k], "%02x", (unsigned int)pbuff[m] & 0xff); ++ for (m = 11; m < 24; ++m, k+=2) ++ sprintf(&wwid[k], "%02x", (unsigned int)pbuff[m] & 0xff); ++ ++ return (ret = 0); ++} ++#endif + + struct tur_checker_context { + void * dummy; +@@ -30,6 +117,9 @@ struct tur_checker_context { + + int libcheck_init (struct checker * c) + { ++#ifdef CHECK_WWID ++ memset(c->wwid, 0, WWID_SIZE); ++#endif + return 0; + } + +@@ -45,6 +135,9 @@ libcheck_check (struct checker * c) + unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; + unsigned char sense_buffer[32]; + int retry_tur = 5; ++#ifdef CHECK_WWID ++ char wwid[WWID_SIZE]; ++#endif + + retry: + memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); +@@ -110,6 +203,24 @@ libcheck_check (struct checker * c) + MSG(c, MSG_TUR_DOWN); + return PATH_DOWN; + } ++#ifdef CHECK_WWID ++ if (!do_inq(c, wwid)) { ++ ++ if(!strcmp(c->wwid, "\0")) { ++ strcpy(c->wwid, wwid); ++ goto up; ++ } ++ ++ if (strcmp(c->wwid , wwid)) { ++ condlog(0, ++ "hp_tur: Lun collided. new_wwid %s old_wwid %s", ++ wwid, c->wwid); ++ MSG(c, MSG_TUR_DOWN); ++ return PATH_DOWN; ++ } ++ } ++up: ++#endif + 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 + # diff --git a/pkgs/core/multipath-tools/patches/0015-RH-add-multipathd-count-paths-cmd.patch b/pkgs/core/multipath-tools/patches/0015-RH-add-multipathd-count-paths-cmd.patch new file mode 100644 index 0000000..87826ef --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0015-RH-add-multipathd-count-paths-cmd.patch @@ -0,0 +1,150 @@ +Index: multipath-tools/libmultipath/uevent.c +=================================================================== +--- multipath-tools.orig/libmultipath/uevent.c ++++ multipath-tools/libmultipath/uevent.c +@@ -52,6 +52,12 @@ pthread_mutex_t uevc_lock, *uevc_lockp = + pthread_cond_t uev_cond, *uev_condp = &uev_cond; + uev_trigger *my_uev_trigger; + void * my_trigger_data; ++int servicing_uev; ++ ++int is_uevent_busy(void) ++{ ++ return (uevqhp != NULL || servicing_uev); ++} + + static struct uevent * alloc_uevent (void) + { +@@ -96,7 +102,9 @@ uevq_thread(void * et) + + while (1) { + pthread_mutex_lock(uevc_lockp); ++ servicing_uev = 0; + pthread_cond_wait(uev_condp, uevc_lockp); ++ servicing_uev = 1; + pthread_mutex_unlock(uevc_lockp); + + service_uevq(); +Index: multipath-tools/libmultipath/uevent.h +=================================================================== +--- multipath-tools.orig/libmultipath/uevent.h ++++ multipath-tools/libmultipath/uevent.h +@@ -17,3 +17,4 @@ struct uevent { + + int uevent_listen(int (*store_uev)(struct uevent *, void * trigger_data), + void * trigger_data); ++int is_uevent_busy(void); +Index: multipath-tools/multipathd/cli.c +=================================================================== +--- multipath-tools.orig/multipathd/cli.c ++++ multipath-tools/multipathd/cli.c +@@ -174,6 +174,7 @@ load_keys (void) + r += add_key(keys, "devices", DEVICES, 0); + r += add_key(keys, "format", FMT, 1); + r += add_key(keys, "wildcards", WILDCARDS, 0); ++ r += add_key(keys, "count", COUNT, 0); + r += add_key(keys, "quit", QUIT, 0); + r += add_key(keys, "exit", QUIT, 0); + +@@ -443,6 +444,7 @@ cli_init (void) { + add_handler(RESTOREQ+MAPS, NULL); + add_handler(REINSTATE+PATH, NULL); + add_handler(FAIL+PATH, NULL); ++ add_handler(COUNT+PATHS, NULL); + add_handler(QUIT, NULL); + + return 0; +Index: multipath-tools/multipathd/cli_handlers.h +=================================================================== +--- multipath-tools.orig/multipathd/cli_handlers.h ++++ multipath-tools/multipathd/cli_handlers.h +@@ -25,5 +25,6 @@ int cli_restore_all_queueing(void * v, c + 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); ++int cli_count_paths(void * v, char ** reply, int * len, void * data); + int cli_fail(void * v, char ** reply, int * len, void * data); + int cli_quit(void * v, char ** reply, int * len, void * data); +Index: multipath-tools/multipathd/main.c +=================================================================== +--- multipath-tools.orig/multipathd/main.c ++++ multipath-tools/multipathd/main.c +@@ -768,6 +768,7 @@ uxlsnrloop (void * ap) + set_handler_callback(RESTOREQ+MAP, cli_restore_queueing); + set_handler_callback(DISABLEQ+MAPS, cli_disable_all_queueing); + set_handler_callback(RESTOREQ+MAPS, cli_restore_all_queueing); ++ set_handler_callback(COUNT+PATHS, cli_count_paths); + set_handler_callback(QUIT, cli_quit); + + umask(077); +Index: multipath-tools/multipathd/cli.h +=================================================================== +--- multipath-tools.orig/multipathd/cli.h ++++ multipath-tools/multipathd/cli.h +@@ -23,6 +23,7 @@ enum { + __BLACKLIST, + __DEVICES, + __FMT, ++ __COUNT, + __WILDCARDS, + __QUIT, + }; +@@ -51,6 +52,7 @@ enum { + #define BLACKLIST (1 << __BLACKLIST) + #define DEVICES (1 << __DEVICES) + #define FMT (1 << __FMT) ++#define COUNT (1 << __COUNT) + #define WILDCARDS (1 << __WILDCARDS) + #define QUIT (1 << __QUIT) + +Index: multipath-tools/multipathd/cli_handlers.c +=================================================================== +--- multipath-tools.orig/multipathd/cli_handlers.c ++++ multipath-tools/multipathd/cli_handlers.c +@@ -18,6 +18,29 @@ + + #include "main.h" + #include "cli.h" ++#include "uevent.h" ++ ++int ++count_paths(char **r, int *l, struct vectors *vecs) ++{ ++ int i, len; ++ struct path *pp; ++ char * reply; ++ unsigned int maxlen = INITIAL_REPLY_LEN; ++ int monitored_count = 0; ++ ++ reply = MALLOC(maxlen); ++ if (!reply) ++ return 1; ++ vector_foreach_slot(vecs->pathvec, pp, i) ++ if (pp->fd != -1) ++ monitored_count++; ++ len = sprintf(reply, "Paths: %d\nBusy: %s\n", monitored_count, ++ is_uevent_busy()? "True" : "False"); ++ *r = reply; ++ *l = len + 1; ++ return 0; ++} + + int + show_paths (char ** r, int * len, struct vectors * vecs, char * style) +@@ -176,6 +199,16 @@ cli_list_config (void * v, char ** reply + } + + int ++cli_count_paths (void * v, char ** reply, int * len, void * data) ++{ ++ struct vectors * vecs = (struct vectors *)data; ++ ++ condlog(3, "count paths (operator)"); ++ ++ return count_paths(reply, len, vecs); ++} ++ ++int + cli_list_paths (void * v, char ** reply, int * len, void * data) + { + struct vectors * vecs = (struct vectors *)data; diff --git a/pkgs/core/multipath-tools/patches/0016-RHBZ-554561-fix-init-error-msg.patch b/pkgs/core/multipath-tools/patches/0016-RHBZ-554561-fix-init-error-msg.patch new file mode 100644 index 0000000..ae0ae70 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0016-RHBZ-554561-fix-init-error-msg.patch @@ -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 diff --git a/pkgs/core/multipath-tools/patches/0017-RHBZ-554592-man-page-note.patch b/pkgs/core/multipath-tools/patches/0017-RHBZ-554592-man-page-note.patch new file mode 100644 index 0000000..9ebaf92 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0017-RHBZ-554592-man-page-note.patch @@ -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) diff --git a/pkgs/core/multipath-tools/patches/0018-RHBZ-554596-SUN-6540-config.patch b/pkgs/core/multipath-tools/patches/0018-RHBZ-554596-SUN-6540-config.patch new file mode 100644 index 0000000..e3296d3 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0018-RHBZ-554596-SUN-6540-config.patch @@ -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 ++# } + #} diff --git a/pkgs/core/multipath-tools/patches/0019-RHBZ-554598-fix-multipath-locking.patch b/pkgs/core/multipath-tools/patches/0019-RHBZ-554598-fix-multipath-locking.patch new file mode 100644 index 0000000..cf101e2 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0019-RHBZ-554598-fix-multipath-locking.patch @@ -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; + } + + /* diff --git a/pkgs/core/multipath-tools/patches/0020-RHBZ-554605-fix-manual-failover.patch b/pkgs/core/multipath-tools/patches/0020-RHBZ-554605-fix-manual-failover.patch new file mode 100644 index 0000000..51b66bd --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0020-RHBZ-554605-fix-manual-failover.patch @@ -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; diff --git a/pkgs/core/multipath-tools/patches/0021-RHBZ-548874-add-find-multipaths.patch b/pkgs/core/multipath-tools/patches/0021-RHBZ-548874-add-find-multipaths.patch new file mode 100644 index 0000000..12ec02c --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0021-RHBZ-548874-add-find-multipaths.patch @@ -0,0 +1,1153 @@ +--- + libmultipath/Makefile | 2 + libmultipath/alias.c | 152 ------------------------------ + libmultipath/alias.h | 1 + libmultipath/config.c | 5 - + libmultipath/config.h | 1 + libmultipath/configure.c | 23 ++++ + libmultipath/defaults.h | 2 + libmultipath/dict.c | 34 ++++++ + libmultipath/file.c | 178 +++++++++++++++++++++++++++++++++++ + libmultipath/file.h | 11 ++ + libmultipath/finder.c | 150 ++++++++++++++++++++++++++++++ + libmultipath/finder.h | 18 +++ + multipath/Makefile | 2 + multipath/main.c | 2 + multipath/mpathconf | 234 +++++++++++++++++++++++++++++++++++++++++++++++ + multipathd/main.c | 27 +++-- + 16 files changed, 679 insertions(+), 163 deletions(-) + +Index: multipath-tools/libmultipath/alias.c +=================================================================== +--- multipath-tools.orig/libmultipath/alias.c ++++ multipath-tools/libmultipath/alias.c +@@ -3,19 +3,16 @@ + * Copyright (c) 2005 Benjamin Marzinski, Redhat + */ + #include <stdlib.h> +-#include <sys/types.h> +-#include <sys/stat.h> +-#include <fcntl.h> + #include <errno.h> + #include <unistd.h> + #include <string.h> + #include <limits.h> + #include <stdio.h> +-#include <signal.h> + + #include "debug.h" + #include "uxsock.h" + #include "alias.h" ++#include "file.h" + + + /* +@@ -37,149 +34,6 @@ + */ + + static int +-ensure_directories_exist(char *str, mode_t dir_mode) +-{ +- char *pathname; +- char *end; +- int err; +- +- pathname = strdup(str); +- if (!pathname){ +- condlog(0, "Cannot copy bindings file pathname : %s", +- strerror(errno)); +- return -1; +- } +- end = pathname; +- /* skip leading slashes */ +- while (end && *end && (*end == '/')) +- end++; +- +- while ((end = strchr(end, '/'))) { +- /* if there is another slash, make the dir. */ +- *end = '\0'; +- err = mkdir(pathname, dir_mode); +- if (err && errno != EEXIST) { +- condlog(0, "Cannot make directory [%s] : %s", +- pathname, strerror(errno)); +- free(pathname); +- return -1; +- } +- if (!err) +- condlog(3, "Created dir [%s]", pathname); +- *end = '/'; +- end++; +- } +- free(pathname); +- return 0; +-} +- +-static void +-sigalrm(int sig) +-{ +- /* do nothing */ +-} +- +-static int +-lock_bindings_file(int fd) +-{ +- struct sigaction act, oldact; +- sigset_t set, oldset; +- struct flock lock; +- int err; +- +- memset(&lock, 0, sizeof(lock)); +- lock.l_type = F_WRLCK; +- lock.l_whence = SEEK_SET; +- +- act.sa_handler = sigalrm; +- sigemptyset(&act.sa_mask); +- act.sa_flags = 0; +- sigemptyset(&set); +- sigaddset(&set, SIGALRM); +- +- sigaction(SIGALRM, &act, &oldact); +- sigprocmask(SIG_UNBLOCK, &set, &oldset); +- +- alarm(BINDINGS_FILE_TIMEOUT); +- err = fcntl(fd, F_SETLKW, &lock); +- alarm(0); +- +- if (err) { +- if (errno != EINTR) +- condlog(0, "Cannot lock bindings file : %s", +- strerror(errno)); +- else +- condlog(0, "Bindings file is locked. Giving up."); +- } +- +- sigprocmask(SIG_SETMASK, &oldset, NULL); +- sigaction(SIGALRM, &oldact, NULL); +- return err; +- +-} +- +- +-static int +-open_bindings_file(char *file, int *can_write) +-{ +- int fd; +- struct stat s; +- +- if (ensure_directories_exist(file, 0700)) +- return -1; +- *can_write = 1; +- fd = open(file, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); +- if (fd < 0) { +- if (errno == EROFS) { +- *can_write = 0; +- condlog(3, "Cannot open bindings file [%s] read/write. " +- " trying readonly", file); +- fd = open(file, O_RDONLY); +- if (fd < 0) { +- condlog(0, "Cannot open bindings file [%s] " +- "readonly : %s", file, strerror(errno)); +- return -1; +- } +- } +- else { +- condlog(0, "Cannot open bindings file [%s] : %s", file, +- strerror(errno)); +- return -1; +- } +- } +- if (*can_write && lock_bindings_file(fd) < 0) +- goto fail; +- +- memset(&s, 0, sizeof(s)); +- if (fstat(fd, &s) < 0){ +- condlog(0, "Cannot stat bindings file : %s", strerror(errno)); +- goto fail; +- } +- if (s.st_size == 0) { +- if (*can_write == 0) +- goto fail; +- /* If bindings file is empty, write the header */ +- size_t len = strlen(BINDINGS_FILE_HEADER); +- if (write_all(fd, BINDINGS_FILE_HEADER, len) != len) { +- condlog(0, +- "Cannot write header to bindings file : %s", +- strerror(errno)); +- /* cleanup partially written header */ +- ftruncate(fd, 0); +- goto fail; +- } +- fsync(fd); +- condlog(3, "Initialized new bindings file [%s]", file); +- } +- +- return fd; +- +-fail: +- close(fd); +- return -1; +-} +- +-static int + format_devname(char *name, int id, int len) + { + int pos; +@@ -364,7 +218,7 @@ get_user_friendly_alias(char *wwid, char + return NULL; + } + +- fd = open_bindings_file(file, &can_write); ++ fd = open_file(file, &can_write, BINDINGS_FILE_HEADER); + if (fd < 0) + return NULL; + +@@ -414,7 +268,7 @@ get_user_friendly_wwid(char *alias, char + return NULL; + } + +- fd = open_bindings_file(file, &unused); ++ fd = open_file(file, &unused, BINDINGS_FILE_HEADER); + if (fd < 0) + return NULL; + +Index: multipath-tools/libmultipath/alias.h +=================================================================== +--- multipath-tools.orig/libmultipath/alias.h ++++ multipath-tools/libmultipath/alias.h +@@ -1,4 +1,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" \ +Index: multipath-tools/libmultipath/config.c +=================================================================== +--- multipath-tools.orig/libmultipath/config.c ++++ multipath-tools/libmultipath/config.c +@@ -452,6 +452,7 @@ load_config (char * file) + conf->multipath_dir = set_default(DEFAULT_MULTIPATHDIR); + conf->flush_on_last_del = 0; + conf->attribute_flags = 0; ++ conf->find_multipaths = DEFAULT_FIND_MULTIPATHS; + + /* + * preload default hwtable +@@ -476,10 +477,12 @@ load_config (char * file) + } + } else { + condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices."); +- condlog(0, "A default multipath.conf file is located at"); ++ condlog(0, "A sample multipath.conf file is located at"); + condlog(0, + "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", + MULTIPATH_VERSION(VERSION_CODE)); ++ condlog(0, ++"You can run /sbin/mpathconf to create or modify /etc/multipath.conf"); + conf->blist_devnode = vector_alloc(); + if (!conf->blist_devnode) { + condlog(0, "cannot allocate blacklist\n"); +Index: multipath-tools/libmultipath/config.h +=================================================================== +--- multipath-tools.orig/libmultipath/config.h ++++ multipath-tools/libmultipath/config.h +@@ -85,6 +85,7 @@ struct config { + int attribute_flags; + int fast_io_fail; + unsigned int dev_loss; ++ int find_multipaths; + uid_t uid; + gid_t gid; + mode_t mode; +Index: multipath-tools/libmultipath/configure.c +=================================================================== +--- multipath-tools.orig/libmultipath/configure.c ++++ multipath-tools/libmultipath/configure.c +@@ -35,6 +35,7 @@ + #include "alias.h" + #include "prio.h" + #include "util.h" ++#include "finder.h" + + extern int + setup_map (struct multipath * mpp) +@@ -462,6 +463,10 @@ coalesce_paths (struct vectors * vecs, v + + memset(empty_buff, 0, WWID_SIZE); + ++ /* ignore refwwid if it's empty */ ++ if (refwwid && !strlen(refwwid)) ++ refwwid = NULL; ++ + if (force_reload) { + vector_foreach_slot (pathvec, pp1, k) { + pp1->mpp = NULL; +@@ -472,21 +477,35 @@ coalesce_paths (struct vectors * vecs, v + + /* 1. if path has no unique id or wwid blacklisted */ + if (memcmp(empty_buff, pp1->wwid, WWID_SIZE) == 0 || +- filter_path(conf, pp1) > 0) ++ filter_path(conf, pp1) > 0) { ++ orphan_path(pp1); + continue; ++ } + + /* 2. if path already coalesced */ + if (pp1->mpp) + continue; + + /* 3. if path has disappeared */ +- if (!pp1->size) ++ if (!pp1->size) { ++ orphan_path(pp1); + continue; ++ } + + /* 4. path is out of scope */ + if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE)) + continue; + ++ /* If find_multipaths was selected check if the path is valid */ ++ if (conf->find_multipaths){ ++ if (refwwid || should_multipath(pp1, pathvec)) ++ remember_wwid(pp1->wwid); ++ else { ++ orphan_path(pp1); ++ continue; ++ } ++ } ++ + /* + * at this point, we know we really got a new mp + */ +Index: multipath-tools/libmultipath/defaults.h +=================================================================== +--- multipath-tools.orig/libmultipath/defaults.h ++++ multipath-tools/libmultipath/defaults.h +@@ -12,6 +12,7 @@ + #define DEFAULT_PGTIMEOUT -PGTIMEOUT_NONE + #define DEFAULT_USER_FRIENDLY_NAMES 0 + #define DEFAULT_VERBOSITY 2 ++#define DEFAULT_FIND_MULTIPATHS 0 + + #define DEFAULT_CHECKINT 5 + #define MAX_CHECKINT(a) (a << 2) +@@ -20,5 +21,6 @@ + #define DEFAULT_SOCKET "/var/run/multipathd.sock" + #define DEFAULT_CONFIGFILE "/etc/multipath.conf" + #define DEFAULT_BINDINGS_FILE "/etc/multipath/bindings" ++#define DEFAULT_WWIDS_FILE "/etc/multipath/wwids" + + char * set_default (char * str); +Index: multipath-tools/libmultipath/dict.c +=================================================================== +--- multipath-tools.orig/libmultipath/dict.c ++++ multipath-tools/libmultipath/dict.c +@@ -444,6 +444,27 @@ def_flush_on_last_del_handler(vector str + } + + static int ++def_find_multipaths_handler(vector strvec) ++{ ++ char * buff; ++ ++ buff = set_value(strvec); ++ ++ if (!buff) ++ return 1; ++ ++ if ((strlen(buff) == 2 && !strcmp(buff, "no")) || ++ (strlen(buff) == 1 && !strcmp(buff, "0"))) ++ conf->find_multipaths = 0; ++ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) || ++ (strlen(buff) == 1 && !strcmp(buff, "1"))) ++ conf->find_multipaths = 1; ++ ++ FREE(buff); ++ return 0; ++} ++ ++static int + names_handler(vector strvec) + { + char * buff; +@@ -2076,6 +2097,18 @@ snprint_def_flush_on_last_del (char * bu + } + + static int ++snprint_def_find_multipaths (char * buff, int len, void * data) ++{ ++ if (conf->find_multipaths == DEFAULT_FIND_MULTIPATHS) ++ return 0; ++ if (!conf->find_multipaths) ++ return snprintf(buff, len, "no"); ++ ++ return snprintf(buff, len, "yes"); ++} ++ ++ ++static int + snprint_def_user_friendly_names (char * buff, int len, void * data) + { + if (conf->user_friendly_names == DEFAULT_USER_FRIENDLY_NAMES) +@@ -2141,6 +2174,7 @@ init_keywords(void) + install_keyword("gid", &def_gid_handler, &snprint_def_gid); + install_keyword("fast_io_fail_tmo", &def_fast_io_fail_handler, &snprint_def_fast_io_fail); + install_keyword("dev_loss_tmo", &def_dev_loss_handler, &snprint_def_dev_loss); ++ install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths); + __deprecated install_keyword("default_selector", &def_selector_handler, NULL); + __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); + __deprecated install_keyword("default_getuid_callout", &def_getuid_callout_handler, NULL); +Index: multipath-tools/libmultipath/file.c +=================================================================== +--- /dev/null ++++ multipath-tools/libmultipath/file.c +@@ -0,0 +1,178 @@ ++/* ++ * Copyright (c) 2005 Christophe Varoqui ++ * Copyright (c) 2005 Benjamin Marzinski, Redhat ++ */ ++#include <stdlib.h> ++#include <sys/types.h> ++#include <sys/stat.h> ++#include <fcntl.h> ++#include <errno.h> ++#include <unistd.h> ++#include <string.h> ++#include <limits.h> ++#include <stdio.h> ++#include <signal.h> ++ ++#include "file.h" ++#include "debug.h" ++#include "uxsock.h" ++ ++ ++/* ++ * significant parts of this file were taken from iscsi-bindings.c of the ++ * linux-iscsi project. ++ * Copyright (C) 2002 Cisco Systems, Inc. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published ++ * by the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * See the file COPYING included with this distribution for more details. ++ */ ++ ++static int ++ensure_directories_exist(char *str, mode_t dir_mode) ++{ ++ char *pathname; ++ char *end; ++ int err; ++ ++ pathname = strdup(str); ++ if (!pathname){ ++ condlog(0, "Cannot copy file pathname %s : %s", ++ str, strerror(errno)); ++ return -1; ++ } ++ end = pathname; ++ /* skip leading slashes */ ++ while (end && *end && (*end == '/')) ++ end++; ++ ++ while ((end = strchr(end, '/'))) { ++ /* if there is another slash, make the dir. */ ++ *end = '\0'; ++ err = mkdir(pathname, dir_mode); ++ if (err && errno != EEXIST) { ++ condlog(0, "Cannot make directory [%s] : %s", ++ pathname, strerror(errno)); ++ free(pathname); ++ return -1; ++ } ++ if (!err) ++ condlog(3, "Created dir [%s]", pathname); ++ *end = '/'; ++ end++; ++ } ++ free(pathname); ++ return 0; ++} ++ ++static void ++sigalrm(int sig) ++{ ++ /* do nothing */ ++} ++ ++static int ++lock_file(int fd, char *file_name) ++{ ++ struct sigaction act, oldact; ++ sigset_t set, oldset; ++ struct flock lock; ++ int err; ++ ++ memset(&lock, 0, sizeof(lock)); ++ lock.l_type = F_WRLCK; ++ lock.l_whence = SEEK_SET; ++ ++ act.sa_handler = sigalrm; ++ sigemptyset(&act.sa_mask); ++ act.sa_flags = 0; ++ sigemptyset(&set); ++ sigaddset(&set, SIGALRM); ++ ++ sigaction(SIGALRM, &act, &oldact); ++ sigprocmask(SIG_UNBLOCK, &set, &oldset); ++ ++ alarm(FILE_TIMEOUT); ++ err = fcntl(fd, F_SETLKW, &lock); ++ alarm(0); ++ ++ if (err) { ++ if (errno != EINTR) ++ condlog(0, "Cannot lock %s : %s", file_name, ++ strerror(errno)); ++ else ++ condlog(0, "%s is locked. Giving up.", file_name); ++ } ++ ++ sigprocmask(SIG_SETMASK, &oldset, NULL); ++ sigaction(SIGALRM, &oldact, NULL); ++ return err; ++} ++ ++int ++open_file(char *file, int *can_write, char *header) ++{ ++ int fd; ++ struct stat s; ++ ++ if (ensure_directories_exist(file, 0700)) ++ return -1; ++ *can_write = 1; ++ fd = open(file, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); ++ if (fd < 0) { ++ if (errno == EROFS) { ++ *can_write = 0; ++ condlog(3, "Cannot open file [%s] read/write. " ++ " trying readonly", file); ++ fd = open(file, O_RDONLY); ++ if (fd < 0) { ++ condlog(0, "Cannot open file [%s] " ++ "readonly : %s", file, strerror(errno)); ++ return -1; ++ } ++ } ++ else { ++ condlog(0, "Cannot open file [%s] : %s", file, ++ strerror(errno)); ++ return -1; ++ } ++ } ++ if (*can_write && lock_file(fd, file) < 0) ++ goto fail; ++ ++ memset(&s, 0, sizeof(s)); ++ if (fstat(fd, &s) < 0){ ++ condlog(0, "Cannot stat file %s : %s", file, strerror(errno)); ++ goto fail; ++ } ++ if (s.st_size == 0) { ++ if (*can_write == 0) ++ goto fail; ++ /* If file is empty, write the header */ ++ size_t len = strlen(header); ++ if (write_all(fd, header, len) != len) { ++ condlog(0, ++ "Cannot write header to file %s : %s", file, ++ strerror(errno)); ++ /* cleanup partially written header */ ++ ftruncate(fd, 0); ++ goto fail; ++ } ++ fsync(fd); ++ condlog(3, "Initialized new file [%s]", file); ++ } ++ ++ return fd; ++ ++fail: ++ close(fd); ++ return -1; ++} +Index: multipath-tools/libmultipath/file.h +=================================================================== +--- /dev/null ++++ multipath-tools/libmultipath/file.h +@@ -0,0 +1,11 @@ ++/* ++ * Copyright (c) 2010 Benjamin Marzinski, Redhat ++ */ ++ ++#ifndef _FILE_H ++#define _FILE_H ++ ++#define FILE_TIMEOUT 30 ++int open_file(char *file, int *can_write, char *header); ++ ++#endif /* _FILE_H */ +Index: multipath-tools/libmultipath/finder.c +=================================================================== +--- /dev/null ++++ multipath-tools/libmultipath/finder.c +@@ -0,0 +1,150 @@ ++#include <stdlib.h> ++#include <errno.h> ++#include <unistd.h> ++#include <string.h> ++#include <limits.h> ++#include <stdio.h> ++ ++#include "checkers.h" ++#include "vector.h" ++#include "structs.h" ++#include "debug.h" ++#include "uxsock.h" ++#include "file.h" ++#include "finder.h" ++#include "defaults.h" ++ ++/* ++ * Copyright (c) 2010 Benjamin Marzinski, Redhat ++ */ ++ ++static int ++lookup_wwid(FILE *f, char *wwid) { ++ char buf[LINE_MAX]; ++ ++ while (fgets(buf, LINE_MAX, f)) { ++ char *c; ++ ++ c = strpbrk(buf, "#\n\r"); ++ if (c) ++ *c = '\0'; ++ if (*buf == '\0') ++ continue; ++ if (strncmp(wwid, buf, WWID_SIZE) == 0) ++ return 1; ++ } ++ return 0; ++} ++ ++static int ++write_out_wwid(int fd, char *wwid) { ++ int ret; ++ off_t offset; ++ char buf[WWID_SIZE + 1]; ++ ++ ret = snprintf(buf, WWID_SIZE + 1, "%s\n", wwid); ++ if (ret > WWID_SIZE || ret < 0){ ++ condlog(0, "can't format wwid for writing (%d) : %s", ++ ret, strerror(errno)); ++ return -1; ++ } ++ offset = lseek(fd, 0, SEEK_END); ++ if (offset < 0) { ++ condlog(0, "can't seek to the end of wwids file : %s", ++ strerror(errno)); ++ return -1; ++ } ++ if (write_all(fd, buf, strlen(buf)) != strlen(buf)) { ++ condlog(0, "cannot write wwid to wwids file : %s", ++ strerror(errno)); ++ ftruncate(fd, offset); ++ return -1; ++ } ++ return 1; ++} ++ ++static int ++check_wwids_file(char *wwid, int write_wwid) ++{ ++ int scan_fd, fd, can_write, found, ret; ++ FILE *f; ++ fd = open_file(DEFAULT_WWIDS_FILE, &can_write, WWIDS_FILE_HEADER); ++ if (fd < 0) ++ return -1; ++ ++ scan_fd = dup(fd); ++ if (scan_fd < 0) { ++ condlog(0, "can't dup wwids file descriptor : %s", ++ strerror(errno)); ++ close(fd); ++ return -1; ++ } ++ f = fdopen(scan_fd, "r"); ++ if (!f) { ++ condlog(0,"can't fdopen wwids file : %s", strerror(errno)); ++ close(fd); ++ close(scan_fd); ++ return -1; ++ } ++ found = lookup_wwid(f, wwid); ++ if (found) { ++ ret = 0; ++ goto out; ++ } ++ if (!write_wwid) { ++ ret = -1; ++ goto out; ++ } ++ if (!can_write) { ++ condlog(0, "wwids file is read-only. Can't write wwid"); ++ ret = -1; ++ goto out; ++ } ++ ret = write_out_wwid(fd, wwid); ++out: ++ fclose(f); ++ close(scan_fd); ++ close(fd); ++ return ret; ++} ++ ++int ++should_multipath(struct path *pp1, vector pathvec) ++{ ++ int i; ++ struct path *pp2; ++ ++ condlog(4, "checking if %s should be multipathed", pp1->dev); ++ vector_foreach_slot(pathvec, pp2, i) { ++ if (pp1->dev == pp2->dev) ++ continue; ++ if (strncmp(pp1->wwid, pp2->wwid, WWID_SIZE) == 0) { ++ condlog(3, "found multiple paths with wwid %s, " ++ "multipathing %s", pp1->wwid, pp1->dev); ++ return 1; ++ } ++ } ++ if (check_wwids_file(pp1->wwid, 0) < 0) { ++ condlog(3, "wwid %s not in wwids file, skipping %s", ++ pp1->wwid, pp1->dev); ++ return 0; ++ } ++ condlog(3, "found wwid %s in wwids file, multipathing %s", pp1->wwid, ++ pp1->dev); ++ return 1; ++} ++ ++int ++remember_wwid(char *wwid) ++{ ++ int ret = check_wwids_file(wwid, 1); ++ if (ret < 0){ ++ condlog(3, "failed writing wwid %s to wwids file", wwid); ++ return -1; ++ } ++ if (ret == 1) ++ condlog(3, "wrote wwid %s to wwids file", wwid); ++ else ++ condlog(4, "wwid %s already in wwids file", wwid); ++ return 0; ++} +Index: multipath-tools/libmultipath/finder.h +=================================================================== +--- /dev/null ++++ multipath-tools/libmultipath/finder.h +@@ -0,0 +1,18 @@ ++/* ++ * Copyright (c) 2010 Benjamin Marzinski, Redhat ++ */ ++ ++#ifndef _FINDER_H ++#define _FINDER_H ++ ++#define WWIDS_FILE_HEADER \ ++"# Multipath wwids, Version : 1.0\n" \ ++"# NOTE: This file is automatically maintained by multipath and multipathd.\n" \ ++"# You should not need to edit this file in normal circumstances.\n" \ ++"#\n" \ ++"# Valid WWIDs:\n" ++ ++int should_multipath(struct path *pp, vector pathvec); ++int remember_wwid(char *wwid); ++ ++#endif /* _FINDER_H */ +Index: multipath-tools/multipath/main.c +=================================================================== +--- multipath-tools.orig/multipath/main.c ++++ multipath-tools/multipath/main.c +@@ -307,7 +307,7 @@ configure (void) + /* + * core logic entry point + */ +- r = coalesce_paths(&vecs, NULL, NULL, conf->force_reload); ++ r = coalesce_paths(&vecs, NULL, refwwid, conf->force_reload); + + out: + if (refwwid) +Index: multipath-tools/multipathd/main.c +=================================================================== +--- multipath-tools.orig/multipathd/main.c ++++ multipath-tools/multipathd/main.c +@@ -47,6 +47,7 @@ + #include <print.h> + #include <configure.h> + #include <prio.h> ++#include <finder.h> + + #include "main.h" + #include "pidfile.h" +@@ -397,7 +398,7 @@ ev_add_path (char * devname, struct vect + */ + if (memcmp(empty_buff, pp->wwid, WWID_SIZE) == 0) { + condlog(0, "%s: failed to get path uid", devname); +- return 1; /* leave path added to pathvec */ ++ goto fail; /* leave path added to pathvec */ + } + if (filter_path(conf, pp) > 0){ + int i = find_slot(vecs->pathvec, (void *)pp); +@@ -412,18 +413,26 @@ rescan: + 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 */ ++ goto fail; /* leave path added to pathvec */ + + verify_paths(mpp, vecs, NULL); + mpp->flush_on_last_del = FLUSH_UNDEF; + mpp->action = ACT_RELOAD; + } + else { ++ if (conf->find_multipaths) { ++ if (should_multipath(pp, vecs->pathvec)) ++ remember_wwid(pp->wwid); ++ else { ++ orphan_path(pp); ++ return 0; ++ } ++ } + condlog(4,"%s: creating new map", pp->dev); + if ((mpp = add_map_with_path(vecs, pp, 1))) + mpp->action = ACT_CREATE; + else +- return 1; /* leave path added to pathvec */ ++ goto fail; /* leave path added to pathvec */ + } + + /* +@@ -432,7 +441,7 @@ rescan: + if (setup_map(mpp)) { + condlog(0, "%s: failed to setup map for addition of new " + "path %s", mpp->alias, devname); +- goto out; ++ goto fail_map; + } + /* + * reload the map for the multipath mapped device +@@ -450,7 +459,7 @@ rescan: + goto rescan; + } + else +- goto out; ++ goto fail_map; + } + dm_lib_release(); + +@@ -458,19 +467,21 @@ rescan: + * update our state from kernel regardless of create or reload + */ + if (setup_multipath(vecs, mpp)) +- goto out; ++ goto fail_map; + + sync_map_state(mpp); + + if (mpp->action == ACT_CREATE && + start_waiter_thread(mpp, vecs)) +- goto out; ++ goto fail_map; + + condlog(2, "%s path added to devmap %s", devname, mpp->alias); + return 0; + +-out: ++fail_map: + remove_map(mpp, vecs, 1); ++fail: ++ orphan_path(pp); + return 1; + } + +Index: multipath-tools/libmultipath/Makefile +=================================================================== +--- multipath-tools.orig/libmultipath/Makefile ++++ multipath-tools/libmultipath/Makefile +@@ -12,7 +12,7 @@ OBJS = memory.o parser.o vector.o devmap + pgpolicies.o debug.o regex.o defaults.o uevent.o \ + switchgroup.o uxsock.o print.o alias.o log_pthread.o \ + log.o configure.o structs_vec.o sysfs.o prio.o checkers.o \ +- lock.o waiter.o ++ lock.o waiter.o file.o finder.o + + LIBDM_API_FLUSH = $(shell if test -d /lib64 ; then objdump -T /lib64/libdevmapper.so* ; else objdump -T /lib/libdevmapper.so.* ; fi | grep -c dm_task_no_flush) + +Index: multipath-tools/multipath/mpathconf +=================================================================== +--- /dev/null ++++ multipath-tools/multipath/mpathconf +@@ -0,0 +1,234 @@ ++#!/bin/sh ++# ++# Copyright (C) 2010 Red Hat, Inc. All rights reserved. ++# ++# This file is part of the device-mapper-multipath package. ++# ++# This copyrighted material is made available to anyone wishing to use, ++# modify, copy, or redistribute it subject to the terms and conditions ++# of the GNU General Public License v.2. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software Foundation, ++# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ ++# ++# Simple editting of /etc/multipath.conf ++# This program was largely ripped off from lvmconf ++# ++ ++DEFAULT_CONFIGFILE="/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf" ++CONFIGFILE="/etc/multipath.conf" ++MULTIPATHDIR="/etc/multipath" ++TMPFILE=/etc/multipath/.multipath.conf.tmp ++ ++function usage ++{ ++ echo "usage: $0 <command>" ++ echo "" ++ echo "Commands:" ++ echo "Enable: --enable [--user_friendly_names <y|n>] [--find_multipaths <y|n>" ++ echo "Disable: --disable" ++ echo "Set user_friendly_names: --user_friendly_names <y|n>" ++ echo "Set find_multipaths: --find_multipaths <y|n>" ++ echo "" ++} ++ ++function parse_args ++{ ++ while [ -n "$1" ]; do ++ case $1 in ++ --enable) ++ ENABLE=1 ++ shift ++ ;; ++ --disable) ++ ENABLE=0 ++ shift ++ ;; ++ --user_friendly_names) ++ if [ -n "$2" ]; then ++ FRIENDLY=$2 ++ shift 2 ++ else ++ usage ++ exit 1 ++ fi ++ ;; ++ --find_multipaths) ++ if [ -n "$2" ]; then ++ FIND=$2 ++ shift 2 ++ else ++ usage ++ exit 1 ++ fi ++ ;; ++ *) ++ usage ++ exit ++ esac ++ done ++} ++ ++function validate_args ++{ ++ if [ "$ENABLE" = "0" ] && [ -n "$FRIENDLY" -o -n "$FIND" ]; then ++ echo "ignoring extra parameters on disable" ++ FRIENDLY="" ++ FIND="" ++ fi ++ if [ -n "$FRIENDLY" ] && [ "$FRIENDLY" != "y" -a "$FRIENDLY" != "n" ]; then ++ echo "--user_friendly_names must be either 'y' or 'n'" ++ exit 1 ++ fi ++ if [ -n "$FIND" ] && [ "$FIND" != "y" -a "$FIND" != "n" ]; then ++ echo "--find_multipaths must be either 'y' or 'n'" ++ exit 1 ++ fi ++ if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" ]; then ++ DISPLAY=1 ++ fi ++} ++ ++umask 0077 ++ ++parse_args "$@" ++ ++validate_args ++ ++if [ ! -d "$MULTIPATHDIR" ]; then ++ echo "/etc/multipath/ does not exist. failing" ++ exit 1 ++fi ++ ++rm $TMPFILE 2> /dev/null ++if [ -f "$CONFIGFILE" ]; then ++ cp $CONFIGFILE $TMPFILE ++elif [ -f "$DEFAULT_CONFIGFILE" ]; then ++ cp $DEFAULT_CONFIGFILE $TMPFILE ++else ++ touch $TMPFILE ++fi ++ ++if grep -q "^blacklist[[:space:]]*{" $TMPFILE ; then ++ HAVE_BLACKLIST=1 ++fi ++ ++if grep -q "^defaults[[:space:]]*{" $TMPFILE ; then ++ HAVE_DEFAULTS=1 ++fi ++ ++if [ "$HAVE_BLACKLIST" = "1" ]; then ++ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode ".?*"" ; then ++ HAVE_DISABLE=1 ++ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[#[:space:]]*devnode ".?*"" ; then ++ HAVE_DISABLE=0 ++ fi ++fi ++ ++if [ "$HAVE_DEFAULTS" = "1" ]; then ++ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*(yes|1)" ; then ++ HAVE_FIND=1 ++ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*(no|0)" ; then ++ HAVE_FIND=0 ++ fi ++ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*(yes|1)" ; then ++ HAVE_FRIENDLY=1 ++ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*(no|0)" ; then ++ HAVE_FRIENDLY=0 ++ fi ++fi ++ ++if [ -n "$DISPLAY" ]; then ++ if [ -z "$HAVE_DISABLE" -o "$HAVE_DISABLE" = 0 ]; then ++ echo "multipath is enabled" ++ else ++ echo "multipath is disabled" ++ fi ++ if [ -z "$HAVE_FIND" -o "$HAVE_FIND" = 0 ]; then ++ echo "find_multipaths is disabled" ++ else ++ echo "find_multipaths is enabled" ++ fi ++ if [ -z "$HAVE_FRIENDLY" -o "$HAVE_FRIENDLY" = 0 ]; then ++ echo "user_friendly_names is disabled" ++ else ++ echo "user_friendly_names is enabled" ++ fi ++ exit 0 ++fi ++ ++if [ -z "$HAVE_BLACKLIST" ]; then ++ cat >> $TMPFILE <<- _EOF_ ++ ++blacklist { ++} ++_EOF_ ++fi ++ ++if [ -z "$HAVE_DEFAULTS" ]; then ++ cat >> $TMPFILE <<- _EOF_ ++ ++defaults { ++} ++_EOF_ ++fi ++ ++if [ "$ENABLE" = 1 ]; then ++ if [ "$HAVE_DISABLE" = 1 ]; then ++ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode ".?*"/# devnode ".*"/' $TMPFILE ++ fi ++elif [ "$ENABLE" = 0 ]; then ++ if [ -z "$HAVE_DISABLE" ]; then ++ sed -i '/^blacklist[[:space:]]*{/ a\ ++ devnode "*" ++' $TMPFILE ++ elif [ "$HAVE_DISABLE" = 0 ]; then ++ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[#[:space:]]*devnode ".?*"/ devnode ".*"/' $TMPFILE ++ fi ++fi ++ ++if [ "$FIND" = "n" ]; then ++ if [ "$HAVE_FIND" = 1 ]; then ++ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*(yes|1)/ find_multipaths no/' $TMPFILE ++ fi ++elif [ "$FIND" = "y" ]; then ++ if [ -z "$HAVE_FIND" ]; then ++ sed -i '/^defaults[[:space:]]*{/ a\ ++ find_multipaths yes ++' $TMPFILE ++ elif [ "$HAVE_FIND" = 0 ]; then ++ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*(no|0)/ find_multipaths yes/' $TMPFILE ++ fi ++fi ++ ++if [ "$FRIENDLY" = "n" ]; then ++ if [ "$HAVE_FRIENDLY" = 1 ]; then ++ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*(yes|1)/ user_friendly_names no/' $TMPFILE ++ fi ++elif [ "$FRIENDLY" = "y" ]; then ++ if [ -z "$HAVE_FRIENDLY" ]; then ++ sed -i '/^defaults[[:space:]]*{/ a\ ++ user_friendly_names yes ++' $TMPFILE ++ elif [ "$HAVE_FRIENDLY" = 0 ]; then ++ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*(no|0)/ user_friendly_names yes/' $TMPFILE ++ fi ++fi ++ ++if [ -f "$CONFIGFILE" ]; then ++ cp $CONFIGFILE $CONFIGFILE.old ++ if [ $? != 0 ]; then ++ echo "failed to backup old config file, $CONFIGFILE not updated" ++ exit 1 ++ fi ++fi ++ ++cp $TMPFILE $CONFIGFILE ++if [ $? != 0 ]; then ++ echo "failed to copy new config file into place, check $CONFIGFILE is still OK" ++ exit 1 ++fi ++ ++rm -f $TMPFILE +Index: multipath-tools/multipath/Makefile +=================================================================== +--- multipath-tools.orig/multipath/Makefile ++++ multipath-tools/multipath/Makefile +@@ -21,6 +21,7 @@ $(EXEC): $(OBJS) + install: + $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ ++ $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ + $(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) +@@ -31,6 +32,7 @@ install: + uninstall: + rm $(DESTDIR)/lib/udev/rules.d/multipath.rules + rm $(DESTDIR)$(bindir)/$(EXEC) ++ rm $(DESTDIR)$(bindir)/mpathconf + rm $(DESTDIR)$(mandir)/$(EXEC).8.gz + rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz + diff --git a/pkgs/core/multipath-tools/patches/0022-RHBZ-557845-RHEL5-style-partitions.patch b/pkgs/core/multipath-tools/patches/0022-RHBZ-557845-RHEL5-style-partitions.patch new file mode 100644 index 0000000..95488b8 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0022-RHBZ-557845-RHEL5-style-partitions.patch @@ -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 = 2; + } + } + return n; +Index: multipath-tools/kpartx/kpartx.c +=================================================================== +--- multipath-tools.orig/kpartx/kpartx.c ++++ multipath-tools/kpartx/kpartx.c +@@ -185,7 +185,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; +@@ -355,49 +355,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)) { +@@ -443,16 +424,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"); +@@ -493,70 +468,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; + } + diff --git a/pkgs/core/multipath-tools/patches/0023-RHBZ-557810-emc-invista-config.patch b/pkgs/core/multipath-tools/patches/0023-RHBZ-557810-emc-invista-config.patch new file mode 100644 index 0000000..0db517f --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0023-RHBZ-557810-emc-invista-config.patch @@ -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" diff --git a/pkgs/core/multipath-tools/patches/0024-RHBZ-565933-checker-timeout.patch b/pkgs/core/multipath-tools/patches/0024-RHBZ-565933-checker-timeout.patch new file mode 100644 index 0000000..44f12f7 --- /dev/null +++ b/pkgs/core/multipath-tools/patches/0024-RHBZ-565933-checker-timeout.patch @@ -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 diff --git a/tools/quality-agent.d/050-libs-soname b/tools/quality-agent.d/050-libs-soname index e4f514c..b0b4aba 100755 --- a/tools/quality-agent.d/050-libs-soname +++ b/tools/quality-agent.d/050-libs-soname @@ -10,6 +10,10 @@ check() { local file local soname for file in $(find_elf_files ${LIBARY_PATHS}); do + if ! grep -q ".so" <<<${file}; then + continue + fi + if ! is_shared_object ${file}; then continue fi
hooks/post-receive -- IPFire 3.x development tree