]> git.ipfire.org Git - people/ms/ipfire-3.x.git/commitdiff
multipath-tools: Update to latest development snapshot (120613).
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 31 Jul 2012 16:28:03 +0000 (18:28 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Tue, 31 Jul 2012 16:40:34 +0000 (18:40 +0200)
Introduce own package for kpartx, which is required by dracut.

42 files changed:
multipath-tools/multipath-tools.nm
multipath-tools/multipath.conf [new file with mode: 0644]
multipath-tools/patches/0001-RH-queue-without-daemon.patch [deleted file]
multipath-tools/patches/0001-RH-remove_callout.patch [new file with mode: 0644]
multipath-tools/patches/0001-for-upstream-add-tpg_pref-prioritizer.patch [deleted file]
multipath-tools/patches/0002-RH-add-wwids-file.patch [new file with mode: 0644]
multipath-tools/patches/0002-RH-path-checker.patch [deleted file]
multipath-tools/patches/0002-for-upstream-add-tmo-config-options.patch [deleted file]
multipath-tools/patches/0003-RH-add-followover.patch [new file with mode: 0644]
multipath-tools/patches/0003-RH-root-init-script.patch [deleted file]
multipath-tools/patches/0003-for-upstream-default-configs.patch [deleted file]
multipath-tools/patches/0004-RH-fix-cciss-names.patch [new file with mode: 0644]
multipath-tools/patches/0004-RH-fix-kpartx.patch [deleted file]
multipath-tools/patches/0005-RH-cciss_id.patch [deleted file]
multipath-tools/patches/0005-RH-dont_start_with_no_config.patch [new file with mode: 0644]
multipath-tools/patches/0006-RH-move-bindings.patch [deleted file]
multipath-tools/patches/0006-RH-multipath.rules.patch [moved from multipath-tools/patches/0010-RH-multipath-rules-udev-changes.patch with 58% similarity]
multipath-tools/patches/0007-RH-Make-build-system-RH-Fedora-friendly.patch [new file with mode: 0644]
multipath-tools/patches/0007-RH-do-not-remove.patch [deleted file]
multipath-tools/patches/0008-RH-Make-build-system-RH-Fedora-friendly.patch [deleted file]
multipath-tools/patches/0008-RH-multipathd-blacklist-all-by-default.patch [new file with mode: 0644]
multipath-tools/patches/0009-RH-add-mpathconf.patch [new file with mode: 0644]
multipath-tools/patches/0009-RH-multipathd-blacklist-all-by-default.patch [deleted file]
multipath-tools/patches/0010-RH-add-find-multipaths.patch [new file with mode: 0644]
multipath-tools/patches/0011-RH-add-hp_tur-checker.patch [moved from multipath-tools/patches/0014-RH-add-hp_tur-checker.patch with 58% similarity]
multipath-tools/patches/0011-RH-fix-init-script-LSB-headers.patch [deleted file]
multipath-tools/patches/0012-RH-RHEL5-style-partitions.patch [moved from multipath-tools/patches/0022-RHBZ-557845-RHEL5-style-partitions.patch with 81% similarity]
multipath-tools/patches/0012-RH-udev-sync-support.patch [deleted file]
multipath-tools/patches/0013-RH-add-weighted_prio-prioritizer.patch [deleted file]
multipath-tools/patches/0013-RH-dont-remove-map-on-enomem.patch [new file with mode: 0644]
multipath-tools/patches/0014-RH-deprecate-uid-gid-mode.patch [new file with mode: 0644]
multipath-tools/patches/0015-RH-add-multipathd-count-paths-cmd.patch [deleted file]
multipath-tools/patches/0015-RH-use-sync-support.patch [new file with mode: 0644]
multipath-tools/patches/0016-RH-change-configs.patch [new file with mode: 0644]
multipath-tools/patches/0016-RHBZ-554561-fix-init-error-msg.patch [deleted file]
multipath-tools/patches/0017-RHBZ-554592-man-page-note.patch [deleted file]
multipath-tools/patches/0018-RHBZ-554596-SUN-6540-config.patch [deleted file]
multipath-tools/patches/0019-RHBZ-554598-fix-multipath-locking.patch [deleted file]
multipath-tools/patches/0020-RHBZ-554605-fix-manual-failover.patch [deleted file]
multipath-tools/patches/0021-RHBZ-548874-add-find-multipaths.patch [deleted file]
multipath-tools/patches/0023-RHBZ-557810-emc-invista-config.patch [deleted file]
multipath-tools/patches/0024-RHBZ-565933-checker-timeout.patch [deleted file]

index 57c01031c0fa6dec2e7d6ac19cf7cffedb804d4e..63b035a4e03ec7ea57cd2c84f73921d92cc0102f 100644 (file)
@@ -4,9 +4,12 @@
 ###############################################################################
 
 name       = multipath-tools
-version    = 0.4.9
+version    = %{rel_ver}.%{rel_date}
 release    = 1
 
+rel_ver    = 0.4.9
+rel_date   = 120613
+
 groups     = System/Base
 url        = http://christophe.varoqui.free.fr/
 license    = GPL+
@@ -17,27 +20,77 @@ description
        instructing the device-mapper multipath kernel module what to do.
 end
 
-source_dl  =
-sources    = %{name}-091027.tar.gz
+thisapp    = %{name}-%{rel_date}
+
+sources    = %{thisapp}.tgz
 
 build
        requires
                gzip
                libaio-devel
                libdevmapper-devel
+               libudev-devel
                ncurses-devel
                readline-devel
        end
 
-       DIR_APP = %{DIR_SRC}/%{name}
+       prepare_cmds
+               # Fix hardcoded install location for udev rules.
+               sed -e "s@lib/udev@usr/lib/udev@g" -i multipath/Makefile
+       end
+
+       # Install everything to the correct locations.
+       make_install_targets +=\
+               bindir=%{sbindir} \
+               syslibdir=%{libdir} \
+               libdir=%{libdir}/multipath \
+               unitdir=%{unitdir}
 
        install_cmds
+               # Remove old SysV init script and folder.
                rm -rf %{BUILDROOT}/etc/rc.d
+
+               # Install configuration file.
+               install -m 0664 %{DIR_SOURCE}/multipath.conf %{BUILDROOT}%{sysconfdir}/multipath.conf
        end
 end
 
 packages
        package %{name}
+               configfiles
+                       /etc/multipath.conf
+               end
+
+               script postin
+                       /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               script preun
+                       /usr/bin/systemctl --no-reload disable multipathd.service >/dev/null 2>&1 || :
+                       /usr/bin/systemctl stop multipathd.service >/dev/null 2>&1 || :
+               end
+
+               script postun
+                       /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               script postup
+                       /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+                       /usr/bin/systemctl try-restart multipathd.service >/dev/null 2>&1 || :
+               end
+       end
+
+       package kpartx
+               summary = Partition manager for device-mapper devices.
+               description
+                       kpartx manages partition creation and removal for device-mapper devices.
+               end
+
+               files
+                       %{sbindir}/kpartx
+                       %{mandir}/man8/kpartx.8*
+               end
+       end
 
        package %{name}-devel
                template DEVEL
diff --git a/multipath-tools/multipath.conf b/multipath-tools/multipath.conf
new file mode 100644 (file)
index 0000000..6bbeadb
--- /dev/null
@@ -0,0 +1,90 @@
+# This is a basic configuration file with some examples, for device mapper
+# multipath.
+# For a complete list of the default configuration values, see
+# /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.defaults
+# For a list of configuration options with descriptions, see
+# /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.annotated
+
+## By default, devices with vendor = "IBM" and product = "S/390.*" are
+## blacklisted. To enable mulitpathing on these devies, uncomment the
+## following lines.
+#blacklist_exceptions {
+#      device {
+#              vendor  "IBM"
+#              product "S/390.*"
+#      }
+#}
+
+## Use user friendly names, instead of using WWIDs as names.
+defaults {
+       user_friendly_names yes
+}
+##
+## Here is an example of how to configure some standard options.
+##
+#
+#defaults {
+#      udev_dir                /dev
+#      polling_interval        10
+#      selector                "round-robin 0"
+#      path_grouping_policy    multibus
+#      getuid_callout          "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
+#      prio                    alua
+#      path_checker            readsector0
+#      rr_min_io               100
+#      max_fds                 8192
+#      rr_weight               priorities
+#      failback                immediate
+#      no_path_retry           fail
+#      user_friendly_names     yes
+#}
+##
+## The wwid line in the following blacklist section is shown as an example
+## of how to blacklist devices by wwid.  The 2 devnode lines are the
+## compiled in default blacklist. If you want to blacklist entire types
+## of devices, such as all scsi devices, you should use a devnode line.
+## However, if you want to blacklist specific devices, you should use
+## a wwid line.  Since there is no guarantee that a specific device will
+## not change names on reboot (from /dev/sda to /dev/sdb for example)
+## devnode lines are not recommended for blacklisting specific devices.
+##
+#blacklist {
+#       wwid 26353900f02796769
+#      devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
+#      devnode "^hd[a-z]"
+#}
+#multipaths {
+#      multipath {
+#              wwid                    3600508b4000156d700012000000b0000
+#              alias                   yellow
+#              path_grouping_policy    multibus
+#              path_checker            readsector0
+#              path_selector           "round-robin 0"
+#              failback                manual
+#              rr_weight               priorities
+#              no_path_retry           5
+#      }
+#      multipath {
+#              wwid                    1DEC_____321816758474
+#              alias                   red
+#      }
+#}
+#devices {
+#      device {
+#              vendor                  "COMPAQ  "
+#              product                 "HSV110 (C)COMPAQ"
+#              path_grouping_policy    multibus
+#              getuid_callout          "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
+#              path_checker            readsector0
+#              path_selector           "round-robin 0"
+#              hardware_handler        "0"
+#              failback                15
+#              rr_weight               priorities
+#              no_path_retry           queue
+#      }
+#      device {
+#              vendor                  "COMPAQ  "
+#              product                 "MSA1000         "
+#              path_grouping_policy    multibus
+#      }
+#}
diff --git a/multipath-tools/patches/0001-RH-queue-without-daemon.patch b/multipath-tools/patches/0001-RH-queue-without-daemon.patch
deleted file mode 100644 (file)
index 3834bfc..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-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/multipath-tools/patches/0001-RH-remove_callout.patch b/multipath-tools/patches/0001-RH-remove_callout.patch
new file mode 100644 (file)
index 0000000..0c03cc4
--- /dev/null
@@ -0,0 +1,279 @@
+---
+ libmultipath/Makefile    |    2 
+ libmultipath/callout.c   |  217 -----------------------------------------------
+ libmultipath/callout.h   |    7 -
+ libmultipath/discovery.c |    1 
+ multipathd/main.c        |    1 
+ 5 files changed, 1 insertion(+), 227 deletions(-)
+
+Index: multipath-tools-120518/libmultipath/Makefile
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/Makefile
++++ multipath-tools-120518/libmultipath/Makefile
+@@ -9,7 +9,7 @@ DEVLIB = libmultipath.so
+ LIBS = $(DEVLIB).$(SONAME)
+ LIBDEPS = -lpthread -ldl -ldevmapper -ludev
+-OBJS = memory.o parser.o vector.o devmapper.o callout.o \
++OBJS = memory.o parser.o vector.o devmapper.o \
+        hwtable.o blacklist.o util.o dmparser.o config.o \
+        structs.o discovery.o propsel.o dict.o \
+        pgpolicies.o debug.o regex.o defaults.o uevent.o \
+Index: multipath-tools-120518/libmultipath/callout.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/callout.c
++++ /dev/null
+@@ -1,217 +0,0 @@
+-/*
+- * Source: copy of the udev package source file
+- *
+- * Copyrights of the source file apply
+- * Copyright (c) 2004 Christophe Varoqui
+- */
+-#include <stdio.h>
+-#include <sys/stat.h>
+-#include <string.h>
+-#include <unistd.h>
+-#include <sys/types.h>
+-#include <stdlib.h>
+-#include <fcntl.h>
+-#include <sys/wait.h>
+-#include <errno.h>
+-
+-#include "checkers.h"
+-#include "vector.h"
+-#include "structs.h"
+-#include "util.h"
+-#include "debug.h"
+-
+-int execute_program(char *path, char *value, int len)
+-{
+-      int retval;
+-      int count;
+-      int status;
+-      int fds[2], null_fd;
+-      pid_t pid;
+-      char *pos;
+-      char arg[CALLOUT_MAX_SIZE];
+-      int argc = sizeof(arg) / 2;
+-      char *argv[argc + 1];
+-      int i;
+-
+-      i = 0;
+-
+-      if (strchr(path, ' ')) {
+-              strlcpy(arg, path, sizeof(arg));
+-              pos = arg;
+-              while (pos != NULL && i < argc) {
+-                      if (pos[0] == '\'') {
+-                              /* don't separate if in apostrophes */
+-                              pos++;
+-                              argv[i] = strsep(&pos, "\'");
+-                              while (pos[0] == ' ')
+-                                      pos++;
+-                      } else {
+-                              argv[i] = strsep(&pos, " ");
+-                      }
+-                      i++;
+-              }
+-      } else {
+-              argv[i++] = path;
+-      }
+-      argv[i] =  NULL;
+-
+-      retval = pipe(fds);
+-
+-      if (retval != 0) {
+-              condlog(0, "error creating pipe for callout: %s", strerror(errno));
+-              return -1;
+-      }
+-
+-      pid = fork();
+-
+-      switch(pid) {
+-      case 0:
+-              /* child */
+-              close(STDOUT_FILENO);
+-
+-              /* dup write side of pipe to STDOUT */
+-              if (dup(fds[1]) < 0)
+-                      return -1;
+-
+-              /* Ignore writes to stderr */
+-              null_fd = open("/dev/null", O_WRONLY);
+-              if (null_fd > 0) {
+-                      close(STDERR_FILENO);
+-                      dup(null_fd);
+-                      close(null_fd);
+-              }
+-
+-              retval = execv(argv[0], argv);
+-              condlog(0, "error execing %s : %s", argv[0], strerror(errno));
+-              exit(-1);
+-      case -1:
+-              condlog(0, "fork failed: %s", strerror(errno));
+-              close(fds[0]);
+-              close(fds[1]);
+-              return -1;
+-      default:
+-              /* parent reads from fds[0] */
+-              close(fds[1]);
+-              retval = 0;
+-              i = 0;
+-              while (1) {
+-                      count = read(fds[0], value + i, len - i-1);
+-                      if (count <= 0)
+-                              break;
+-
+-                      i += count;
+-                      if (i >= len-1) {
+-                              condlog(0, "not enough space for response from %s", argv[0]);
+-                              retval = -1;
+-                              break;
+-                      }
+-              }
+-
+-              if (count < 0) {
+-                      condlog(0, "no response from %s", argv[0]);
+-                      retval = -1;
+-              }
+-
+-              if (i > 0 && value[i-1] == '\n')
+-                      i--;
+-              value[i] = '\0';
+-
+-              wait(&status);
+-              close(fds[0]);
+-
+-              retval = -1;
+-              if (WIFEXITED(status)) {
+-                      status = WEXITSTATUS(status);
+-                      if (status == 0)
+-                              retval = 0;
+-                      else
+-                              condlog(0, "%s exitted with %d", argv[0], status);
+-              }
+-              else if (WIFSIGNALED(status))
+-                      condlog(0, "%s was terminated by signal %d", argv[0], WTERMSIG(status));
+-              else
+-                      condlog(0, "%s terminated abnormally", argv[0]);
+-      }
+-      return retval;
+-}
+-
+-extern int
+-apply_format (char * string, char * cmd, struct path * pp)
+-{
+-      char * pos;
+-      char * dst;
+-      char * p;
+-      char * q;
+-      int len;
+-      int myfree;
+-
+-      if (!string)
+-              return 1;
+-
+-      if (!cmd)
+-              return 1;
+-
+-      dst = cmd;
+-      p = dst;
+-      pos = strchr(string, '%');
+-      myfree = CALLOUT_MAX_SIZE;
+-
+-      if (!pos) {
+-              strcpy(dst, string);
+-              return 0;
+-      }
+-
+-      len = (int) (pos - string) + 1;
+-      myfree -= len;
+-
+-      if (myfree < 2)
+-              return 1;
+-
+-      snprintf(p, len, "%s", string);
+-      p += len - 1;
+-      pos++;
+-
+-      switch (*pos) {
+-      case 'n':
+-              len = strlen(pp->dev) + 1;
+-              myfree -= len;
+-
+-              if (myfree < 2)
+-                      return 1;
+-
+-              snprintf(p, len, "%s", pp->dev);
+-              for (q = p; q < p + len; q++) {
+-                      if (q && *q == '!')
+-                              *q = '/';
+-              }
+-              p += len - 1;
+-              break;
+-      case 'd':
+-              len = strlen(pp->dev_t) + 1;
+-              myfree -= len;
+-
+-              if (myfree < 2)
+-                      return 1;
+-
+-              snprintf(p, len, "%s", pp->dev_t);
+-              p += len - 1;
+-              break;
+-      default:
+-              break;
+-      }
+-      pos++;
+-
+-      if (!*pos)
+-              return 0;
+-
+-      len = strlen(pos) + 1;
+-      myfree -= len;
+-
+-      if (myfree < 2)
+-              return 1;
+-
+-      snprintf(p, len, "%s", pos);
+-      condlog(3, "reformated callout = %s", dst);
+-      return 0;
+-}
+-
+Index: multipath-tools-120518/libmultipath/callout.h
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/callout.h
++++ /dev/null
+@@ -1,7 +0,0 @@
+-#ifndef _CALLOUT_H
+-#define _CALLOUT_H
+-
+-int execute_program(char *, char *, int);
+-int apply_format (char *, char *, struct path *);
+-
+-#endif /* _CALLOUT_H */
+Index: multipath-tools-120518/libmultipath/discovery.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/discovery.c
++++ multipath-tools-120518/libmultipath/discovery.c
+@@ -20,7 +20,6 @@
+ #include "structs.h"
+ #include "config.h"
+ #include "blacklist.h"
+-#include "callout.h"
+ #include "debug.h"
+ #include "propsel.h"
+ #include "sg_include.h"
+Index: multipath-tools-120518/multipathd/main.c
+===================================================================
+--- multipath-tools-120518.orig/multipathd/main.c
++++ multipath-tools-120518/multipathd/main.c
+@@ -35,7 +35,6 @@
+ #include <hwtable.h>
+ #include <defaults.h>
+ #include <structs.h>
+-#include <callout.h>
+ #include <blacklist.h>
+ #include <structs_vec.h>
+ #include <dmparser.h>
diff --git a/multipath-tools/patches/0001-for-upstream-add-tpg_pref-prioritizer.patch b/multipath-tools/patches/0001-for-upstream-add-tpg_pref-prioritizer.patch
deleted file mode 100644 (file)
index 93b0af2..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-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/multipath-tools/patches/0002-RH-add-wwids-file.patch b/multipath-tools/patches/0002-RH-add-wwids-file.patch
new file mode 100644 (file)
index 0000000..f3014ba
--- /dev/null
@@ -0,0 +1,748 @@
+---
+ libmultipath/Makefile    |    2 
+ libmultipath/alias.c     |  153 ---------------------------------------
+ libmultipath/alias.h     |    1 
+ libmultipath/configure.c |    3 
+ libmultipath/defaults.h  |    1 
+ libmultipath/discovery.c |    2 
+ libmultipath/file.c      |  180 +++++++++++++++++++++++++++++++++++++++++++++++
+ libmultipath/file.h      |   11 ++
+ libmultipath/wwids.c     |  139 ++++++++++++++++++++++++++++++++++++
+ libmultipath/wwids.h     |   18 ++++
+ multipath/main.c         |   37 ++++++++-
+ 11 files changed, 389 insertions(+), 158 deletions(-)
+
+Index: multipath-tools-120518/libmultipath/alias.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/alias.c
++++ multipath-tools-120518/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"
+ /*
+@@ -36,150 +33,6 @@
+  * 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 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 */
+-                      if (ftruncate(fd, 0))
+-                              condlog(0, "Cannot truncate the header : %s",
+-                                      strerror(errno));
+-                      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, char *prefix)
+@@ -370,7 +223,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 +267,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-120518/libmultipath/alias.h
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/alias.h
++++ multipath-tools-120518/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-120518/libmultipath/configure.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/configure.c
++++ multipath-tools-120518/libmultipath/configure.c
+@@ -37,6 +37,7 @@
+ #include "prio.h"
+ #include "util.h"
+ #include "uxsock.h"
++#include "wwids.h"
+ extern int
+ setup_map (struct multipath * mpp, char * params, int params_size)
+@@ -407,6 +408,8 @@ domap (struct multipath * mpp, char * pa
+                * DM_DEVICE_CREATE, DM_DEVICE_RENAME, or DM_DEVICE_RELOAD
+                * succeeded
+                */
++              if (mpp->action == ACT_CREATE)
++                      remember_wwid(mpp->wwid);
+               if (!conf->daemon) {
+                       /* multipath client mode */
+                       dm_switchgroup(mpp->alias, mpp->bestpg);
+Index: multipath-tools-120518/libmultipath/defaults.h
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/defaults.h
++++ multipath-tools-120518/libmultipath/defaults.h
+@@ -24,5 +24,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-120518/libmultipath/file.c
+===================================================================
+--- /dev/null
++++ multipath-tools-120518/libmultipath/file.c
+@@ -0,0 +1,180 @@
++/*
++ * 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 */
++                      if (ftruncate(fd, 0))
++                              condlog(0, "Cannot truncate header : %s",
++                                      strerror(errno));
++                      goto fail;
++              }
++              fsync(fd);
++              condlog(3, "Initialized new file [%s]", file);
++      }
++
++      return fd;
++
++fail:
++      close(fd);
++      return -1;
++}
+Index: multipath-tools-120518/libmultipath/file.h
+===================================================================
+--- /dev/null
++++ multipath-tools-120518/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-120518/multipath/main.c
+===================================================================
+--- multipath-tools-120518.orig/multipath/main.c
++++ multipath-tools-120518/multipath/main.c
+@@ -53,6 +53,7 @@
+ #include <errno.h>
+ #include <sys/time.h>
+ #include <sys/resource.h>
++#include <wwids.h>
+ #include "dev_t.h"
+ int logsink;
+@@ -82,7 +83,7 @@ usage (char * progname)
+ {
+       fprintf (stderr, VERSION_STRING);
+       fprintf (stderr, "Usage:\n");
+-      fprintf (stderr, "  %s [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
++      fprintf (stderr, "  %s [-c] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
+       fprintf (stderr, "  %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
+       fprintf (stderr, "  %s -F [-v lvl]\n", progname);
+       fprintf (stderr, "  %s -t\n", progname);
+@@ -95,6 +96,7 @@ usage (char * progname)
+               "  -ll     show multipath topology (maximum info)\n" \
+               "  -f      flush a multipath device map\n" \
+               "  -F      flush all multipath device maps\n" \
++              "  -c      check if a device should be a path in a multipath device\n" \
+               "  -q      allow queue_if_no_path when multipathd is not running\n"\
+               "  -d      dry run, do not create or update devmaps\n" \
+               "  -t      dump internal hardware table\n" \
+@@ -209,6 +211,7 @@ get_dm_mpvec (vector curmp, vector pathv
+               if (!conf->dry_run)
+                       reinstate_paths(mpp);
++              remember_wwid(mpp->wwid);
+       }
+       return 0;
+ }
+@@ -259,9 +262,13 @@ configure (void)
+        * if we have a blacklisted device parameter, exit early
+        */
+       if (dev &&
+-          (filter_devnode(conf->blist_devnode, conf->elist_devnode, dev) > 0))
+-                      goto out;
+-
++          (filter_devnode(conf->blist_devnode,
++                          conf->elist_devnode, dev) > 0)) {
++              if (conf->dry_run == 2)
++                      printf("%s is not a valid multipath device path\n",
++                             conf->dev);
++              goto out;
++      }
+       /*
+        * scope limiting must be translated into a wwid
+        * failing the translation is fatal (by policy)
+@@ -277,6 +284,15 @@ configure (void)
+               if (filter_wwid(conf->blist_wwid, conf->elist_wwid,
+                               refwwid) > 0)
+                       goto out;
++              if (conf->dry_run == 2) {
++                      if (check_wwids_file(refwwid, 0) == 0){
++                              printf("%s is a valid multipath device path\n", conf->dev);
++                              r = 0;
++                      }
++                      else
++                              printf("%s is not a valid multipath device path\n", conf->dev);
++                      goto out;
++              }
+       }
+       /*
+@@ -412,7 +428,7 @@ main (int argc, char *argv[])
+       if (load_config(DEFAULT_CONFIGFILE))
+               exit(1);
+-      while ((arg = getopt(argc, argv, ":dhl::FfM:v:p:b:Brtq")) != EOF ) {
++      while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtq")) != EOF ) {
+               switch(arg) {
+               case 1: printf("optarg : %s\n",optarg);
+                       break;
+@@ -434,8 +450,12 @@ main (int argc, char *argv[])
+               case 'q':
+                       conf->allow_queueing = 1;
+                       break;
++              case 'c':
++                      conf->dry_run = 2;
++                      break;
+               case 'd':
+-                      conf->dry_run = 1;
++                      if (!conf->dry_run)
++                              conf->dry_run = 1;
+                       break;
+               case 'f':
+                       conf->remove = FLUSH_ONE;
+@@ -517,6 +537,11 @@ main (int argc, char *argv[])
+       }
+       dm_init();
++      if (conf->dry_run == 2 &&
++          (!conf->dev || conf->dev_type == DEV_DEVMAP)) {
++              condlog(0, "the -c option requires a path to check");
++              goto out;
++      }
+       if (conf->remove == FLUSH_ONE) {
+               if (conf->dev_type == DEV_DEVMAP)
+                       r = dm_flush_map(conf->dev);
+Index: multipath-tools-120518/libmultipath/Makefile
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/Makefile
++++ multipath-tools-120518/libmultipath/Makefile
+@@ -15,7 +15,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 wwids.o
+ LIBDM_API_FLUSH = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_no_flush' /usr/include/libdevmapper.h)
+Index: multipath-tools-120518/libmultipath/wwids.c
+===================================================================
+--- /dev/null
++++ multipath-tools-120518/libmultipath/wwids.c
+@@ -0,0 +1,139 @@
++#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 "wwids.h"
++#include "defaults.h"
++
++/*
++ * Copyright (c) 2010 Benjamin Marzinski, Redhat
++ */
++
++static int
++lookup_wwid(FILE *f, char *wwid) {
++      int c;
++      char buf[LINE_MAX];
++      int count;
++
++      while ((c = fgetc(f)) != EOF){
++              if (c != '/') {
++                      if (fgets(buf, LINE_MAX, f) == NULL)
++                              return 0;
++                      else
++                              continue;
++              }
++              count = 0;
++              while ((c = fgetc(f)) != '/') {
++                      if (c == EOF)
++                              return 0;
++                      if (count >= WWID_SIZE - 1)
++                              goto next;
++                      if (wwid[count] == '\0')
++                              goto next;
++                      if (c != wwid[count++])
++                              goto next;
++              }
++              if (wwid[count] == '\0')
++                      return 1;
++next:
++              if (fgets(buf, LINE_MAX, f) == NULL)
++                      return 0;
++      }
++      return 0;
++}
++
++static int
++write_out_wwid(int fd, char *wwid) {
++      int ret;
++      off_t offset;
++      char buf[WWID_SIZE + 3];
++
++      ret = snprintf(buf, WWID_SIZE + 3, "/%s/\n", wwid);
++      if (ret >= (WWID_SIZE + 3) || 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));
++              if (ftruncate(fd, offset))
++                      condlog(0, "cannot truncate failed wwid write : %s",
++                              strerror(errno));
++              return -1;
++      }
++      return 1;
++}
++
++int
++check_wwids_file(char *wwid, int write_wwid)
++{
++      int fd, can_write, found, ret;
++      FILE *f;
++      fd = open_file(DEFAULT_WWIDS_FILE, &can_write, WWIDS_FILE_HEADER);
++      if (fd < 0)
++              return -1;
++
++      f = fdopen(fd, "r");
++      if (!f) {
++              condlog(0,"can't fdopen wwids file : %s", strerror(errno));
++              close(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;
++      }
++
++      if (fflush(f) != 0) {
++              condlog(0, "cannot fflush wwids file stream : %s",
++                      strerror(errno));
++              ret = -1;
++              goto out;
++      }
++
++      ret = write_out_wwid(fd, wwid);
++out:
++      fclose(f);
++      return ret;
++}
++
++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-120518/libmultipath/wwids.h
+===================================================================
+--- /dev/null
++++ multipath-tools-120518/libmultipath/wwids.h
+@@ -0,0 +1,18 @@
++/*
++ * Copyright (c) 2010 Benjamin Marzinski, Redhat
++ */
++
++#ifndef _WWIDS_H
++#define _WWIDS_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 remember_wwid(char *wwid);
++int check_wwids_file(char *wwid, int write_wwid);
++
++#endif /* _WWIDS_H */
+Index: multipath-tools-120518/libmultipath/discovery.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/discovery.c
++++ multipath-tools-120518/libmultipath/discovery.c
+@@ -810,6 +810,8 @@ get_uid (struct path * pp)
+       memset(pp->wwid, 0, WWID_SIZE);
+       value = udev_device_get_property_value(pp->udev, pp->uid_attribute);
++      if ((!value || strlen(value) == 0) && conf->dry_run == 2)
++              value = getenv(pp->uid_attribute);
+       if (value && strlen(value)) {
+               size_t len = WWID_SIZE;
diff --git a/multipath-tools/patches/0002-RH-path-checker.patch b/multipath-tools/patches/0002-RH-path-checker.patch
deleted file mode 100644 (file)
index 37864ed..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-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/multipath-tools/patches/0002-for-upstream-add-tmo-config-options.patch b/multipath-tools/patches/0002-for-upstream-add-tmo-config-options.patch
deleted file mode 100644 (file)
index dba3659..0000000
+++ /dev/null
@@ -1,511 +0,0 @@
----
- 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/multipath-tools/patches/0003-RH-add-followover.patch b/multipath-tools/patches/0003-RH-add-followover.patch
new file mode 100644 (file)
index 0000000..9aeecf4
--- /dev/null
@@ -0,0 +1,235 @@
+---
+ libmultipath/dict.c        |   12 ++++++++++++
+ libmultipath/discovery.c   |    6 +++---
+ libmultipath/print.c       |    2 ++
+ libmultipath/structs.h     |    4 +++-
+ multipath/main.c           |    2 +-
+ multipath/multipath.conf.5 |    5 +++++
+ multipathd/main.c          |   35 ++++++++++++++++++++++++++++++++++-
+ 7 files changed, 60 insertions(+), 6 deletions(-)
+
+Index: multipath-tools-120518/libmultipath/dict.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/dict.c
++++ multipath-tools-120518/libmultipath/dict.c
+@@ -398,6 +398,8 @@ default_failback_handler(vector strvec)
+               conf->pgfailback = -FAILBACK_MANUAL;
+       else if (strlen(buff) == 9 && !strcmp(buff, "immediate"))
+               conf->pgfailback = -FAILBACK_IMMEDIATE;
++      else if (strlen(buff) == 10 && !strcmp(buff, "followover"))
++              conf->pgfailback = -FAILBACK_FOLLOWOVER;
+       else
+               conf->pgfailback = atoi(buff);
+@@ -1053,6 +1055,8 @@ hw_failback_handler(vector strvec)
+               hwe->pgfailback = -FAILBACK_MANUAL;
+       else if (strlen(buff) == 9 && !strcmp(buff, "immediate"))
+               hwe->pgfailback = -FAILBACK_IMMEDIATE;
++      else if (strlen(buff) == 10 && !strcmp(buff, "followover"))
++              hwe->pgfailback = -FAILBACK_FOLLOWOVER;
+       else
+               hwe->pgfailback = atoi(buff);
+@@ -1351,6 +1355,8 @@ mp_failback_handler(vector strvec)
+               mpe->pgfailback = -FAILBACK_MANUAL;
+       else if (strlen(buff) == 9 && !strcmp(buff, "immediate"))
+               mpe->pgfailback = -FAILBACK_IMMEDIATE;
++      else if (strlen(buff) == 10 && !strcmp(buff, "followover"))
++              mpe->pgfailback = -FAILBACK_FOLLOWOVER;
+       else
+               mpe->pgfailback = atoi(buff);
+@@ -1769,6 +1775,8 @@ snprint_mp_failback (char * buff, int le
+               return snprintf(buff, len, "manual");
+       case -FAILBACK_IMMEDIATE:
+               return snprintf(buff, len, "immediate");
++      case -FAILBACK_FOLLOWOVER:
++              return snprintf(buff, len, "followover");
+       default:
+               return snprintf(buff, len, "%i", mpe->pgfailback);
+       }
+@@ -2130,6 +2138,8 @@ snprint_hw_failback (char * buff, int le
+               return snprintf(buff, len, "manual");
+       case -FAILBACK_IMMEDIATE:
+               return snprintf(buff, len, "immediate");
++      case -FAILBACK_FOLLOWOVER:
++              return snprintf(buff, len, "followover");
+       default:
+               return snprintf(buff, len, "%i", hwe->pgfailback);
+       }
+@@ -2394,6 +2404,8 @@ snprint_def_failback (char * buff, int l
+               return snprintf(buff, len, "manual");
+       case -FAILBACK_IMMEDIATE:
+               return snprintf(buff, len, "immediate");
++      case -FAILBACK_FOLLOWOVER:
++              return snprintf(buff, len, "followover");
+       default:
+               return snprintf(buff, len, "%i", conf->pgfailback);
+       }
+Index: multipath-tools-120518/libmultipath/print.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/print.c
++++ multipath-tools-120518/libmultipath/print.c
+@@ -143,6 +143,8 @@ snprint_failback (char * buff, size_t le
+ {
+       if (mpp->pgfailback == -FAILBACK_IMMEDIATE)
+               return snprintf(buff, len, "immediate");
++      if (mpp->pgfailback == -FAILBACK_FOLLOWOVER)
++              return snprintf(buff, len, "followover");
+       if (!mpp->failback_tick)
+               return snprintf(buff, len, "-");
+Index: multipath-tools-120518/libmultipath/structs.h
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/structs.h
++++ multipath-tools-120518/libmultipath/structs.h
+@@ -39,7 +39,8 @@ enum rr_weight_mode {
+ enum failback_mode {
+       FAILBACK_UNDEF,
+       FAILBACK_MANUAL,
+-      FAILBACK_IMMEDIATE
++      FAILBACK_IMMEDIATE,
++      FAILBACK_FOLLOWOVER
+ };
+ enum sysfs_buses {
+@@ -151,6 +152,7 @@ struct path {
+       int offline;
+       int state;
+       int dmstate;
++      int chkrstate;
+       int failcount;
+       int priority;
+       int pgindex;
+Index: multipath-tools-120518/multipathd/main.c
+===================================================================
+--- multipath-tools-120518.orig/multipathd/main.c
++++ multipath-tools-120518/multipathd/main.c
+@@ -995,6 +995,32 @@ mpvec_garbage_collector (struct vectors
+       }
+ }
++/* This is called after a path has started working again. It the multipath
++ * device for this path uses the followover failback type, and this is the
++ * best pathgroup, and this is the first path in the pathgroup to come back
++ * up, then switch to this pathgroup */
++static int
++followover_should_failback(struct path * pp)
++{
++      struct pathgroup * pgp;
++      struct path *pp1;
++      int i;
++
++      if (pp->mpp->pgfailback != -FAILBACK_FOLLOWOVER ||
++          !pp->mpp->pg || !pp->pgindex ||
++          pp->pgindex != pp->mpp->bestpg)
++              return 0;
++
++      pgp = VECTOR_SLOT(pp->mpp->pg, pp->pgindex - 1);
++      vector_foreach_slot(pgp->paths, pp1, i) {
++              if (pp1 == pp)
++                      continue;
++              if (pp1->chkrstate != PATH_DOWN && pp1->chkrstate != PATH_SHAKY)
++                      return 0;
++      }
++      return 1;
++}
++
+ static void
+ defered_failback_tick (vector mpvec)
+ {
+@@ -1092,6 +1118,8 @@ check_path (struct vectors * vecs, struc
+ {
+       int newstate;
+       int new_path_up = 0;
++      int chkr_new_path_up = 0;
++      int oldchkrstate = pp->chkrstate;
+       if (!pp->mpp)
+               return;
+@@ -1130,6 +1158,7 @@ check_path (struct vectors * vecs, struc
+                       pp->dev);
+               pp->dmstate = PSTATE_UNDEF;
+       }
++      pp->chkrstate = newstate;
+       if (newstate != pp->state) {
+               int oldstate = pp->state;
+               pp->state = newstate;
+@@ -1182,6 +1211,9 @@ check_path (struct vectors * vecs, struc
+               new_path_up = 1;
++              if (oldchkrstate != PATH_UP && oldchkrstate != PATH_GHOST)
++                      chkr_new_path_up = 1;
++
+               /*
+                * if at least one path is up in a group, and
+                * the group is disabled, re-enable it
+@@ -1233,7 +1265,8 @@ check_path (struct vectors * vecs, struc
+                   (new_path_up || pp->mpp->failback_tick <= 0))
+                       pp->mpp->failback_tick =
+                               pp->mpp->pgfailback + 1;
+-              else if (pp->mpp->pgfailback == -FAILBACK_IMMEDIATE)
++              else if (pp->mpp->pgfailback == -FAILBACK_IMMEDIATE ||
++                       (chkr_new_path_up && followover_should_failback(pp)))
+                       switch_pathgroup(pp->mpp);
+       }
+ }
+Index: multipath-tools-120518/multipath/multipath.conf.5
+===================================================================
+--- multipath-tools-120518.orig/multipath/multipath.conf.5
++++ multipath-tools-120518/multipath/multipath.conf.5
+@@ -254,6 +254,11 @@ active paths.
+ .B manual
+ Do not perform automatic failback.
+ .TP
++.B followover
++Only perform automatic failback when the first path of a pathgroup
++becomes active. This keeps a node from automatically failing back when
++another node requested the failover.
++.TP
+ .B values > 0
+ deferred failback (time to defer in seconds)
+ .TP
+Index: multipath-tools-120518/libmultipath/discovery.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/discovery.c
++++ multipath-tools-120518/libmultipath/discovery.c
+@@ -878,13 +878,13 @@ pathinfo (struct path *pp, vector hwtabl
+       if (mask & DI_CHECKER) {
+               if (path_state == PATH_UP) {
+-                      pp->state = get_state(pp, 0);
++                      pp->chkrstate = pp->state = get_state(pp, 0);
+                       if (pp->state == PATH_UNCHECKED ||
+                           pp->state == PATH_WILD)
+                               goto blank;
+               } else {
+                       condlog(3, "%s: path inaccessible", pp->dev);
+-                      pp->state = path_state;
++                      pp->chkrstate = pp->state = path_state;
+               }
+       }
+@@ -912,7 +912,7 @@ blank:
+        * Recoverable error, for example faulty or offline path
+        */
+       memset(pp->wwid, 0, WWID_SIZE);
+-      pp->state = PATH_DOWN;
++      pp->chkrstate = pp->state = PATH_DOWN;
+       return 0;
+ }
+Index: multipath-tools-120518/multipath/main.c
+===================================================================
+--- multipath-tools-120518.orig/multipath/main.c
++++ multipath-tools-120518/multipath/main.c
+@@ -144,7 +144,7 @@ update_paths (struct multipath * mpp)
+                                       /*
+                                        * path is not in sysfs anymore
+                                        */
+-                                      pp->state = PATH_DOWN;
++                                      pp->chkrstate = pp->state = PATH_DOWN;
+                                       continue;
+                               }
+                               pp->mpp = mpp;
diff --git a/multipath-tools/patches/0003-RH-root-init-script.patch b/multipath-tools/patches/0003-RH-root-init-script.patch
deleted file mode 100644 (file)
index c687537..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-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/multipath-tools/patches/0003-for-upstream-default-configs.patch b/multipath-tools/patches/0003-for-upstream-default-configs.patch
deleted file mode 100644 (file)
index fdd6347..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-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/multipath-tools/patches/0004-RH-fix-cciss-names.patch b/multipath-tools/patches/0004-RH-fix-cciss-names.patch
new file mode 100644 (file)
index 0000000..890a483
--- /dev/null
@@ -0,0 +1,34 @@
+---
+ multipath/main.c |   12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+Index: multipath-tools-120518/multipath/main.c
+===================================================================
+--- multipath-tools-120518.orig/multipath/main.c
++++ multipath-tools-120518/multipath/main.c
+@@ -409,6 +409,16 @@ get_dev_type(char *dev) {
+               return DEV_DEVMAP;
+ }
++static void
++convert_dev(char *dev)
++{
++      char *ptr = strstr(dev, "cciss/");
++      if (ptr) {
++              ptr += 5;
++              *ptr = '!';
++      }
++}
++
+ int
+ main (int argc, char *argv[])
+ {
+@@ -514,6 +524,8 @@ main (int argc, char *argv[])
+               strncpy(conf->dev, argv[optind], FILE_NAME_SIZE);
+               conf->dev_type = get_dev_type(conf->dev);
++              if (conf->dev_type == DEV_DEVNODE)
++                      convert_dev(conf->dev);
+       }
+       conf->daemon = 0;
diff --git a/multipath-tools/patches/0004-RH-fix-kpartx.patch b/multipath-tools/patches/0004-RH-fix-kpartx.patch
deleted file mode 100644 (file)
index a28294d..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-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/multipath-tools/patches/0005-RH-cciss_id.patch b/multipath-tools/patches/0005-RH-cciss_id.patch
deleted file mode 100644 (file)
index bf61664..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-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/multipath-tools/patches/0005-RH-dont_start_with_no_config.patch b/multipath-tools/patches/0005-RH-dont_start_with_no_config.patch
new file mode 100644 (file)
index 0000000..7efd925
--- /dev/null
@@ -0,0 +1,16 @@
+---
+ multipathd/multipathd.service |    1 +
+ 1 file changed, 1 insertion(+)
+
+Index: multipath-tools-110916/multipathd/multipathd.service
+===================================================================
+--- multipath-tools-110916.orig/multipathd/multipathd.service
++++ multipath-tools-110916/multipathd/multipathd.service
+@@ -2,6 +2,7 @@
+ Description=Device-Mapper Multipath Device Controller
+ Before=iscsi.service iscsid.service
+ After=syslog.target
++ConditionPathExists=/etc/multipath.conf
+ [Service]
+ Type=forking
diff --git a/multipath-tools/patches/0006-RH-move-bindings.patch b/multipath-tools/patches/0006-RH-move-bindings.patch
deleted file mode 100644 (file)
index c26b5e8..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-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
-
similarity index 58%
rename from multipath-tools/patches/0010-RH-multipath-rules-udev-changes.patch
rename to multipath-tools/patches/0006-RH-multipath.rules.patch
index 4250ec78bddbdd2b63c833907536e50d8df37175..bfcfc98b875d1f40a009d581e8849886db0a459e 100644 (file)
@@ -1,42 +1,48 @@
-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(-)
+ multipath/multipath.rules |   30 ++++++++++++++++++++++++------
+ 2 files changed, 27 insertions(+), 9 deletions(-)
 
-Index: multipath-tools/multipath/multipath.rules
+Index: multipath-tools-120613/multipath/multipath.rules
 ===================================================================
---- multipath-tools.orig/multipath/multipath.rules
-+++ multipath-tools/multipath/multipath.rules
-@@ -1,7 +1,11 @@
+--- multipath-tools-120613.orig/multipath/multipath.rules
++++ multipath-tools-120613/multipath/multipath.rules
+@@ -1,7 +1,25 @@
 -#
 -# 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"
+-# socket for uevents
+-SUBSYSTEM=="block", RUN+="socket:/org/kernel/dm/multipath_event"
++ENV{MPATH_SBIN_PATH}="/sbin"
++TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
++
++ACTION=="add", ENV{DEVTYPE}!="partition", \
++      ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \
++      TEST=="/etc/multipath.conf", \
++      PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \
++      ENV{DM_MULTIPATH_DEVICE_PATH}="1"
++
++ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DEVTYPE}!="partition", \
++      RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
++
 +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-?*|part[0-9]*-mpath-?*", OPTIONS+="link_priority=10"
 +ENV{DM_UUID}!="mpath-?*", GOTO="end_mpath"
++ENV{DM_SUSPENDED}=="1", GOTO="end_mpath"
 +ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath"
-+RUN+="$env{DM_SBIN_PATH}/kpartx -a -p p $tempnode"
++RUN+="$env{MPATH_SBIN_PATH}/kpartx -a -p p $tempnode"
 +LABEL="end_mpath"
-Index: multipath-tools/multipath/Makefile
+Index: multipath-tools-120613/multipath/Makefile
 ===================================================================
---- multipath-tools.orig/multipath/Makefile
-+++ multipath-tools/multipath/Makefile
+--- multipath-tools-120613.orig/multipath/Makefile
++++ multipath-tools-120613/multipath/Makefile
 @@ -21,15 +21,15 @@ $(EXEC): $(OBJS)
  install:
        $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
@@ -44,7 +50,7 @@ Index: multipath-tools/multipath/Makefile
 -      $(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) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
        $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
        $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
        $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
@@ -52,7 +58,7 @@ Index: multipath-tools/multipath/Makefile
  
  uninstall:
 -      rm $(DESTDIR)/etc/udev/rules.d/multipath.rules
-+      rm $(DESTDIR)/lib/udev/rules.d/multipath.rules
++      rm $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
        rm $(DESTDIR)$(bindir)/$(EXEC)
        rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
        rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
diff --git a/multipath-tools/patches/0007-RH-Make-build-system-RH-Fedora-friendly.patch b/multipath-tools/patches/0007-RH-Make-build-system-RH-Fedora-friendly.patch
new file mode 100644 (file)
index 0000000..bc5d17d
--- /dev/null
@@ -0,0 +1,101 @@
+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 ++++----
+ libmpathpersist/Makefile |    7 ++-----
+ libmultipath/Makefile    |    2 ++
+ multipathd/Makefile      |    1 +
+ 5 files changed, 10 insertions(+), 10 deletions(-)
+
+Index: multipath-tools-120613/Makefile.inc
+===================================================================
+--- multipath-tools-120613.orig/Makefile.inc
++++ multipath-tools-120613/Makefile.inc
+@@ -29,7 +29,7 @@ multipathdir = $(TOPDIR)/libmultipath
+ mandir      = $(prefix)/usr/share/man/man8
+ man5dir     = $(prefix)/usr/share/man/man5
+ man3dir      = $(prefix)/usr/share/man/man3
+-rcdir     = $(prefix)/etc/init.d
++rcdir     = $(prefix)/etc/rc.d/init.d
+ syslibdir   = $(prefix)/$(LIB)
+ libdir            = $(prefix)/$(LIB)/multipath
+ unitdir     = $(prefix)/lib/systemd/system
+Index: multipath-tools-120613/kpartx/Makefile
+===================================================================
+--- multipath-tools-120613.orig/kpartx/Makefile
++++ multipath-tools-120613/kpartx/Makefile
+@@ -26,10 +26,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)
+Index: multipath-tools-120613/multipathd/Makefile
+===================================================================
+--- multipath-tools-120613.orig/multipathd/Makefile
++++ multipath-tools-120613/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)$(unitdir)
+       $(INSTALL_PROGRAM) -m 644 $(EXEC).service $(DESTDIR)$(unitdir)
+       $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
+Index: multipath-tools-120613/libmultipath/Makefile
+===================================================================
+--- multipath-tools-120613.orig/libmultipath/Makefile
++++ multipath-tools-120613/libmultipath/Makefile
+@@ -46,9 +46,11 @@ install:
+       $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
+       $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+       $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir)
++      ln -sf $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ uninstall:
+       rm -f $(DESTDIR)$(syslibdir)/$(LIBS)
++      rm -f $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ clean:
+       rm -f core *.a *.o *.gz *.so *.so.*
+Index: multipath-tools-120613/libmpathpersist/Makefile
+===================================================================
+--- multipath-tools-120613.orig/libmpathpersist/Makefile
++++ multipath-tools-120613/libmpathpersist/Makefile
+@@ -28,17 +28,14 @@ $(LIBS):
+ install: $(LIBS)
+       $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
+       $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+-      $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
+       $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(man3dir)
+-      $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)/usr/include/
+-      $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)/usr/share/doc/mpathpersist/
+-      ln -sf $(DESTDIR)$(syslibdir)/$(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
++      ln -sf $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+       install -m 644 mpath_persistent_reserve_in.3.gz $(DESTDIR)$(man3dir)    
+       install -m 644 mpath_persistent_reserve_out.3.gz $(DESTDIR)$(man3dir)   
+-      install -m 644 mpath_persist.h $(DESTDIR)/usr/include/
+ uninstall:
+       rm -f $(DESTDIR)$(syslibdir)/$(LIBS)
++      rm -f $(DESTDIR)$(syslibdir)/$(DEVLIB)
+       rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_in.3.gz 
+       rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_out.3.gz        
diff --git a/multipath-tools/patches/0007-RH-do-not-remove.patch b/multipath-tools/patches/0007-RH-do-not-remove.patch
deleted file mode 100644 (file)
index 1b27c76..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-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/multipath-tools/patches/0008-RH-Make-build-system-RH-Fedora-friendly.patch b/multipath-tools/patches/0008-RH-Make-build-system-RH-Fedora-friendly.patch
deleted file mode 100644 (file)
index 9e6e3a0..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-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/multipath-tools/patches/0008-RH-multipathd-blacklist-all-by-default.patch b/multipath-tools/patches/0008-RH-multipathd-blacklist-all-by-default.patch
new file mode 100644 (file)
index 0000000..5bbf3ca
--- /dev/null
@@ -0,0 +1,64 @@
+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 |   16 ++++++++++++++++
+ libmultipath/config.h |    1 +
+ 2 files changed, 17 insertions(+)
+
+Index: multipath-tools-120518/libmultipath/config.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/config.c
++++ multipath-tools-120518/libmultipath/config.c
+@@ -21,6 +21,7 @@
+ #include "defaults.h"
+ #include "prio.h"
+ #include "devmapper.h"
++#include "version.h"
+ static int
+ hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2)
+@@ -549,6 +550,21 @@ load_config (char * file)
+       } else {
+               init_keywords();
++              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));
++              if (conf->blist_devnode == NULL) {
++                      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;
++              }
+       }
+       /*
+Index: multipath-tools-120518/libmultipath/config.h
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/config.h
++++ multipath-tools-120518/libmultipath/config.h
+@@ -6,6 +6,7 @@
+ #define ORIGIN_DEFAULT 0
+ #define ORIGIN_CONFIG  1
++#define ORIGIN_NO_CONFIG 2
+ /*
+  * In kernel, fast_io_fail == 0 means immediate failure on rport delete.
diff --git a/multipath-tools/patches/0009-RH-add-mpathconf.patch b/multipath-tools/patches/0009-RH-add-mpathconf.patch
new file mode 100644 (file)
index 0000000..2a5bec8
--- /dev/null
@@ -0,0 +1,494 @@
+---
+ libmultipath/config.c |    1 
+ multipath/Makefile    |    5 
+ multipath/main.c      |    4 
+ multipath/mpathconf   |  312 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ multipath/mpathconf.8 |  103 ++++++++++++++++
+ 5 files changed, 423 insertions(+), 2 deletions(-)
+
+Index: multipath-tools-120613/libmultipath/config.c
+===================================================================
+--- multipath-tools-120613.orig/libmultipath/config.c
++++ multipath-tools-120613/libmultipath/config.c
+@@ -553,6 +553,7 @@ load_config (char * file)
+               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));
++              condlog(0, "You can run /sbin/mpathconf to create or modify /etc/multipath.conf");
+               if (conf->blist_devnode == NULL) {
+                       conf->blist_devnode = vector_alloc();
+                       if (!conf->blist_devnode) {
+Index: multipath-tools-120613/multipath/Makefile
+===================================================================
+--- multipath-tools-120613.orig/multipath/Makefile
++++ multipath-tools-120613/multipath/Makefile
+@@ -17,22 +17,27 @@ $(EXEC): $(OBJS)
+       $(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS)
+       $(GZIP) $(EXEC).8 > $(EXEC).8.gz
+       $(GZIP) $(EXEC).conf.5 > $(EXEC).conf.5.gz
++      $(GZIP) mpathconf.8 > mpathconf.8.gz
+ 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/62-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)
++      $(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(mandir)
+ uninstall:
+       rm $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
+       rm $(DESTDIR)$(bindir)/$(EXEC)
++      rm $(DESTDIR)$(bindir)/mpathconf
+       rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
+       rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
++      rm $(DESTDIR)$(mandir)/mpathconf.8.gz
+ clean:
+       rm -f core *.o $(EXEC) *.gz
+Index: multipath-tools-120613/multipath/main.c
+===================================================================
+--- multipath-tools-120613.orig/multipath/main.c
++++ multipath-tools-120613/multipath/main.c
+@@ -432,10 +432,10 @@ main (int argc, char *argv[])
+               exit(1);
+       }
+-      if (dm_prereq())
++      if (load_config(DEFAULT_CONFIGFILE))
+               exit(1);
+-      if (load_config(DEFAULT_CONFIGFILE))
++      if (dm_prereq())
+               exit(1);
+       while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtq")) != EOF ) {
+Index: multipath-tools-120613/multipath/mpathconf
+===================================================================
+--- /dev/null
++++ multipath-tools-120613/multipath/mpathconf
+@@ -0,0 +1,312 @@
++#!/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
++#
++
++unset ENABLE FIND FRIENDLY MODULE MULTIPATHD HAVE_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_DEFAULTS HAVE_FRIENDLY HAVE_MULTIPATHD HAVE_MODULE SHOW_STATUS CHANGED_CONFIG
++
++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 "
++      echo "Disable: --disable"
++      echo "Set user_friendly_names (Default n): --user_friendly_names <y|n>"
++      echo "Set find_multipaths (Default n): --find_multipaths <y|n>"
++      echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>"
++      echo "start/stop/reload multipathd (Default n): --with_multipathd <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
++                              ;;
++                      --with_module)
++                              if [ -n "$2" ]; then
++                                      MODULE=$2
++                                      shift 2
++                              else
++                                      usage
++                                      exit 1
++                              fi
++                              ;;
++                      --with_multipathd)
++                              if [ -n "$2" ]; then
++                                      MULTIPATHD=$2
++                                      shift 2
++                              else
++                                      usage
++                                      exit 1
++                              fi
++                              ;;
++                      *)
++                              usage
++                              exit
++              esac
++      done
++}
++
++function validate_args
++{
++      if [ "$ENABLE" = "0" ] && [ -n "$FRIENDLY" -o -n "$FIND" -o -n "$MODULE" ]; then
++              echo "ignoring extra parameters on disable"
++              FRIENDLY=""
++              FIND=""
++              MODULE=""
++      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
++              SHOW_STATUS=1
++      fi
++      if [ -n "$MODULE" ] && [ "$MODULE" != "y" -a "$MODULE" != "n" ]; then
++              echo "--with_module must be either 'y' or 'n'"
++              exit 1
++      fi
++      if [ -n "$MULTIPATHD" ] && [ "$MULTIPATHD" != "y" -a "$MULTIPATHD" != "n" ]; then
++              echo "--with_multipathd must be either 'y' or 'n'"
++              exit 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 [ -z "$MODULE" -o "$MODULE" = "y" ]; then
++      if lsmod | grep -q "dm_multipath" ; then
++              HAVE_MODULE=1
++      else
++              HAVE_MODULE=0
++      fi
++fi
++
++if [ "$MULTIPATHD" = "y" ]; then
++      if service multipathd status > /dev/null ; then
++              HAVE_MULTIPATHD=1
++      else
++              HAVE_MULTIPATHD=0
++      fi
++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 "$SHOW_STATUS" ]; 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
++      if [ -n "$HAVE_MODULE" ]; then
++              if [ "$HAVE_MODULE" = 1 ]; then
++                      echo "dm_multipath module is loaded"
++              else
++                      echo "dm_multipath module is not loaded"
++              fi
++      fi
++      if [ -n "$HAVE_MULTIPATHD" ]; then
++              service multipathd status
++      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
++              CHANGED_CONFIG=1
++      fi
++elif [ "$FIND" = "y" ]; then
++      if [ -z "$HAVE_FIND" ]; then
++              sed -i '/^defaults[[:space:]]*{/ a\
++      find_multipaths yes
++' $TMPFILE
++              CHANGED_CONFIG=1
++      elif [ "$HAVE_FIND" = 0 ]; then
++              sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)/      find_multipaths yes/' $TMPFILE
++              CHANGED_CONFIG=1
++      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
++              CHANGED_CONFIG=1
++      fi
++elif [ "$FRIENDLY" = "y" ]; then
++      if [ -z "$HAVE_FRIENDLY" ]; then
++              sed -i '/^defaults[[:space:]]*{/ a\
++      user_friendly_names yes
++' $TMPFILE
++              CHANGED_CONFIG=1
++      elif [ "$HAVE_FRIENDLY" = 0 ]; then
++              sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)/  user_friendly_names yes/' $TMPFILE
++              CHANGED_CONFIG=1
++      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
++
++if [ "$ENABLE" = 1 ]; then
++      if [ "$HAVE_MODULE" = 0 ]; then
++              modprobe dm_multipath
++      fi
++      if [ "$HAVE_MULTIPATHD" = 0 ]; then
++              service multipathd start
++      fi
++elif [ "$ENABLE" = 0 ]; then
++      if [ "$HAVE_MULTIPATHD" = 1 ]; then
++              service multipathd stop
++      fi
++elif [ -n "$CHANGED_CONFIG" -a "$HAVE_MULTIPATHD" = 1 ]; then
++      service multipathd reload
++fi
+Index: multipath-tools-120613/multipath/mpathconf.8
+===================================================================
+--- /dev/null
++++ multipath-tools-120613/multipath/mpathconf.8
+@@ -0,0 +1,103 @@
++.TH MPATHCONF 8 "June 2010" "" "Linux Administrator's Manual"
++.SH NAME
++mpathconf - A tool for configuring device-mapper-multipath
++.SH SYNOPSIS
++.B mpathconf
++.RB [\| commands \|]
++.RB [\| options \|]
++.SH DESCRIPTION
++.B mpathconf
++is a utility that creates or modifies
++.B /etc/multipath.conf.
++It can enable or disable multipathing and configure some common options.
++.B mpathconf
++can also load the
++.B dm_multipath
++module, start and stop the
++.B multipathd
++daemon, and configure the
++.B multipathd
++service to start automatically or not. If
++.B mpathconf
++is called with no commands, it will display the current configuration.
++
++The default options for mpathconf are
++.B --with_module
++The
++.B --with_multipathd
++option is not set by default.  Enabling multipathing will load the
++.B dm_multipath
++module but it will not immediately start it. This is so
++that users can manually edit their config file if necessary, before starting
++.B multipathd.
++
++If
++.B /etc/multipath.conf
++already exists, mpathconf will edit it. If it does not exist, mpathconf will
++use
++.B /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf
++as the starting file. This file has
++.B user_friendly_names
++set. If this file does not exist, mpathconf will create
++.B /etc/multipath.conf
++from scratch.  For most users, this means that
++.B user_friendly_names
++will be set by default, unless they use the
++.B --user_friendly_names n
++command.
++.SH COMMANDS
++.TP
++.B --enable
++Removes any line that blacklists all device nodes from the
++.B /etc/multipath.conf
++blacklist section.
++.TP
++.B --disable
++Adds a line that blacklists all device nodes to the
++.B /etc/multipath.conf
++blacklist section. If no blacklist section exists, it will create one.
++.TP
++.B --user_friendly_name \fP { \fBy\fP | \fBn\fP }
++If set to \fBy\fP, this adds the line
++.B user_friendly_names yes
++to the
++.B /etc/multipath.conf
++defaults section. If set to \fBn\fP, this removes the line, if present. This
++command can be used along with any other command.
++.TP
++.B --find_multipaths\fP { \fBy\fP | \fBn\fP }
++If set to \fBy\fP, this adds the line
++.B find_multipaths yes
++to the
++.B /etc/multipath.conf
++defaults section. If set to \fBn\fP, this removes the line, if present. This
++command can be used aldong with any other command.
++.SH OPTIONS
++.TP
++.B --with_module\fP { \fBy\fP | \fBn\fP }
++If set to \fBy\fP, this runs
++.B modprobe dm_multipath
++to install the multipath modules. This option only works with the
++.B --enable
++command. This option is set to \fBy\fP by default.
++.TP
++.B --with_multipathd { \fBy\fP | \fBn\fP }
++If set to \fBy\fP, this runs
++.B service multipathd start
++to start the multipathd daemon on \fB--enable\fP,
++.B service multipathd stop
++to start the multipathd daemon on \fB--disable\fP, and
++.B service multipathd reload
++to reconfigure multipathd on \fB--user_frindly_names\fP and
++\fB--find_multipaths\fP.
++This option is set to \fBn\fP by default.
++.SH FILES
++.BR /etc/multipath.conf
++.SH "SEE ALSO"
++.BR multipath.conf (5),
++.BR modprobe (8),
++.BR multipath (8),
++.BR multipathd (8),
++.BR service (8),
++.SH AUTHOR
++Benjamin Marzinski <bmarzins@redhat.com>
diff --git a/multipath-tools/patches/0009-RH-multipathd-blacklist-all-by-default.patch b/multipath-tools/patches/0009-RH-multipathd-blacklist-all-by-default.patch
deleted file mode 100644 (file)
index df4b4c7..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-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/multipath-tools/patches/0010-RH-add-find-multipaths.patch b/multipath-tools/patches/0010-RH-add-find-multipaths.patch
new file mode 100644 (file)
index 0000000..57eb0a8
--- /dev/null
@@ -0,0 +1,222 @@
+---
+ libmultipath/config.c    |    1 +
+ libmultipath/config.h    |    1 +
+ libmultipath/configure.c |   11 +++++++++++
+ libmultipath/defaults.h  |    1 +
+ libmultipath/dict.c      |   34 ++++++++++++++++++++++++++++++++++
+ libmultipath/wwids.c     |   26 ++++++++++++++++++++++++++
+ libmultipath/wwids.h     |    1 +
+ multipath/main.c         |    2 +-
+ multipathd/main.c        |    6 ++++++
+ 9 files changed, 82 insertions(+), 1 deletion(-)
+
+Index: multipath-tools-120518/libmultipath/config.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/config.c
++++ multipath-tools-120518/libmultipath/config.c
+@@ -514,6 +514,7 @@ load_config (char * file)
+       conf->reassign_maps = DEFAULT_REASSIGN_MAPS;
+       conf->checkint = DEFAULT_CHECKINT;
+       conf->max_checkint = MAX_CHECKINT(conf->checkint);
++      conf->find_multipaths = DEFAULT_FIND_MULTIPATHS;
+       /*
+        * preload default hwtable
+Index: multipath-tools-120518/libmultipath/configure.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/configure.c
++++ multipath-tools-120518/libmultipath/configure.c
+@@ -497,6 +497,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;
+@@ -526,6 +530,13 @@ coalesce_paths (struct vectors * vecs, v
+               if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE))
+                       continue;
++              /* If find_multipaths was selected check if the path is valid */
++              if (conf->find_multipaths && !refwwid &&
++                  !should_multipath(pp1, pathvec)) {
++                      orphan_path(pp1);
++                      continue;
++              }
++
+               /*
+                * at this point, we know we really got a new mp
+                */
+Index: multipath-tools-120518/libmultipath/defaults.h
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/defaults.h
++++ multipath-tools-120518/libmultipath/defaults.h
+@@ -15,6 +15,7 @@
+ #define DEFAULT_USER_FRIENDLY_NAMES    0
+ #define DEFAULT_VERBOSITY     2
+ #define DEFAULT_REASSIGN_MAPS 1
++#define DEFAULT_FIND_MULTIPATHS 0
+ #define DEFAULT_CHECKINT      5
+ #define MAX_CHECKINT(a)               (a << 2)
+Index: multipath-tools-120518/libmultipath/dict.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/dict.c
++++ multipath-tools-120518/libmultipath/dict.c
+@@ -585,6 +585,27 @@ def_reservation_key_handler(vector strve
+ }
+ 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
+ def_names_handler(vector strvec)
+ {
+       char * buff;
+@@ -2549,6 +2570,18 @@ snprint_def_log_checker_err (char * buff
+ }
+ 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  == USER_FRIENDLY_NAMES_ON)
+@@ -2646,6 +2679,7 @@ init_keywords(void)
+       install_keyword("bindings_file", &bindings_file_handler, &snprint_def_bindings_file);
+       install_keyword("log_checker_err", &def_log_checker_err_handler, &snprint_def_log_checker_err);
+       install_keyword("reservation_key", &def_reservation_key_handler, &snprint_def_reservation_key);
++      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_uid_attribute", &def_uid_attribute_handler, NULL);
+Index: multipath-tools-120518/libmultipath/wwids.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/wwids.c
++++ multipath-tools-120518/libmultipath/wwids.c
+@@ -124,6 +124,32 @@ out:
+ }
+ 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);
+Index: multipath-tools-120518/libmultipath/wwids.h
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/wwids.h
++++ multipath-tools-120518/libmultipath/wwids.h
+@@ -12,6 +12,7 @@
+ "#\n" \
+ "# Valid WWIDs:\n"
++int should_multipath(struct path *pp, vector pathvec);
+ int remember_wwid(char *wwid);
+ int check_wwids_file(char *wwid, int write_wwid);
+Index: multipath-tools-120518/multipath/main.c
+===================================================================
+--- multipath-tools-120518.orig/multipath/main.c
++++ multipath-tools-120518/multipath/main.c
+@@ -332,7 +332,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-120518/multipathd/main.c
+===================================================================
+--- multipath-tools-120518.orig/multipathd/main.c
++++ multipath-tools-120518/multipathd/main.c
+@@ -49,6 +49,7 @@
+ #include <print.h>
+ #include <configure.h>
+ #include <prio.h>
++#include <wwids.h>
+ #include <pgpolicies.h>
+ #include <uevent.h>
+@@ -473,6 +474,11 @@ rescan:
+                       return 1;
+               }
++              if (conf->find_multipaths &&
++                  !should_multipath(pp, vecs->pathvec)) {
++                      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;
+Index: multipath-tools-120518/libmultipath/config.h
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/config.h
++++ multipath-tools-120518/libmultipath/config.h
+@@ -104,6 +104,7 @@ struct config {
+       unsigned int dev_loss;
+       int log_checker_err;
+       int allow_queueing;
++      int find_multipaths;
+       uid_t uid;
+       gid_t gid;
+       mode_t mode;
similarity index 58%
rename from multipath-tools/patches/0014-RH-add-hp_tur-checker.patch
rename to multipath-tools/patches/0011-RH-add-hp_tur-checker.patch
index 33dd43a1a8812191876ca4bf75a1e73c28de4eac..bc8d73bba1966934c86b356fc68c2320113dcb9f 100644 (file)
@@ -1,14 +1,14 @@
 ---
  libmultipath/checkers.h        |    3 +
  libmultipath/checkers/Makefile |    4 +
- libmultipath/checkers/tur.c    |  111 +++++++++++++++++++++++++++++++++++++++++
+ libmultipath/checkers/tur.c    |  123 +++++++++++++++++++++++++++++++++++++++--
  multipath.conf.annotated       |    5 +
- 4 files changed, 121 insertions(+), 2 deletions(-)
+ 4 files changed, 128 insertions(+), 7 deletions(-)
 
-Index: multipath-tools/libmultipath/checkers.h
+Index: multipath-tools-120613/libmultipath/checkers.h
 ===================================================================
---- multipath-tools.orig/libmultipath/checkers.h
-+++ multipath-tools/libmultipath/checkers.h
+--- multipath-tools-120613.orig/libmultipath/checkers.h
++++ multipath-tools-120613/libmultipath/checkers.h
 @@ -60,6 +60,7 @@ enum path_check_state {
  
  #define DIRECTIO     "directio"
@@ -17,7 +17,7 @@ Index: multipath-tools/libmultipath/checkers.h
  #define HP_SW        "hp_sw"
  #define RDAC         "rdac"
  #define EMC_CLARIION "emc_clariion"
-@@ -91,6 +92,7 @@ enum path_check_state {
+@@ -77,6 +78,7 @@ enum path_check_state {
  #define CHECKER_MSG_LEN 256
  #define CHECKER_DEV_LEN 256
  #define LIB_CHECKER_NAMELEN 256
@@ -25,7 +25,7 @@ Index: multipath-tools/libmultipath/checkers.h
  
  struct checker {
        struct list_head node;
-@@ -99,6 +101,7 @@ struct checker {
+@@ -88,6 +90,7 @@ struct checker {
        int disable;
        char name[CHECKER_NAME_LEN];
        char message[CHECKER_MSG_LEN];       /* comm with callers */
@@ -33,10 +33,10 @@ Index: multipath-tools/libmultipath/checkers.h
        void * context;                      /* store for persistent data */
        void ** mpcontext;                   /* store for persistent data shared
                                                multipath-wide. Use MALLOC if
-Index: multipath-tools/libmultipath/checkers/Makefile
+Index: multipath-tools-120613/libmultipath/checkers/Makefile
 ===================================================================
---- multipath-tools.orig/libmultipath/checkers/Makefile
-+++ multipath-tools/libmultipath/checkers/Makefile
+--- multipath-tools-120613.orig/libmultipath/checkers/Makefile
++++ multipath-tools-120613/libmultipath/checkers/Makefile
 @@ -8,6 +8,7 @@ LIBS= \
        libcheckcciss_tur.so \
        libcheckreadsector0.so \
@@ -47,7 +47,7 @@ Index: multipath-tools/libmultipath/checkers/Makefile
        libcheckhp_sw.so \
 @@ -23,6 +24,9 @@ libcheckdirectio.so: libsg.o directio.o
  libcheck%.so: libsg.o %.o
-       $(CC) $(SHARED_FLAGS) -o $@ $^
+       $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^
  
 +hp_tur.o: tur.c
 +      $(CC) $(CFLAGS) -DCHECK_WWID -c -o $@ $<
@@ -55,17 +55,11 @@ Index: multipath-tools/libmultipath/checkers/Makefile
  install:
        $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(libdir)
  
-Index: multipath-tools/libmultipath/checkers/tur.c
+Index: multipath-tools-120613/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"
+--- multipath-tools-120613.orig/libmultipath/checkers/tur.c
++++ multipath-tools-120613/libmultipath/checkers/tur.c
+@@ -24,12 +24,101 @@
  #define TUR_CMD_LEN 6
  #define HEAVY_CHECK_COUNT       10
  
@@ -73,6 +67,9 @@ Index: multipath-tools/libmultipath/checkers/tur.c
 +#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 MSG_TUR_RUNNING "HP tur checker still running"
++#define MSG_TUR_TIMEOUT "HP tur checker timed out"
++#define MSG_TUR_FAILED  "HP tur checker failed to initialize"
 +#define EVPD            0x01
 +#define PAGE_83         0x83
 +#define INQUIRY_CMD     0x12
@@ -82,11 +79,14 @@ Index: multipath-tools/libmultipath/checkers/tur.c
  #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"
+ #define MSG_TUR_RUNNING       "tur checker still running"
+ #define MSG_TUR_TIMEOUT       "tur checker timed out"
+ #define MSG_TUR_FAILED        "tur checker failed to initialize"
 +#endif
 +
 +#ifdef CHECK_WWID
 +static int
-+do_inq(struct checker * c, char * wwid)
++do_inq(int fd, unsigned int timeout, char * wwid)
 +{
 +      int ret = -1;
 +      unsigned char inq_cmd[INQUIRY_CMDLEN] =
@@ -111,9 +111,9 @@ Index: multipath-tools/libmultipath/checkers/tur.c
 +      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 = timeout; // IOCTL timeout value.
 +
-+      if (ioctl(c->fd, SG_IO, &io_hdr) < 0) {
++      if (ioctl(fd, SG_IO, &io_hdr) < 0) {
 +              condlog(0, "SG_IO ioctl failed: %s", strerror(errno));
 +              return ret;
 +      }
@@ -160,57 +160,100 @@ Index: multipath-tools/libmultipath/checkers/tur.c
 +#endif
  
  struct tur_checker_context {
-       void * dummy;
-@@ -30,6 +117,9 @@ struct tur_checker_context {
+       dev_t devt;
+@@ -43,6 +132,7 @@ struct tur_checker_context {
+       pthread_cond_t active;
+       pthread_spinlock_t hldr_lock;
+       int holders;
++      char wwid[WWID_SIZE];
+       char message[CHECKER_MSG_LEN];
+ };
  
- int libcheck_init (struct checker * c)
- {
-+#ifdef CHECK_WWID
-+      memset(c->wwid, 0, WWID_SIZE);
-+#endif
-       return 0;
- }
+@@ -100,12 +190,15 @@ void libcheck_free (struct checker * c)
+ #define TUR_MSG(msg, fmt, args...) snprintf(msg, CHECKER_MSG_LEN, fmt, ##args);
  
-@@ -45,6 +135,9 @@ libcheck_check (struct checker * c)
+ int
+-tur_check(int fd, unsigned int timeout, char *msg)
++tur_check (int fd, unsigned int timeout, char *msg, char *wwid)
+ {
+       struct sg_io_hdr io_hdr;
        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];
++      char new_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);
+@@ -179,6 +272,24 @@ tur_check(int fd, unsigned int timeout,
+               TUR_MSG(msg, MSG_TUR_DOWN);
                return PATH_DOWN;
        }
 +#ifdef CHECK_WWID
-+      if (!do_inq(c, wwid)) {
++      if (!do_inq(fd, timeout, new_wwid)) {
 +
-+              if(!strcmp(c->wwid, "\0")) {
-+                      strcpy(c->wwid, wwid);
++              if(!strcmp(wwid, "\0")) {
++                      strcpy(wwid, new_wwid);
 +                      goto up;
 +              }
 +
-+              if (strcmp(c->wwid , wwid)) {
++              if (strcmp(wwid , new_wwid)) {
 +                      condlog(0,
 +                              "hp_tur: Lun collided. new_wwid %s old_wwid %s",
-+                              wwid, c->wwid);
-+                      MSG(c, MSG_TUR_DOWN);
++                              new_wwid, wwid);
++                      TUR_MSG(msg, MSG_TUR_DOWN);
 +                      return PATH_DOWN;
 +              }
 +      }
 +up:
 +#endif
-       MSG(c, MSG_TUR_UP);
+       TUR_MSG(msg, MSG_TUR_UP);
        return PATH_UP;
  }
-Index: multipath-tools/multipath.conf.annotated
+@@ -215,7 +326,7 @@ void *tur_thread(void *ctx)
+       ct->state = PATH_PENDING;
+       pthread_mutex_unlock(&ct->lock);
+-      state = tur_check(ct->fd, ct->timeout, ct->message);
++      state = tur_check(ct->fd, ct->timeout, ct->message, ct->wwid);
+       /* TUR checker done */
+       pthread_mutex_lock(&ct->lock);
+@@ -275,7 +386,7 @@ libcheck_check (struct checker * c)
+               ct->devt = sb.st_rdev;
+       if (c->sync)
+-              return tur_check(c->fd, c->timeout, c->message);
++              return tur_check(c->fd, c->timeout, c->message, ct->wwid);
+       /*
+        * Async mode
+@@ -319,7 +430,8 @@ libcheck_check (struct checker * c)
+                       pthread_mutex_unlock(&ct->lock);
+                       condlog(3, "%d:%d: tur thread not responding, "
+                               "using sync mode", TUR_DEVT(ct));
+-                      return tur_check(c->fd, c->timeout, c->message);
++                      return tur_check(c->fd, c->timeout, c->message,
++                                       ct->wwid);
+               }
+               /* Start new TUR checker */
+               ct->state = PATH_UNCHECKED;
+@@ -337,7 +449,8 @@ libcheck_check (struct checker * c)
+                       ct->holders--;
+                       condlog(3, "%d:%d: failed to start tur thread, using"
+                               " sync mode", TUR_DEVT(ct));
+-                      return tur_check(c->fd, c->timeout, c->message);
++                      return tur_check(c->fd, c->timeout, c->message,
++                                       ct->wwid);
+               }
+               pthread_attr_destroy(&attr);
+               tur_timeout(&tsp);
+Index: multipath-tools-120613/multipath.conf.annotated
 ===================================================================
---- multipath-tools.orig/multipath.conf.annotated
-+++ multipath-tools/multipath.conf.annotated
-@@ -86,7 +86,8 @@
+--- multipath-tools-120613.orig/multipath.conf.annotated
++++ multipath-tools-120613/multipath.conf.annotated
+@@ -96,7 +96,8 @@
  #     # name    : path_checker, checker
  #     # scope   : multipath & multipathd
  #     # desc    : the default method used to determine the paths' state
@@ -220,9 +263,9 @@ Index: multipath-tools/multipath.conf.annotated
  #     # default : directio
  #     #
  #     path_checker    directio
-@@ -456,7 +457,7 @@
- #             # scope   : multipathd
- #             # desc    : path checking alorithm to use to check path state
+@@ -493,7 +494,7 @@
+ #             # scope   : multipathd & multipathd
+ #             # desc    : path checking algorithm to use to check path state
  #             # values  : readsector0|tur|emc_clariion|hp_sw|directio|rdac|
 -#             #           cciss_tur
 +#             #           cciss_tur|hp_tur
diff --git a/multipath-tools/patches/0011-RH-fix-init-script-LSB-headers.patch b/multipath-tools/patches/0011-RH-fix-init-script-LSB-headers.patch
deleted file mode 100644 (file)
index 4e305ad..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-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
-
similarity index 81%
rename from multipath-tools/patches/0022-RHBZ-557845-RHEL5-style-partitions.patch
rename to multipath-tools/patches/0012-RH-RHEL5-style-partitions.patch
index 95488b8c867ae3de7867823ca1dbdff3d3364a5d..47fa725ee1176c996ab249b3a2f2b0beeca806df 100644 (file)
@@ -1,15 +1,15 @@
 ---
- kpartx/bsd.c    |   35 ----------------
+ kpartx/bsd.c    |   35 ---------------
  kpartx/dos.c    |    7 +--
- kpartx/kpartx.c |  121 +++++++-------------------------------------------------
+ kpartx/kpartx.c |  123 +++++++-------------------------------------------------
  kpartx/kpartx.h |    1 
- kpartx/sun.c    |   35 ----------------
- 5 files changed, 24 insertions(+), 175 deletions(-)
+ kpartx/sun.c    |   35 ---------------
+ 5 files changed, 24 insertions(+), 177 deletions(-)
 
-Index: multipath-tools/kpartx/bsd.c
+Index: multipath-tools-120123/kpartx/bsd.c
 ===================================================================
---- multipath-tools.orig/kpartx/bsd.c
-+++ multipath-tools/kpartx/bsd.c
+--- multipath-tools-120123.orig/kpartx/bsd.c
++++ multipath-tools-120123/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;
@@ -60,10 +60,10 @@ Index: multipath-tools/kpartx/bsd.c
 -      }
        return n;
  }
-Index: multipath-tools/kpartx/dos.c
+Index: multipath-tools-120123/kpartx/dos.c
 ===================================================================
---- multipath-tools.orig/kpartx/dos.c
-+++ multipath-tools/kpartx/dos.c
+--- multipath-tools-120123.orig/kpartx/dos.c
++++ multipath-tools-120123/kpartx/dos.c
 @@ -16,7 +16,7 @@ is_extended(int type) {
  }
  
@@ -92,20 +92,20 @@ Index: multipath-tools/kpartx/dos.c
                }
        }
        return n;
-Index: multipath-tools/kpartx/kpartx.c
+Index: multipath-tools-120123/kpartx/kpartx.c
 ===================================================================
---- multipath-tools.orig/kpartx/kpartx.c
-+++ multipath-tools/kpartx/kpartx.c
-@@ -185,7 +185,7 @@ get_hotplug_device(void)
+--- multipath-tools-120123.orig/kpartx/kpartx.c
++++ multipath-tools-120123/kpartx/kpartx.c
+@@ -190,7 +190,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;
+-      int i, j, m, n, op, off, arg, c, d, ro=0;
++      int i, j, m, n, op, off, arg, ro=0;
+       int fd = -1;
        struct slice all;
        struct pt *ptp;
-       enum action what = LIST;
-@@ -355,49 +355,30 @@ main(int argc, char **argv){
+@@ -380,49 +380,30 @@ main(int argc, char **argv){
                else
                        continue;
  
@@ -114,9 +114,9 @@ Index: multipath-tools/kpartx/kpartx.c
 +               * 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 +
++                      for (m = j + 1; m < n; m++) {
++                              if (slices[m].start > slices[j].start &&
++                                  slices[m].start < slices[j].start +
 +                                  slices[j].size)
 +                                      slices[j].size = 0;
 +                      }
@@ -167,12 +167,12 @@ Index: multipath-tools/kpartx/kpartx.c
 -                                      break;
 -                      }
  
-                       if (loopcreated && S_ISREG (buf.st_mode)) {
-                               if (del_loop(device)) {
-@@ -443,16 +424,10 @@ main(int argc, char **argv){
                        break;
  
+@@ -461,16 +442,10 @@ main(int argc, char **argv){
                case ADD:
+               case UPDATE:
+                       /* ADD and UPDATE share the same code that adds new partitions. */
 -                      for (j = 0, c = 0; j < n; j++) {
 +                      for (j = 0; j < n; j++) {
                                if (slices[j].size == 0)
@@ -187,7 +187,7 @@ Index: multipath-tools/kpartx/kpartx.c
                                if (safe_sprintf(partname, "%s%s%d",
                                             mapname, delim, j+1)) {
                                        fprintf(stderr, "partname too small\n");
-@@ -493,70 +468,6 @@ main(int argc, char **argv){
+@@ -511,72 +486,6 @@ main(int argc, char **argv){
                                               slices[j].minor, slices[j].size,
                                               DM_TARGET, params);
                        }
@@ -234,13 +234,15 @@ Index: multipath-tools/kpartx/kpartx.c
 -                                            DM_DEVICE_RELOAD : DM_DEVICE_CREATE);
 -
 -                                      dm_addmap(op, partname, DM_TARGET, params,
--                                                slices[j].size, uuid, j+1,
+-                                                slices[j].size, ro, uuid, j+1,
 -                                                buf.st_mode & 0777,
--                                                buf.st_uid, buf.st_gid);
+-                                                buf.st_uid, buf.st_gid,
+-                                                &cookie);
 -
 -                                      if (op == DM_DEVICE_RELOAD)
 -                                              dm_simplecmd(DM_DEVICE_RESUME,
--                                                           partname, 1);
+-                                                           partname, 1,
+-                                                           &cookie);
 -
 -                                      dm_devn(partname, &slices[j].major,
 -                                              &slices[j].minor);
@@ -255,13 +257,13 @@ Index: multipath-tools/kpartx/kpartx.c
 -                              if (d == c)
 -                                      break;
 -                      }
-                       break;
  
-               default:
-Index: multipath-tools/kpartx/kpartx.h
+                       if (what == ADD) {
+                               /* Skip code that removes devmappings for deleted partitions */
+Index: multipath-tools-120123/kpartx/kpartx.h
 ===================================================================
---- multipath-tools.orig/kpartx/kpartx.h
-+++ multipath-tools/kpartx/kpartx.h
+--- multipath-tools-120123.orig/kpartx/kpartx.h
++++ multipath-tools-120123/kpartx/kpartx.h
 @@ -24,7 +24,6 @@
  struct slice {
        uint64_t start;
@@ -270,10 +272,10 @@ Index: multipath-tools/kpartx/kpartx.h
        int major;
        int minor;
  };
-Index: multipath-tools/kpartx/sun.c
+Index: multipath-tools-120123/kpartx/sun.c
 ===================================================================
---- multipath-tools.orig/kpartx/sun.c
-+++ multipath-tools/kpartx/sun.c
+--- multipath-tools-120123.orig/kpartx/sun.c
++++ multipath-tools-120123/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;
diff --git a/multipath-tools/patches/0012-RH-udev-sync-support.patch b/multipath-tools/patches/0012-RH-udev-sync-support.patch
deleted file mode 100644 (file)
index b30828c..0000000
+++ /dev/null
@@ -1,362 +0,0 @@
----
- 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/multipath-tools/patches/0013-RH-add-weighted_prio-prioritizer.patch b/multipath-tools/patches/0013-RH-add-weighted_prio-prioritizer.patch
deleted file mode 100644 (file)
index 63b493b..0000000
+++ /dev/null
@@ -1,546 +0,0 @@
----
- 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(&regex, regex_str, REG_EXTENDED|REG_NOSUB);
-+      if (err) {
-+              errbuf_size = regerror(err, &regex, NULL, 0);
-+              errbuf = malloc(errbuf_size);
-+              regerror(err, &regex, errbuf, errbuf_size);
-+              condlog(0, "%s: weighted prio: cannot compile regex '%s' : %s",
-+                      dev, regex_str, errbuf);
-+              free(errbuf);
-+              return 0;
-+      }
-+      if (regexec(&regex, target, 0, NULL, 0) == 0) {
-+              *prio = prio_match;
-+              ret = 1;
-+      }
-+
-+      regfree(&regex);
-+      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/multipath-tools/patches/0013-RH-dont-remove-map-on-enomem.patch b/multipath-tools/patches/0013-RH-dont-remove-map-on-enomem.patch
new file mode 100644 (file)
index 0000000..b7ee42c
--- /dev/null
@@ -0,0 +1,18 @@
+---
+ multipathd/main.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+Index: multipath-tools-120518/multipathd/main.c
+===================================================================
+--- multipath-tools-120518.orig/multipathd/main.c
++++ multipath-tools-120518/multipathd/main.c
+@@ -993,7 +993,8 @@ mpvec_garbage_collector (struct vectors
+               return;
+       vector_foreach_slot (vecs->mpvec, mpp, i) {
+-              if (mpp && mpp->alias && !dm_map_present(mpp->alias)) {
++              if (mpp && mpp->alias && !dm_map_present(mpp->alias) &&
++                  errno != ENOMEM) {
+                       condlog(2, "%s: remove dead map", mpp->alias);
+                       remove_map_and_stop_waiter(mpp, vecs, 1);
+                       i--;
diff --git a/multipath-tools/patches/0014-RH-deprecate-uid-gid-mode.patch b/multipath-tools/patches/0014-RH-deprecate-uid-gid-mode.patch
new file mode 100644 (file)
index 0000000..9270d9d
--- /dev/null
@@ -0,0 +1,90 @@
+---
+ multipath.conf.annotated |   53 -----------------------------------------------
+ multipath.conf.synthetic |    3 --
+ 2 files changed, 56 deletions(-)
+
+Index: multipath-tools-120123/multipath.conf.annotated
+===================================================================
+--- multipath-tools-120123.orig/multipath.conf.annotated
++++ multipath-tools-120123/multipath.conf.annotated
+@@ -186,32 +186,6 @@
+ #     user_friendly_names no
+ #
+ #     #
+-#     # name    : mode
+-#     # scope   : multipath & multipathd
+-#     # desc    : The mode to use for the multipath device nodes, in octal.
+-#     # values  : 0000 - 0777
+-#     # default : determined by the process
+-#     mode 0644
+-#
+-#     #
+-#     # name    : uid
+-#     # scope   : multipath & multipathd
+-#     # desc    : The user id to use for the multipath device nodes. You
+-#     #           may use either the numeric or symbolic uid
+-#     # values  : <user_id>
+-#     # default : determined by the process
+-#     uid 0
+-#
+-#     #
+-#     # name    : gid
+-#     # scope   : multipath & multipathd
+-#     # desc    : The group id to user for the multipath device nodes. You
+-#     #           may use either the numeric or symbolic gid
+-#     # values  : <group_id>
+-#     # default : determined by the process
+-#     gid disk
+-#
+-#     #
+ #     # name    : checker_timeout
+ #     # scope   : multipath & multipathd
+ #     # desc    : The timeout to use for path checkers that issue scsi
+@@ -388,33 +362,6 @@
+ #             #
+ #             flush_on_last_del       yes
+ #
+-#             #
+-#             # name    : mode
+-#             # scope   : multipath & multipathd
+-#             # desc    : The mode to use for the multipath device nodes, in
+-#             #           octal.
+-#             # values  : 0000 - 0777
+-#             # default : determined by the process
+-#             mode 0644
+-#
+-#             #
+-#             # name    : uid
+-#             # scope   : multipath & multipathd
+-#             # desc    : The user id to use for the multipath device nodes.
+-#             #           You may use either the numeric or symbolic uid
+-#             # values  : <user_id>
+-#             # default : determined by the process
+-#             uid 0
+-#
+-#             #
+-#             # name    : gid
+-#             # scope   : multipath & multipathd
+-#             # desc    : The group id to user for the multipath device nodes.
+-#             #           You may use either the numeric or symbolic gid
+-#             # values  : <group_id>
+-#             # default : determined by the process
+-#             gid 0
+-#
+ #     }
+ #     multipath {
+ #             wwid    1DEC_____321816758474
+Index: multipath-tools-120123/multipath.conf.synthetic
+===================================================================
+--- multipath-tools-120123.orig/multipath.conf.synthetic
++++ multipath-tools-120123/multipath.conf.synthetic
+@@ -18,9 +18,6 @@
+ #     no_path_retry           fail
+ #     queue_without_daemon    no
+ #     user_friendly_names     no
+-#     mode                    644
+-#     uid                     0
+-#     gid                     disk
+ #}
+ #blacklist {
+ #       wwid 26353900f02796769
diff --git a/multipath-tools/patches/0015-RH-add-multipathd-count-paths-cmd.patch b/multipath-tools/patches/0015-RH-add-multipathd-count-paths-cmd.patch
deleted file mode 100644 (file)
index 87826ef..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-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/multipath-tools/patches/0015-RH-use-sync-support.patch b/multipath-tools/patches/0015-RH-use-sync-support.patch
new file mode 100644 (file)
index 0000000..c5dee9d
--- /dev/null
@@ -0,0 +1,17 @@
+---
+ libmultipath/devmapper.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+Index: multipath-tools-120518/libmultipath/devmapper.c
+===================================================================
+--- multipath-tools-120518.orig/libmultipath/devmapper.c
++++ multipath-tools-120518/libmultipath/devmapper.c
+@@ -1272,6 +1272,8 @@ dm_rename (char * old, char * new)
+               goto out;
+       if (!dm_task_run(dmt))
+               goto out;
++      if (conf->daemon)
++              dm_task_update_nodes();
+       r = 1;
+ out:
diff --git a/multipath-tools/patches/0016-RH-change-configs.patch b/multipath-tools/patches/0016-RH-change-configs.patch
new file mode 100644 (file)
index 0000000..7942ea8
--- /dev/null
@@ -0,0 +1,541 @@
+---
+ libmultipath/config.c  |    1 
+ libmultipath/hwtable.c |   65 -------------------------------------------------
+ 2 files changed, 1 insertion(+), 65 deletions(-)
+
+Index: multipath-tools-120613/libmultipath/config.c
+===================================================================
+--- multipath-tools-120613.orig/libmultipath/config.c
++++ multipath-tools-120613/libmultipath/config.c
+@@ -515,6 +515,7 @@ load_config (char * file)
+       conf->checkint = DEFAULT_CHECKINT;
+       conf->max_checkint = MAX_CHECKINT(conf->checkint);
+       conf->find_multipaths = DEFAULT_FIND_MULTIPATHS;
++      conf->fast_io_fail = 5;
+       /*
+        * preload default hwtable
+Index: multipath-tools-120613/libmultipath/hwtable.c
+===================================================================
+--- multipath-tools-120613.orig/libmultipath/hwtable.c
++++ multipath-tools-120613/libmultipath/hwtable.c
+@@ -28,7 +28,6 @@ static struct hwentry default_hw[] = {
+               .product       = "Compellent Vol",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -50,7 +49,6 @@ static struct hwentry default_hw[] = {
+               .product       = "Xserve RAID ",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -72,7 +70,6 @@ static struct hwentry default_hw[] = {
+               .product       = "VV",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -88,7 +85,6 @@ static struct hwentry default_hw[] = {
+               .product       = "HSG80",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = "1 hp_sw",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -104,7 +100,6 @@ static struct hwentry default_hw[] = {
+               .product       = "A6189A",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -121,7 +116,6 @@ static struct hwentry default_hw[] = {
+               .product       = "(MSA|HSV)1.0.*",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = "1 hp_sw",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -137,7 +131,6 @@ static struct hwentry default_hw[] = {
+               .product       = "MSA VOLUME",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -153,7 +146,6 @@ static struct hwentry default_hw[] = {
+               .product       = "HSV1[01]1|HSV2[01]0|HSV300|HSV4[05]0",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -169,7 +161,6 @@ static struct hwentry default_hw[] = {
+               .product       = "MSA2[02]12fc|MSA2012i",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -185,7 +176,6 @@ static struct hwentry default_hw[] = {
+               .product       = "MSA2012sa|MSA23(12|24)(fc|i|sa)|MSA2000s VOLUME",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -202,7 +192,6 @@ static struct hwentry default_hw[] = {
+               .product       = "HSVX700",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 alua",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -219,7 +208,6 @@ static struct hwentry default_hw[] = {
+               .product       = "LOGICAL VOLUME.*",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -236,7 +224,6 @@ static struct hwentry default_hw[] = {
+               .product       = "P2000 G3 FC|P2000G3 FC/iSCSI|P2000 G3 SAS|P2000 G3 iSCSI",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -258,7 +245,6 @@ static struct hwentry default_hw[] = {
+               .product       = "SAN DataDirector",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -280,7 +266,6 @@ static struct hwentry default_hw[] = {
+               .product       = "SYMMETRIX",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -297,7 +282,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "LUNZ",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = "1 emc",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -314,7 +298,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "LUNZ",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -336,7 +319,6 @@ static struct hwentry default_hw[] = {
+               .product       = "CentricStor",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_SERIAL,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -352,7 +334,6 @@ static struct hwentry default_hw[] = {
+               .product       = "ETERNUS_DX(L|400|8000)",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -373,7 +354,6 @@ static struct hwentry default_hw[] = {
+               .product       = "OPEN-.*",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -389,7 +369,6 @@ static struct hwentry default_hw[] = {
+               .product       = "DF.*",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -411,7 +390,6 @@ static struct hwentry default_hw[] = {
+               .product       = "ProFibre 4000R",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -429,7 +407,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -447,7 +424,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -465,7 +441,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -483,7 +458,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -500,7 +474,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = "2 pg_init_retries 50",
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -518,7 +491,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -536,7 +508,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -554,7 +525,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -572,7 +542,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -589,7 +558,6 @@ static struct hwentry default_hw[] = {
+               .product       = "^3542",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_SERIAL,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -606,7 +574,6 @@ static struct hwentry default_hw[] = {
+               .product       = "^2105800",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_SERIAL,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -623,7 +590,6 @@ static struct hwentry default_hw[] = {
+               .product       = "^2105F20",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_SERIAL,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -640,7 +606,6 @@ static struct hwentry default_hw[] = {
+               .product       = "^1750500",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -657,7 +622,6 @@ static struct hwentry default_hw[] = {
+               .product       = "^2107900",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -674,7 +638,6 @@ static struct hwentry default_hw[] = {
+               .product       = "^2145",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -693,7 +656,6 @@ static struct hwentry default_hw[] = {
+               .uid_attribute = "ID_UID",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -712,7 +674,6 @@ static struct hwentry default_hw[] = {
+               .uid_attribute = "ID_UID",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -729,7 +690,6 @@ static struct hwentry default_hw[] = {
+               .product       = "^IPR.*",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = "1 alua",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -746,7 +706,6 @@ static struct hwentry default_hw[] = {
+               .product       = "1820N00",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -763,7 +722,6 @@ static struct hwentry default_hw[] = {
+               .product       = "2810XIV",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = 15,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -786,7 +744,6 @@ static struct hwentry default_hw[] = {
+               .product       = "VDASD",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -803,7 +760,6 @@ static struct hwentry default_hw[] = {
+               .product       = "3303      NVDISK",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = FAILOVER,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -820,7 +776,6 @@ static struct hwentry default_hw[] = {
+               .product       = "NVDISK",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 alua",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -838,7 +793,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = "2 pg_init_retries 50",
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -856,7 +810,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = "2 pg_init_retries 50",
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -874,7 +827,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = "2 pg_init_retries 50",
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -892,7 +844,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = "2 pg_init_retries 50",
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -914,7 +865,6 @@ static struct hwentry default_hw[] = {
+               .product       = "LUN.*",
+               .features      = "3 queue_if_no_path pg_init_retries 50",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .flush_on_last_del = FLUSH_ENABLED,
+@@ -936,7 +886,6 @@ static struct hwentry default_hw[] = {
+               .product       = "COMSTAR",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_SERIAL,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -957,7 +906,6 @@ static struct hwentry default_hw[] = {
+               .product       = "Nseries.*",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -978,7 +926,6 @@ static struct hwentry default_hw[] = {
+               .product       = "Axiom.*",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -1001,7 +948,6 @@ static struct hwentry default_hw[] = {
+               .product       = "TP9[13]00",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -1018,7 +964,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -1035,7 +980,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = "2 pg_init_retries 50",
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -1052,7 +996,6 @@ static struct hwentry default_hw[] = {
+               .product       = "DISK ARRAY",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 alua",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -1075,7 +1018,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -1097,7 +1039,6 @@ static struct hwentry default_hw[] = {
+               .product       = "(StorEdge 3510|T4)",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -1113,7 +1054,6 @@ static struct hwentry default_hw[] = {
+               .product       = "FC2502",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -1135,7 +1075,6 @@ static struct hwentry default_hw[] = {
+               .product       = "RAIGE VOLUME",
+               .features      = "1 queue_if_no_path",
+               .hwhandler     = DEFAULT_HWHANDLER,
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = MULTIBUS,
+               .pgfailback    = FAILBACK_UNDEF,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -1151,7 +1090,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -1169,7 +1107,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -1187,7 +1124,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = "2 pg_init_retries 50",
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
+@@ -1204,7 +1140,6 @@ static struct hwentry default_hw[] = {
+               .bl_product    = "Universal Xport",
+               .features      = DEFAULT_FEATURES,
+               .hwhandler     = "1 rdac",
+-              .selector      = DEFAULT_SELECTOR,
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
+               .rr_weight     = RR_WEIGHT_NONE,
diff --git a/multipath-tools/patches/0016-RHBZ-554561-fix-init-error-msg.patch b/multipath-tools/patches/0016-RHBZ-554561-fix-init-error-msg.patch
deleted file mode 100644 (file)
index ae0ae70..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
----
- 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/multipath-tools/patches/0017-RHBZ-554592-man-page-note.patch b/multipath-tools/patches/0017-RHBZ-554592-man-page-note.patch
deleted file mode 100644 (file)
index 9ebaf92..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
----
- 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/multipath-tools/patches/0018-RHBZ-554596-SUN-6540-config.patch b/multipath-tools/patches/0018-RHBZ-554596-SUN-6540-config.patch
deleted file mode 100644 (file)
index e3296d3..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
----
- 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/multipath-tools/patches/0019-RHBZ-554598-fix-multipath-locking.patch b/multipath-tools/patches/0019-RHBZ-554598-fix-multipath-locking.patch
deleted file mode 100644 (file)
index cf101e2..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
----
- 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/multipath-tools/patches/0020-RHBZ-554605-fix-manual-failover.patch b/multipath-tools/patches/0020-RHBZ-554605-fix-manual-failover.patch
deleted file mode 100644 (file)
index 51b66bd..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
----
- 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/multipath-tools/patches/0021-RHBZ-548874-add-find-multipaths.patch b/multipath-tools/patches/0021-RHBZ-548874-add-find-multipaths.patch
deleted file mode 100644 (file)
index 12ec02c..0000000
+++ /dev/null
@@ -1,1153 +0,0 @@
----
- 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/multipath-tools/patches/0023-RHBZ-557810-emc-invista-config.patch b/multipath-tools/patches/0023-RHBZ-557810-emc-invista-config.patch
deleted file mode 100644 (file)
index 0db517f..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-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/multipath-tools/patches/0024-RHBZ-565933-checker-timeout.patch b/multipath-tools/patches/0024-RHBZ-565933-checker-timeout.patch
deleted file mode 100644 (file)
index 44f12f7..0000000
+++ /dev/null
@@ -1,428 +0,0 @@
----
- 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