device-mapper-multipath-0.4.9-77

Modify 0104-RHBZ-631009-deferred-remove.patch
  * add man page info
Refresh 0112-RHBZ-1194917-add-config_dir-option.patch
Refresh 0114-RHBZ-1196394-delayed-reintegration.patch
Add 0118-UPBZ-1200738-update-eternus-config.patch
  * update default config
Add 0119-RHBZ-1081397-save-alua-info.patch
  * make prioritizers save information between calls to speed them up.
Add 0120-RHBZ-1043093-realloc-fix.patch
  * free old memory if realloc fails.
Add 0121-RHBZ-1197234-rules-fix.patch
  * make sure kpartx runs after an DM_ACTIVATION event occurs.
Add 0122-RHBZ-1212590-dont-use-var.patch
  * use /run instead of /var/run
Add 0123-UPBZ-1166072-fix-path-offline.patch
  * Don't mark quiesce and transport-offline paths as offline
Add 0124-RHBZ-1209275-retrigger-uevents.patch
  * Make multipathd retrigger uevents when paths haven't successfully had
    their udev_attribute environment variable set by udev and add
    "retrigger_ties" and "retrigger_delay" to control this
Add 0125-RHBZ-1153832-kpartx-delete.patch
  * Delete all partition devices with -d (not just the ones in the partition
    table)
Add 0126-RHBZ-1211383-alias-collision.patch
  * make multipathd use the old alias, if rename failed and add
    "new_bindings_in_boot" to determine if new bindings can be added to
    the bindings file in the initramfs
Add 0127-RHBZ-1201030-use-blk-availability.patch
  * Make multipath use blk-availability.service
Add 0128-RHBZ-1222123-mpathconf-allow.patch
  * Add mpathconf --allow for creating specialized config files.
Add 0129-RHBZ-1241774-sun-partition-numbering.patch
  * Make kpartx correctly number sun partitions.
This commit is contained in:
Benjamin Marzinski 2015-08-13 13:57:05 -05:00
parent afd3a226c1
commit 8c4232d3f9
16 changed files with 1599 additions and 10 deletions

View File

@ -11,9 +11,9 @@
libmultipath/propsel.h | 1
libmultipath/structs.h | 8 ++
libmultipath/structs_vec.c | 3 -
multipath/multipath.conf.5 | 14 ++++
multipath/multipath.conf.5 | 36 ++++++++++++
multipathd/main.c | 23 +++++--
14 files changed, 322 insertions(+), 27 deletions(-)
14 files changed, 344 insertions(+), 27 deletions(-)
Index: multipath-tools-130222/libmultipath/config.c
===================================================================
@ -697,7 +697,36 @@ Index: multipath-tools-130222/multipath/multipath.conf.5
===================================================================
--- multipath-tools-130222.orig/multipath/multipath.conf.5
+++ multipath-tools-130222/multipath/multipath.conf.5
@@ -420,6 +420,16 @@ only one checker will run at a time. Th
@@ -84,6 +84,28 @@ directory where the dynamic shared objec
dependent, commonly
.I /lib/multipath
.TP
+.B find_multipaths
+If set to
+.I yes
+, instead of trying to create a multipath device for every non-blacklisted
+path, multipath will only create a device if one of three condidions are
+met.
+.I 1
+There are at least two non-blacklisted paths with the same wwid,
+.I 2
+the user manually forces the creation, by specifying a device with the multipath
+command, or
+.I 3
+a path has the same WWID as a multipath device that was previously created
+while find_multipaths was set (even if that multipath device doesn't currently
+exist).
+Whenever a multipath device is created with find_multipaths set, multipath will
+remeber the WWID of the device, so that it will automatically create the
+device again, as soon as it sees a path with that WWID. This should allow most
+users to have multipath automatically choose the correct paths to make into
+multipath devices, without having to edit the blacklist; Default is
+.I no
+.TP
.B verbosity
default verbosity. Higher values increase the verbosity level. Valid
levels are between 0 and 6; default is
@@ -420,6 +442,16 @@ only one checker will run at a time. Th
multipathd checkers running in parallel causes significant CPU pressure. The
Default is
.I no
@ -714,7 +743,7 @@ Index: multipath-tools-130222/multipath/multipath.conf.5
.
.SH "blacklist section"
The
@@ -521,6 +531,8 @@ section:
@@ -521,6 +553,8 @@ section:
.B features
.TP
.B reservation_key
@ -723,7 +752,7 @@ Index: multipath-tools-130222/multipath/multipath.conf.5
.RE
.PD
.LP
@@ -611,6 +623,8 @@ section:
@@ -611,6 +645,8 @@ section:
.B retain_attached_hw_handler
.TP
.B detect_prio

View File

@ -600,7 +600,7 @@ Index: multipath-tools-130222/multipath/multipath.conf.5
===================================================================
--- multipath-tools-130222.orig/multipath/multipath.conf.5
+++ multipath-tools-130222/multipath/multipath.conf.5
@@ -430,6 +430,13 @@ still in use, it will be freed when the
@@ -452,6 +452,13 @@ still in use, it will be freed when the
to the multipath device before the last user closes it, the deferred remove
will be canceled. Default is
.I no

View File

@ -658,7 +658,7 @@ Index: multipath-tools-130222/multipath/multipath.conf.5
===================================================================
--- multipath-tools-130222.orig/multipath/multipath.conf.5
+++ multipath-tools-130222/multipath/multipath.conf.5
@@ -437,6 +437,25 @@ alphabetically for file ending in ".conf
@@ -459,6 +459,25 @@ alphabetically for file ending in ".conf
information from them, just as if it was in /etc/multipath.conf. config_dir
must either be "" or a fully qualified directory name. Default is
.I "/etc/multipath/conf.d"
@ -684,7 +684,7 @@ Index: multipath-tools-130222/multipath/multipath.conf.5
.
.SH "blacklist section"
The
@@ -540,6 +559,10 @@ section:
@@ -562,6 +581,10 @@ section:
.B reservation_key
.TP
.B deferred_remove
@ -695,7 +695,7 @@ Index: multipath-tools-130222/multipath/multipath.conf.5
.RE
.PD
.LP
@@ -632,6 +655,10 @@ section:
@@ -654,6 +677,10 @@ section:
.B detect_prio
.TP
.B deferred_remove

View File

@ -0,0 +1,31 @@
---
libmultipath/hwtable.c | 2 +-
multipath.conf.defaults | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: multipath-tools-130222/libmultipath/hwtable.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/hwtable.c
+++ multipath-tools-130222/libmultipath/hwtable.c
@@ -310,7 +310,7 @@ static struct hwentry default_hw[] = {
},
{
.vendor = "FUJITSU",
- .product = "ETERNUS_DX(L|400|8000)",
+ .product = "ETERNUS_DX(H|L|M|400|8000)",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
.pgpolicy = GROUP_BY_PRIO,
Index: multipath-tools-130222/multipath.conf.defaults
===================================================================
--- multipath-tools-130222.orig/multipath.conf.defaults
+++ multipath-tools-130222/multipath.conf.defaults
@@ -288,7 +288,7 @@
# }
# device {
# vendor "FUJITSU"
-# product "ETERNUS_DX(L|400|8000)"
+# product "ETERNUS_DX(H|L|M|400|8000)"
# path_grouping_policy "group_by_prio"
# path_checker "tur"
# features "1 queue_if_no_path"

View File

@ -0,0 +1,565 @@
---
libmultipath/prio.c | 34 ++++++++++++++++-
libmultipath/prio.h | 7 +++
libmultipath/prioritizers/alua.c | 62 +++++++++++++++++++++++--------
libmultipath/prioritizers/alua_rtpg.c | 22 +++++++++--
libmultipath/prioritizers/alua_rtpg.h | 4 +-
libmultipath/prioritizers/const.c | 4 ++
libmultipath/prioritizers/datacore.c | 3 +
libmultipath/prioritizers/def_func.h | 11 +++++
libmultipath/prioritizers/emc.c | 4 ++
libmultipath/prioritizers/hds.c | 4 ++
libmultipath/prioritizers/hp_sw.c | 4 ++
libmultipath/prioritizers/iet.c | 4 ++
libmultipath/prioritizers/ontap.c | 4 ++
libmultipath/prioritizers/random.c | 4 ++
libmultipath/prioritizers/rdac.c | 4 ++
libmultipath/prioritizers/weightedpath.c | 3 +
libmultipath/propsel.c | 4 +-
multipathd/main.c | 24 ++++++++----
18 files changed, 174 insertions(+), 32 deletions(-)
Index: multipath-tools-130222/libmultipath/prio.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prio.c
+++ multipath-tools-130222/libmultipath/prio.c
@@ -112,9 +112,24 @@ struct prio * add_prio (char * name)
p->getprio = (int (*)(struct path *, char *)) dlsym(p->handle, "getprio");
errstr = dlerror();
if (errstr != NULL)
- condlog(0, "A dynamic linking error occurred: (%s)", errstr);
+ condlog(0, "A dynamic linking error occurred with getprio: (%s)", errstr);
if (!p->getprio)
goto out;
+
+ p->initprio = (int (*)(struct prio *)) dlsym(p->handle, "initprio");
+ errstr = dlerror();
+ if (errstr != NULL)
+ condlog(0, "A dynamic linking error occurred with initprio: (%s)", errstr);
+ if (!p->initprio)
+ goto out;
+
+ p->freeprio = (int (*)(struct prio *)) dlsym(p->handle, "freeprio");
+ errstr = dlerror();
+ if (errstr != NULL)
+ condlog(0, "A dynamic linking error occurred with freeprio: (%s)", errstr);
+ if (!p->freeprio)
+ goto out;
+
list_add(&p->node, &prioritizers);
return p;
out:
@@ -122,6 +137,13 @@ out:
return NULL;
}
+int prio_init (struct prio * p)
+{
+ if (!p || !p->initprio)
+ return 1;
+ return p->initprio(p);
+}
+
int prio_getprio (struct prio * p, struct path * pp)
{
return p->getprio(pp, p->args);
@@ -156,8 +178,16 @@ void prio_get (struct prio * dst, char *
strncpy(dst->name, src->name, PRIO_NAME_LEN);
if (args)
strncpy(dst->args, args, PRIO_ARGS_LEN);
+ dst->initprio = src->initprio;
dst->getprio = src->getprio;
+ dst->freeprio = src->freeprio;
dst->handle = NULL;
+ dst->context = NULL;
+
+ if (dst->initprio(dst) != 0){
+ memset(dst, 0x0, sizeof(struct prio));
+ return;
+ }
src->refcount++;
}
@@ -173,6 +203,8 @@ void prio_put (struct prio * dst)
src = NULL;
else
src = prio_lookup(dst->name);
+ if (dst->freeprio)
+ dst->freeprio(dst);
memset(dst, 0x0, sizeof(struct prio));
free_prio(src);
}
Index: multipath-tools-130222/libmultipath/prio.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/prio.h
+++ multipath-tools-130222/libmultipath/prio.h
@@ -46,9 +46,15 @@ struct prio {
void *handle;
int refcount;
struct list_head node;
+ void * context;
char name[PRIO_NAME_LEN];
char args[PRIO_ARGS_LEN];
+ int (*initprio)(struct prio * p);
+ /* You are allowed to call initprio multiple times without calling
+ * freeprio. Doing so will reinitialize it (possibly skipping
+ * allocations) */
int (*getprio)(struct path *, char *);
+ int (*freeprio)(struct prio * p);
};
unsigned int get_prio_timeout(unsigned int default_timeout);
@@ -57,6 +63,7 @@ void cleanup_prio (void);
struct prio * add_prio (char *);
struct prio * prio_lookup (char *);
int prio_getprio (struct prio *, struct path *);
+int prio_init (struct prio *);
void prio_get (struct prio *, char *, char *);
void prio_put (struct prio *);
int prio_selected (struct prio *);
Index: multipath-tools-130222/libmultipath/prioritizers/alua.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/alua.c
+++ multipath-tools-130222/libmultipath/prioritizers/alua.c
@@ -37,6 +37,12 @@ static const char * aas_string[] = {
[AAS_TRANSITIONING] = "transitioning between states",
};
+struct alua_context {
+ int tpg_support;
+ int tpg;
+ int buflen;
+};
+
static const char *aas_print_string(int rc)
{
rc &= 0x7f;
@@ -51,25 +57,26 @@ static const char *aas_print_string(int
}
int
-get_alua_info(int fd)
+get_alua_info(int fd, struct alua_context *ct)
{
int rc;
- int tpg;
int aas;
- rc = get_target_port_group_support(fd);
- if (rc < 0)
- return -ALUA_PRIO_TPGS_FAILED;
-
- if (rc == TPGS_NONE)
- return -ALUA_PRIO_NOT_SUPPORTED;
-
- tpg = get_target_port_group(fd);
- if (tpg < 0)
- return -ALUA_PRIO_RTPG_FAILED;
+ if (ct->tpg_support <= 0 || ct->tpg < 0) {
+ ct->tpg_support = get_target_port_group_support(fd);
+ if (ct->tpg_support < 0)
+ return -ALUA_PRIO_TPGS_FAILED;
+
+ if (ct->tpg_support == TPGS_NONE)
+ return -ALUA_PRIO_NOT_SUPPORTED;
+
+ ct->tpg = get_target_port_group(fd, &ct->buflen);
+ if (ct->tpg < 0)
+ return -ALUA_PRIO_RTPG_FAILED;
+ }
- condlog(3, "reported target port group is %i", tpg);
- rc = get_asymmetric_access_state(fd, tpg);
+ condlog(3, "reported target port group is %i", ct->tpg);
+ rc = get_asymmetric_access_state(fd, ct->tpg, &ct->buflen);
if (rc < 0)
return -ALUA_PRIO_GETAAS_FAILED;
aas = (rc & 0x0f);
@@ -88,7 +95,7 @@ int getprio (struct path * pp, char * ar
if (pp->fd < 0)
return -ALUA_PRIO_NO_INFORMATION;
- rc = get_alua_info(pp->fd);
+ rc = get_alua_info(pp->fd, pp->prio.context);
if (rc >= 0) {
aas = (rc & 0x0f);
priopath = (rc & 0x80);
@@ -128,3 +135,28 @@ int getprio (struct path * pp, char * ar
}
return rc;
}
+
+int initprio(struct prio *p)
+{
+ if (!p->context) {
+ struct alua_context *ct;
+
+ ct = malloc(sizeof(struct alua_context));
+ if (!ct)
+ return 1;
+ p->context = ct;
+ }
+ memset(p->context, 0, sizeof(struct alua_context));
+ return 0;
+}
+
+
+int freeprio(struct prio *p)
+{
+ if (p->context) {
+ free(p->context);
+ p->context = NULL;
+ }
+ return 0;
+}
+
Index: multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/alua_rtpg.c
+++ multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.c
@@ -171,7 +171,7 @@ get_target_port_group_support(int fd)
}
int
-get_target_port_group(int fd)
+get_target_port_group(int fd, int *buflen_ptr)
{
unsigned char *buf;
struct vpd83_data * vpd83;
@@ -179,7 +179,12 @@ get_target_port_group(int fd)
int rc;
int buflen, scsi_buflen;
- buflen = 128; /* Lets start from 128 */
+ if (!buflen_ptr || *buflen_ptr == 0) {
+ buflen = 128; /* Lets start from 128 */
+ if (buflen_ptr)
+ *buflen_ptr = 128;
+ } else
+ buflen = *buflen_ptr;
buf = (unsigned char *)malloc(buflen);
if (!buf) {
PRINT_DEBUG("malloc failed: could not allocate"
@@ -202,6 +207,8 @@ get_target_port_group(int fd)
return -RTPG_RTPG_FAILED;
}
buflen = scsi_buflen;
+ if (buflen_ptr)
+ *buflen_ptr = buflen;
memset(buf, 0, buflen);
rc = do_inquiry(fd, 1, 0x83, buf, buflen);
if (rc < 0)
@@ -269,7 +276,7 @@ do_rtpg(int fd, void* resp, long resplen
}
int
-get_asymmetric_access_state(int fd, unsigned int tpg)
+get_asymmetric_access_state(int fd, unsigned int tpg, int *buflen_ptr)
{
unsigned char *buf;
struct rtpg_data * tpgd;
@@ -278,7 +285,12 @@ get_asymmetric_access_state(int fd, unsi
int buflen;
uint32_t scsi_buflen;
- buflen = 128; /* Initial value from old code */
+ if (!buflen_ptr || *buflen_ptr == 0) {
+ buflen = 128; /* Initial value from old code */
+ if (buflen_ptr)
+ *buflen_ptr = 128;
+ } else
+ buflen = *buflen_ptr;
buf = (unsigned char *)malloc(buflen);
if (!buf) {
PRINT_DEBUG ("malloc failed: could not allocate"
@@ -299,6 +311,8 @@ get_asymmetric_access_state(int fd, unsi
return -RTPG_RTPG_FAILED;
}
buflen = scsi_buflen;
+ if (buflen_ptr)
+ *buflen_ptr = buflen;
memset(buf, 0, buflen);
rc = do_rtpg(fd, buf, buflen);
if (rc < 0)
Index: multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/alua_rtpg.h
+++ multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.h
@@ -23,8 +23,8 @@
#define RTPG_TPG_NOT_FOUND 4
int get_target_port_group_support(int fd);
-int get_target_port_group(int fd);
-int get_asymmetric_access_state(int fd, unsigned int tpg);
+int get_target_port_group(int fd, int *buflen_ptr);
+int get_asymmetric_access_state(int fd, unsigned int tpg, int *buflen_ptr);
#endif /* __RTPG_H__ */
Index: multipath-tools-130222/libmultipath/prioritizers/const.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/const.c
+++ multipath-tools-130222/libmultipath/prioritizers/const.c
@@ -1,8 +1,12 @@
#include <stdio.h>
#include <prio.h>
+#include "def_func.h"
int getprio (struct path * pp, char * args)
{
return 1;
}
+
+declare_nop_prio(initprio)
+declare_nop_prio(freeprio)
Index: multipath-tools-130222/libmultipath/prioritizers/datacore.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/datacore.c
+++ multipath-tools-130222/libmultipath/prioritizers/datacore.c
@@ -25,6 +25,7 @@
#include <debug.h>
#include <prio.h>
#include <structs.h>
+#include "def_func.h"
#define INQ_REPLY_LEN 255
#define INQ_CMD_CODE 0x12
@@ -111,3 +112,5 @@ int getprio (struct path * pp, char * ar
return datacore_prio(pp->dev, pp->fd, args);
}
+declare_nop_prio(initprio)
+declare_nop_prio(freeprio)
Index: multipath-tools-130222/libmultipath/prioritizers/def_func.h
===================================================================
--- /dev/null
+++ multipath-tools-130222/libmultipath/prioritizers/def_func.h
@@ -0,0 +1,11 @@
+#ifndef _DEF_FUNC_H
+#define _DEF_FUNC_H
+
+#include "prio.h"
+
+#define declare_nop_prio(name) \
+int name (struct prio *p) \
+{ \
+ return 0; \
+}
+#endif /* _DEF_FUNC_H */
Index: multipath-tools-130222/libmultipath/prioritizers/emc.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/emc.c
+++ multipath-tools-130222/libmultipath/prioritizers/emc.c
@@ -6,6 +6,7 @@
#include <debug.h>
#include <prio.h>
#include <structs.h>
+#include "def_func.h"
#define INQUIRY_CMD 0x12
#define INQUIRY_CMDLEN 6
@@ -85,3 +86,6 @@ int getprio (struct path * pp, char * ar
{
return emc_clariion_prio(pp->dev, pp->fd);
}
+
+declare_nop_prio(initprio)
+declare_nop_prio(freeprio)
Index: multipath-tools-130222/libmultipath/prioritizers/hds.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/hds.c
+++ multipath-tools-130222/libmultipath/prioritizers/hds.c
@@ -76,6 +76,7 @@
#include <debug.h>
#include <prio.h>
#include <structs.h>
+#include "def_func.h"
#define INQ_REPLY_LEN 255
#define INQ_CMD_CODE 0x12
@@ -170,3 +171,6 @@ int getprio (struct path * pp, char * ar
{
return hds_modular_prio(pp->dev, pp->fd);
}
+
+declare_nop_prio(initprio)
+declare_nop_prio(freeprio)
Index: multipath-tools-130222/libmultipath/prioritizers/hp_sw.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/hp_sw.c
+++ multipath-tools-130222/libmultipath/prioritizers/hp_sw.c
@@ -16,6 +16,7 @@
#include <debug.h>
#include <prio.h>
#include <structs.h>
+#include "def_func.h"
#define TUR_CMD_LEN 6
#define SCSI_CHECK_CONDITION 0x2
@@ -99,3 +100,6 @@ int getprio (struct path * pp, char * ar
{
return hp_sw_prio(pp->dev, pp->fd);
}
+
+declare_nop_prio(initprio)
+declare_nop_prio(freeprio)
Index: multipath-tools-130222/libmultipath/prioritizers/iet.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/iet.c
+++ multipath-tools-130222/libmultipath/prioritizers/iet.c
@@ -9,6 +9,7 @@
#include <debug.h>
#include <unistd.h>
#include <structs.h>
+#include "def_func.h"
//
// This prioritizer suits iSCSI needs, makes it possible to prefer one path.
@@ -141,3 +142,6 @@ int getprio(struct path * pp, char * arg
{
return iet_prio(pp->dev, args);
}
+
+declare_nop_prio(initprio)
+declare_nop_prio(freeprio)
Index: multipath-tools-130222/libmultipath/prioritizers/ontap.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/ontap.c
+++ multipath-tools-130222/libmultipath/prioritizers/ontap.c
@@ -23,6 +23,7 @@
#include <debug.h>
#include <prio.h>
#include <structs.h>
+#include "def_func.h"
#define INQUIRY_CMD 0x12
#define INQUIRY_CMDLEN 6
@@ -245,3 +246,6 @@ int getprio (struct path * pp, char * ar
{
return ontap_prio(pp->dev, pp->fd);
}
+
+declare_nop_prio(initprio)
+declare_nop_prio(freeprio)
Index: multipath-tools-130222/libmultipath/prioritizers/random.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/random.c
+++ multipath-tools-130222/libmultipath/prioritizers/random.c
@@ -4,6 +4,7 @@
#include <time.h>
#include <prio.h>
+#include "def_func.h"
int getprio (struct path * pp, char * args)
{
@@ -13,3 +14,6 @@ int getprio (struct path * pp, char * ar
srand((unsigned int)tv.tv_usec);
return 1+(int) (10.0*rand()/(RAND_MAX+1.0));
}
+
+declare_nop_prio(initprio)
+declare_nop_prio(freeprio)
Index: multipath-tools-130222/libmultipath/prioritizers/rdac.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/rdac.c
+++ multipath-tools-130222/libmultipath/prioritizers/rdac.c
@@ -6,6 +6,7 @@
#include <debug.h>
#include <prio.h>
#include <structs.h>
+#include "def_func.h"
#define INQUIRY_CMD 0x12
#define INQUIRY_CMDLEN 6
@@ -95,3 +96,6 @@ int getprio (struct path * pp, char * ar
{
return rdac_prio(pp->dev, pp->fd);
}
+
+declare_nop_prio(initprio)
+declare_nop_prio(freeprio)
Index: multipath-tools-130222/libmultipath/prioritizers/weightedpath.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/weightedpath.c
+++ multipath-tools-130222/libmultipath/prioritizers/weightedpath.c
@@ -32,6 +32,7 @@
#include <memory.h>
#include <debug.h>
#include <regex.h>
+#include "def_func.h"
char *get_next_string(char **temp, char *split_char)
{
@@ -104,3 +105,5 @@ int getprio(struct path *pp, char *args)
return prio_path_weight(pp, args);
}
+declare_nop_prio(initprio)
+declare_nop_prio(freeprio)
Index: multipath-tools-130222/libmultipath/propsel.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/propsel.c
+++ multipath-tools-130222/libmultipath/propsel.c
@@ -401,10 +401,10 @@ detect_prio(struct path * pp)
if (get_target_port_group_support(pp->fd) <= 0)
return;
- ret = get_target_port_group(pp->fd);
+ ret = get_target_port_group(pp->fd, NULL);
if (ret < 0)
return;
- if (get_asymmetric_access_state(pp->fd, ret) < 0)
+ if (get_asymmetric_access_state(pp->fd, ret, NULL) < 0)
return;
prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS);
}
Index: multipath-tools-130222/multipathd/main.c
===================================================================
--- multipath-tools-130222.orig/multipathd/main.c
+++ multipath-tools-130222/multipathd/main.c
@@ -700,20 +700,23 @@ static int
uev_update_path (struct uevent *uev, struct vectors * vecs)
{
int ro, retval = 0;
+ struct path * pp;
+
+ pp = find_path_by_dev(vecs->pathvec, uev->kernel);
+ if (!pp) {
+ condlog(0, "%s: spurious uevent, path not found",
+ uev->kernel);
+ return 1;
+ }
+ /* reinit the prio values on change event, in case something is
+ * different */
+ prio_init(&pp->prio);
ro = uevent_get_disk_ro(uev);
if (ro >= 0) {
- struct path * pp;
-
condlog(2, "%s: update path write_protect to '%d' (uevent)",
uev->kernel, ro);
- pp = find_path_by_dev(vecs->pathvec, uev->kernel);
- if (!pp) {
- condlog(0, "%s: spurious uevent, path not found",
- uev->kernel);
- return 1;
- }
if (pp->mpp) {
retval = reload_map(vecs, pp->mpp, 0);
@@ -1218,6 +1221,11 @@ check_path (struct vectors * vecs, struc
}
if(newstate == PATH_UP || newstate == PATH_GHOST){
+ /*
+ * Reinitialize the prioritizer, in case something
+ * changed.
+ */
+ prio_init(&pp->prio);
if ( pp->mpp && pp->mpp->prflag ){
/*
* Check Persistent Reservation.

View File

@ -0,0 +1,195 @@
---
libmultipath/dmparser.c | 6 ++++--
libmultipath/regex.c | 9 ++++++++-
multipath/main.c | 9 ++++++---
multipathd/cli_handlers.c | 41 ++++++++++++-----------------------------
multipathd/uxlsnr.c | 13 ++++++++++++-
5 files changed, 42 insertions(+), 36 deletions(-)
Index: multipath-tools-130222/libmultipath/dmparser.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/dmparser.c
+++ multipath-tools-130222/libmultipath/dmparser.c
@@ -20,14 +20,16 @@
static int
merge_words (char ** dst, char * word, int space)
{
- char * p;
+ char * p = *dst;
int len;
len = strlen(*dst) + strlen(word) + space;
*dst = REALLOC(*dst, len + 1);
- if (!*dst)
+ if (!*dst) {
+ free(p);
return 1;
+ }
p = *dst;
Index: multipath-tools-130222/libmultipath/regex.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/regex.c
+++ multipath-tools-130222/libmultipath/regex.c
@@ -123,7 +123,14 @@ static void init_syntax_once(void)
/* (Re)Allocate N items of type T using malloc, or fail. */
#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
-#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
+#define RETALLOC(addr, n, t) \
+do { \
+ t *tmp = (t *) realloc (addr, (n) * sizeof (t)); \
+ if (!tmp) \
+ free(addr); \
+ (addr) = tmp; \
+} while(0)
+
#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
#define BYTEWIDTH 8 /* In bits. */
Index: multipath-tools-130222/multipath/main.c
===================================================================
--- multipath-tools-130222.orig/multipath/main.c
+++ multipath-tools-130222/multipath/main.c
@@ -394,7 +394,7 @@ out:
static int
dump_config (void)
{
- char * c;
+ char * c, * tmp = NULL;
char * reply;
unsigned int maxlen = 256;
int again = 1;
@@ -402,9 +402,12 @@ dump_config (void)
reply = MALLOC(maxlen);
while (again) {
- if (!reply)
+ if (!reply) {
+ if (tmp)
+ free(tmp);
return 1;
- c = reply;
+ }
+ c = tmp = reply;
c += snprint_defaults(c, reply + maxlen - c);
again = ((c - reply) == maxlen);
if (again) {
Index: multipath-tools-130222/multipathd/cli_handlers.c
===================================================================
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
+++ multipath-tools-130222/multipathd/cli_handlers.c
@@ -26,11 +26,14 @@
#define REALLOC_REPLY(r, a, m) \
do { \
if ((a)) { \
+ char *tmp = (r); \
(r) = REALLOC((r), (m) * 2); \
if ((r)) { \
memset((r) + (m), 0, (m)); \
(m) *= 2; \
} \
+ else \
+ free(tmp); \
} \
} while (0)
@@ -144,7 +147,7 @@ show_config (char ** r, int * len)
unsigned int maxlen = INITIAL_REPLY_LEN;
int again = 1;
- reply = MALLOC(maxlen);
+ c = reply = MALLOC(maxlen);
while (again) {
if (!reply)
@@ -152,44 +155,24 @@ show_config (char ** r, int * len)
c = reply;
c += snprint_defaults(c, reply + maxlen - c);
again = ((c - reply) == maxlen);
- if (again) {
- reply = REALLOC(reply, maxlen * 2);
- if (!reply)
- return 1;
- memset(reply + maxlen, 0, maxlen);
- maxlen *= 2;
+ REALLOC_REPLY(reply, again, maxlen);
+ if (again)
continue;
- }
c += snprint_blacklist(c, reply + maxlen - c);
again = ((c - reply) == maxlen);
- if (again) {
- reply = REALLOC(reply, maxlen * 2);
- if (!reply)
- return 1;
- memset(reply + maxlen, 0, maxlen);
- maxlen *= 2;
+ REALLOC_REPLY(reply, again, maxlen);
+ if (again)
continue;
- }
c += snprint_blacklist_except(c, reply + maxlen - c);
again = ((c - reply) == maxlen);
- if (again) {
- reply = REALLOC(reply, maxlen * 2);
- if (!reply)
- return 1;
- memset(reply + maxlen, 0, maxlen);
- maxlen *= 2;
+ REALLOC_REPLY(reply, again, maxlen);
+ if (again)
continue;
- }
c += snprint_hwtable(c, reply + maxlen - c, conf->hwtable);
again = ((c - reply) == maxlen);
- if (again) {
- reply = REALLOC(reply, maxlen * 2);
- if (!reply)
- return 1;
- memset(reply + maxlen, 0, maxlen);
- maxlen *= 2;
+ REALLOC_REPLY(reply, again, maxlen);
+ if (again)
continue;
- }
c += snprint_mptable(c, reply + maxlen - c, conf->mptable);
again = ((c - reply) == maxlen);
REALLOC_REPLY(reply, again, maxlen);
Index: multipath-tools-130222/multipathd/uxlsnr.c
===================================================================
--- multipath-tools-130222.orig/multipathd/uxlsnr.c
+++ multipath-tools-130222/multipathd/uxlsnr.c
@@ -64,6 +64,10 @@ static void new_client(int ux_sock)
/* put it in our linked list */
c = (struct client *)MALLOC(sizeof(*c));
+ if (!c) {
+ close(fd);
+ return;
+ }
memset(c, 0, sizeof(*c));
c->fd = fd;
c->next = clients;
@@ -124,11 +128,18 @@ void * uxsock_listen(int (*uxsock_trigge
sigdelset(&mask, SIGHUP);
sigdelset(&mask, SIGUSR1);
while (1) {
+ struct pollfd *tmp;
struct client *c;
int i, poll_count;
/* setup for a poll */
- polls = REALLOC(polls, (1+num_clients) * sizeof(*polls));
+ tmp = REALLOC(polls, (1+num_clients) * sizeof(*polls));
+ /* If we can't allocate poliing space for the new client,
+ * close it */
+ if (!tmp)
+ dead_client(clients);
+ else
+ polls = tmp;
polls[0].fd = ux_sock;
polls[0].events = POLLIN;

View File

@ -0,0 +1,28 @@
---
multipath/multipath.rules | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Index: multipath-tools-130222/multipath/multipath.rules
===================================================================
--- multipath-tools-130222.orig/multipath/multipath.rules
+++ multipath-tools-130222/multipath/multipath.rules
@@ -21,6 +21,7 @@ ACTION!="change", GOTO="update_timestamp
IMPORT{db}="DM_MULTIPATH_TIMESTAMP"
IMPORT{db}="DM_MULTIPATH_DEVICE_PATH"
IMPORT{db}="DM_MULTIPATH_WIPE_PARTS"
+IMPORT{db}="DM_MULTIPATH_NEED_KPARTX"
# Check if the device is part of a multipath device. the -T option just keeps
# the old result if the timestamp hasn't changed.
PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -T $env{DM_MULTIPATH_TIMESTAMP}:$env{DM_MULTIPATH_DEVICE_PATH} -c $env{DEVNAME}", \
@@ -43,7 +44,10 @@ KERNEL!="dm-*", GOTO="end_mpath"
ENV{DM_UUID}=="mpath-?*|part[0-9]*-mpath-?*", OPTIONS+="link_priority=10"
ACTION!="change", GOTO="end_mpath"
ENV{DM_UUID}!="mpath-?*", GOTO="end_mpath"
+ENV{DM_ACTIVATION}=="1", ENV{DM_MULTIPATH_NEED_KPARTX}="1"
ENV{DM_SUSPENDED}=="1", GOTO="end_mpath"
ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath"
-ENV{DM_ACTIVATION}=="1", RUN+="$env{MPATH_SBIN_PATH}/kpartx -u $tempnode"
+ENV{DM_ACTIVATION}!="1", ENV{DM_MULTIPATH_NEED_KPARTX}!="1", GOTO="end_mpath"
+RUN+="$env{MPATH_SBIN_PATH}/kpartx -a $tempnode", \
+ ENV{DM_MULTIPATH_NEED_KPARTX}=""
LABEL="end_mpath"

View File

@ -0,0 +1,33 @@
---
libmultipath/defaults.h | 4 ++--
multipathd/multipathd.service | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
Index: multipath-tools-130222/libmultipath/defaults.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/defaults.h
+++ multipath-tools-130222/libmultipath/defaults.h
@@ -26,8 +26,8 @@
#define MAX_CHECKINT(a) (a << 2)
#define MAX_DEV_LOSS_TMO 0x7FFFFFFF
-#define DEFAULT_PIDFILE "/var/run/multipathd/multipathd.pid"
-#define DEFAULT_TIMESTAMP_FILE "/var/run/multipathd/timestamp"
+#define DEFAULT_PIDFILE "/run/multipathd/multipathd.pid"
+#define DEFAULT_TIMESTAMP_FILE "/run/multipathd/timestamp"
#define DEFAULT_SOCKET "/org/kernel/linux/storage/multipathd"
#define DEFAULT_CONFIGFILE "/etc/multipath.conf"
#define DEFAULT_BINDINGS_FILE "/etc/multipath/bindings"
Index: multipath-tools-130222/multipathd/multipathd.service
===================================================================
--- multipath-tools-130222.orig/multipathd/multipathd.service
+++ multipath-tools-130222/multipathd/multipathd.service
@@ -9,7 +9,7 @@ Conflicts=shutdown.target
[Service]
Type=forking
-PIDFile=/var/run/multipathd/multipathd.pid
+PIDFile=/run/multipathd/multipathd.pid
ExecStartPre=/sbin/modprobe dm-multipath
ExecStartPre=-/sbin/multipath -A
ExecStart=/sbin/multipathd

View File

@ -0,0 +1,19 @@
---
libmultipath/discovery.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
Index: multipath-tools-130222/libmultipath/discovery.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/discovery.c
+++ multipath-tools-130222/libmultipath/discovery.c
@@ -946,9 +946,7 @@ path_offline (struct path * pp)
condlog(3, "%s: path state = %s", pp->dev, buff);
- if (!strncmp(buff, "offline", 7) ||
- !strncmp(buff, "quiesce", 7) ||
- !strncmp(buff, "transport-offline", 17)) {
+ if (!strncmp(buff, "offline", 7)) {
pp->offline = 1;
return PATH_DOWN;
}

View File

@ -0,0 +1,214 @@
---
libmultipath/config.c | 2 ++
libmultipath/config.h | 2 ++
libmultipath/defaults.h | 2 ++
libmultipath/dict.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
libmultipath/discovery.c | 8 +++++---
libmultipath/structs.h | 8 ++++++++
multipathd/main.c | 15 ++++++++++++++-
7 files changed, 79 insertions(+), 4 deletions(-)
Index: multipath-tools-130222/libmultipath/config.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/config.c
+++ multipath-tools-130222/libmultipath/config.c
@@ -673,6 +673,8 @@ load_config (char * file, struct udev *u
conf->force_sync = 0;
conf->ignore_new_boot_devs = 0;
conf->processed_main_config = 0;
+ conf->retrigger_tries = DEFAULT_RETRIGGER_TRIES;
+ conf->retrigger_delay = DEFAULT_RETRIGGER_DELAY;
/*
* preload default hwtable
Index: multipath-tools-130222/libmultipath/config.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/config.h
+++ multipath-tools-130222/libmultipath/config.h
@@ -139,6 +139,8 @@ struct config {
int processed_main_config;
int delay_watch_checks;
int delay_wait_checks;
+ int retrigger_tries;
+ int retrigger_delay;
unsigned int version[3];
char * dev;
Index: multipath-tools-130222/libmultipath/defaults.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/defaults.h
+++ multipath-tools-130222/libmultipath/defaults.h
@@ -21,6 +21,8 @@
#define DEFAULT_DETECT_PRIO DETECT_PRIO_OFF
#define DEFAULT_DEFERRED_REMOVE DEFERRED_REMOVE_OFF
#define DEFAULT_DELAY_CHECKS DELAY_CHECKS_OFF
+#define DEFAULT_RETRIGGER_DELAY 10
+#define DEFAULT_RETRIGGER_TRIES 3
#define DEFAULT_CHECKINT 5
#define MAX_CHECKINT(a) (a << 2)
Index: multipath-tools-130222/libmultipath/dict.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/dict.c
+++ multipath-tools-130222/libmultipath/dict.c
@@ -839,6 +839,38 @@ def_delay_wait_checks_handler(vector str
return 0;
}
+static int
+def_retrigger_tries_handler(vector strvec)
+{
+ char * buff;
+
+ buff = set_value(strvec);
+
+ if (!buff)
+ return 1;
+
+ conf->retrigger_tries = atoi(buff);
+ FREE(buff);
+
+ return 0;
+}
+
+static int
+def_retrigger_delay_handler(vector strvec)
+{
+ char * buff;
+
+ buff = set_value(strvec);
+
+ if (!buff)
+ return 1;
+
+ conf->retrigger_delay = atoi(buff);
+ FREE(buff);
+
+ return 0;
+}
+
/*
* blacklist block handlers
*/
@@ -3194,6 +3226,18 @@ snprint_def_delay_wait_checks(char * buf
}
static int
+snprint_def_retrigger_tries (char * buff, int len, void * data)
+{
+ return snprintf(buff, len, "%i", conf->retrigger_tries);
+}
+
+static int
+snprint_def_retrigger_delay (char * buff, int len, void * data)
+{
+ return snprintf(buff, len, "%i", conf->retrigger_delay);
+}
+
+static int
snprint_ble_simple (char * buff, int len, void * data)
{
struct blentry * ble = (struct blentry *)data;
@@ -3267,6 +3311,8 @@ init_keywords(void)
install_keyword("config_dir", &def_config_dir_handler, &snprint_def_config_dir);
install_keyword("delay_watch_checks", &def_delay_watch_checks_handler, &snprint_def_delay_watch_checks);
install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks);
+ install_keyword("retrigger_tries", &def_retrigger_tries_handler, &snprint_def_retrigger_tries);
+ install_keyword("retrigger_delay", &def_retrigger_delay_handler, &snprint_def_retrigger_delay);
__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-130222/libmultipath/discovery.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/discovery.c
+++ multipath-tools-130222/libmultipath/discovery.c
@@ -1111,9 +1111,13 @@ get_uid (struct path * pp)
len = strlen(value);
}
strncpy(pp->wwid, value, len);
+ pp->missing_udev_info = INFO_OK;
+ pp->tick = 0;
} else {
condlog(3, "%s: no %s attribute", pp->dev,
pp->uid_attribute);
+ pp->missing_udev_info = INFO_MISSING;
+ pp->tick = conf->retrigger_delay;
}
/* Strip any trailing blanks */
@@ -1201,10 +1205,8 @@ pathinfo (struct path *pp, vector hwtabl
* Retrieve path priority, even for PATH_DOWN paths if it has never
* been successfully obtained before.
*/
- if ((mask & DI_PRIO) && path_state == PATH_UP) {
+ if ((mask & DI_PRIO) && path_state == PATH_UP && strlen(pp->wwid)) {
if (pp->state != PATH_DOWN || pp->priority == PRIO_UNDEF) {
- if (!strlen(pp->wwid))
- get_uid(pp);
get_prio(pp);
}
}
Index: multipath-tools-130222/libmultipath/structs.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/structs.h
+++ multipath-tools-130222/libmultipath/structs.h
@@ -139,6 +139,12 @@ enum delay_checks_states {
DELAY_CHECKS_UNDEF = 0,
};
+enum missing_udev_info_states {
+ INFO_OK,
+ INFO_MISSING,
+ INFO_REQUESTED,
+};
+
struct sg_id {
int host_no;
int channel;
@@ -193,6 +199,8 @@ struct path {
struct checker checker;
struct multipath * mpp;
int fd;
+ int missing_udev_info;
+ int retriggers;
/* configlet pointers */
struct hwentry * hwe;
Index: multipath-tools-130222/multipathd/main.c
===================================================================
--- multipath-tools-130222.orig/multipathd/main.c
+++ multipath-tools-130222/multipathd/main.c
@@ -708,6 +708,10 @@ uev_update_path (struct uevent *uev, str
uev->kernel);
return 1;
}
+
+ if (pp->missing_udev_info == INFO_REQUESTED)
+ return uev_add_path(uev, vecs);
+
/* reinit the prio values on change event, in case something is
* different */
prio_init(&pp->prio);
@@ -1133,12 +1137,21 @@ check_path (struct vectors * vecs, struc
int chkr_new_path_up = 0;
int oldchkrstate = pp->chkrstate;
- if (!pp->mpp)
+ if (!pp->mpp && (pp->missing_udev_info != INFO_MISSING ||
+ pp->retriggers >= conf->retrigger_tries))
return;
if (pp->tick && --pp->tick)
return; /* don't check this path yet */
+ if (!pp->mpp) {
+ pp->missing_udev_info = INFO_REQUESTED;
+ pp->retriggers++;
+ sysfs_attr_set_value(pp->udev, "uevent", "change",
+ strlen("change"));
+ return;
+ }
+
/*
* provision a next check soonest,
* in case we exit abnormaly from here

View File

@ -0,0 +1,26 @@
---
kpartx/kpartx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: multipath-tools-130222/kpartx/kpartx.c
===================================================================
--- multipath-tools-130222.orig/kpartx/kpartx.c
+++ multipath-tools-130222/kpartx/kpartx.c
@@ -409,7 +409,7 @@ main(int argc, char **argv){
break;
case DELETE:
- for (j = n-1; j >= 0; j--) {
+ for (j = MAXSLICES-1; j >= 0; j--) {
if (safe_sprintf(partname, "%s%s%d",
mapname, delim, j+1)) {
fprintf(stderr, "partname too small\n");
@@ -417,7 +417,7 @@ main(int argc, char **argv){
}
strip_slash(partname);
- if (!slices[j].size || !dm_map_present(partname))
+ if (!dm_map_present(partname))
continue;
if (!dm_simplecmd(DM_DEVICE_REMOVE, partname,

View File

@ -0,0 +1,113 @@
---
libmultipath/config.c | 4 ++++
libmultipath/config.h | 1 +
libmultipath/configure.c | 3 +++
libmultipath/dict.c | 33 +++++++++++++++++++++++++++++++++
4 files changed, 41 insertions(+)
Index: multipath-tools-130222/libmultipath/configure.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/configure.c
+++ multipath-tools-130222/libmultipath/configure.c
@@ -422,6 +422,9 @@ select_action (struct multipath * mpp, v
condlog(2, "%s: unable to rename %s to %s (%s is used by %s)",
mpp->wwid, cmpp->alias, mpp->alias,
mpp->alias, cmpp_by_name->wwid);
+ /* reset alias to existing alias */
+ FREE(mpp->alias);
+ mpp->alias = STRDUP(cmpp->alias);
mpp->action = ACT_NOTHING;
return;
}
Index: multipath-tools-130222/libmultipath/config.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/config.c
+++ multipath-tools-130222/libmultipath/config.c
@@ -675,6 +675,7 @@ load_config (char * file, struct udev *u
conf->processed_main_config = 0;
conf->retrigger_tries = DEFAULT_RETRIGGER_TRIES;
conf->retrigger_delay = DEFAULT_RETRIGGER_DELAY;
+ conf->new_bindings_in_boot = 0;
/*
* preload default hwtable
@@ -794,6 +795,9 @@ load_config (char * file, struct udev *u
if (conf->ignore_new_boot_devs)
in_initrd();
+ if (conf->new_bindings_in_boot == 0 && in_initrd())
+ conf->bindings_read_only = 1;
+
return 0;
out:
free_config(conf);
Index: multipath-tools-130222/libmultipath/config.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/config.h
+++ multipath-tools-130222/libmultipath/config.h
@@ -141,6 +141,7 @@ struct config {
int delay_wait_checks;
int retrigger_tries;
int retrigger_delay;
+ int new_bindings_in_boot;
unsigned int version[3];
char * dev;
Index: multipath-tools-130222/libmultipath/dict.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/dict.c
+++ multipath-tools-130222/libmultipath/dict.c
@@ -871,6 +871,29 @@ def_retrigger_delay_handler(vector strve
return 0;
}
+static int
+def_new_bindings_in_boot_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->new_bindings_in_boot = 0;
+ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
+ (strlen(buff) == 1 && !strcmp(buff, "1")))
+ conf->new_bindings_in_boot = 1;
+ else
+ conf->new_bindings_in_boot = 0;
+
+ FREE(buff);
+ return 0;
+}
+
/*
* blacklist block handlers
*/
@@ -3238,6 +3261,15 @@ snprint_def_retrigger_delay (char * buff
}
static int
+snprint_def_new_bindings_in_boot(char * buff, int len, void * data)
+{
+ if (conf->new_bindings_in_boot == 1)
+ return snprintf(buff, len, "yes");
+ else
+ return snprintf(buff, len, "no");
+}
+
+static int
snprint_ble_simple (char * buff, int len, void * data)
{
struct blentry * ble = (struct blentry *)data;
@@ -3313,6 +3345,7 @@ init_keywords(void)
install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks);
install_keyword("retrigger_tries", &def_retrigger_tries_handler, &snprint_def_retrigger_tries);
install_keyword("retrigger_delay", &def_retrigger_delay_handler, &snprint_def_retrigger_delay);
+ install_keyword("new_bindings_in_boot", &def_new_bindings_in_boot_handler, &snprint_def_new_bindings_in_boot);
__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);

View File

@ -0,0 +1,15 @@
---
multipathd/multipathd.service | 1 +
1 file changed, 1 insertion(+)
Index: multipath-tools-130222/multipathd/multipathd.service
===================================================================
--- multipath-tools-130222.orig/multipathd/multipathd.service
+++ multipath-tools-130222/multipathd/multipathd.service
@@ -1,5 +1,6 @@
[Unit]
Description=Device-Mapper Multipath Device Controller
+Requires=blk-availability.service
Before=iscsi.service iscsid.service lvm2-activation-early.service
After=syslog.target
ConditionPathExists=/etc/multipath.conf

View File

@ -0,0 +1,244 @@
---
multipath/mpathconf | 135 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 124 insertions(+), 11 deletions(-)
Index: multipath-tools-130222/multipath/mpathconf
===================================================================
--- multipath-tools-130222.orig/multipath/mpathconf
+++ multipath-tools-130222/multipath/mpathconf
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
#
@@ -17,7 +17,7 @@
# 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
+unset ENABLE FIND FRIENDLY MODULE MULTIPATHD HAVE_DISABLE HAVE_WWID_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_EXCEPTIONS HAVE_DEFAULTS HAVE_FRIENDLY HAVE_MULTIPATHD HAVE_MODULE HAVE_OUTFILE SHOW_STATUS CHANGED_CONFIG WWID_LIST
DEFAULT_CONFIG="# device-mapper-multipath configuration file
@@ -38,8 +38,10 @@ defaults {
}"
CONFIGFILE="/etc/multipath.conf"
+OUTPUTFILE="/etc/multipath.conf"
MULTIPATHDIR="/etc/multipath"
TMPFILE="/etc/multipath/.multipath.conf.tmp"
+WWIDS=0
function usage
{
@@ -48,13 +50,60 @@ function usage
echo "Commands:"
echo "Enable: --enable "
echo "Disable: --disable"
+ echo "Only allow certain wwids (instead of enable): --allow <WWID>"
echo "Set user_friendly_names (Default y): --user_friendly_names <y|n>"
echo "Set find_multipaths (Default y): --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 "select output file (Default /etc/multipath.conf): --outfile <FILE>"
echo ""
}
+function get_dm_deps
+{
+ shift 3
+ while [ -n "$1" -a -n "$2" ]; do
+ MAJOR=$(echo $1 | tr -d '(,')
+ MINOR=$(echo $2 | tr -d ')')
+ UUID=`dmsetup info -c --noheadings -o uuid -j $MAJOR -m $MINOR 2> /dev/null`
+ if [ -n "$UUID" ] ; then
+ set_dm_wwid $UUID
+ fi
+ shift 2
+ done
+}
+
+function set_dm_wwid
+{
+ if [[ "$1" =~ ^part[[:digit:]]+-mpath- ]] ; then
+ WWID_LIST[$WWIDS]="${1##part*-mpath-}"
+ ((WWIDS++))
+ elif [[ "$1" =~ ^mpath- ]] ; then
+ WWID_LIST[$WWIDS]="${1##mpath-}"
+ ((WWIDS++))
+ else
+ get_dm_deps `dmsetup deps -u $1`
+ fi
+}
+
+function set_wwid
+{
+ UUID=""
+ if [[ "$1" =~ ^[[:digit:]]+:[[:digit:]]+$ ]] ; then
+ MAJOR=${1%%:*}
+ MINOR=${1##*:}
+ UUID=`dmsetup info -c --noheadings -o uuid -j $MAJOR -m $MINOR 2> /dev/null`
+ else
+ UUID=`dmsetup info -c --noheadings -o uuid $1 2> /dev/null`
+ fi
+ if [ -n "$UUID" ] ; then
+ set_dm_wwid $UUID
+ else
+ WWID_LIST[$WWIDS]="$1"
+ ((WWIDS++))
+ fi
+}
+
function parse_args
{
while [ -n "$1" ]; do
@@ -67,6 +116,16 @@ function parse_args
ENABLE=0
shift
;;
+ --allow)
+ ENABLE=2
+ if [ -n "$2" ]; then
+ set_wwid $2
+ shift 2
+ else
+ usage
+ exit 1
+ fi
+ ;;
--user_friendly_names)
if [ -n "$2" ]; then
FRIENDLY=$2
@@ -103,6 +162,16 @@ function parse_args
exit 1
fi
;;
+ --outfile)
+ if [ -n "$2" ]; then
+ OUTPUTFILE=$2
+ HAVE_OUTFILE=1
+ shift 2
+ else
+ usage
+ exit 1
+ fi
+ ;;
*)
usage
exit
@@ -137,6 +206,22 @@ function validate_args
echo "--with_multipathd must be either 'y' or 'n'"
exit 1
fi
+ if [ "$ENABLE" = 2 -a -z "$HAVE_OUTFILE" ]; then
+ echo "Because --allow makes changes that cannot be automatically reversed,"
+ echo "you must set --outfile when you set --allow"
+ exit 1
+ fi
+}
+
+function add_blacklist_exceptions
+{
+ echo "blacklist_exceptions {" >> $TMPFILE
+ INDEX=0
+ while [ "$INDEX" -lt "$WWIDS" ] ; do
+ echo " wwid \"${WWID_LIST[$INDEX]}\"" >> $TMPFILE
+ ((INDEX++))
+ done
+ echo "}" >> $TMPFILE
}
umask 0077
@@ -160,6 +245,10 @@ if grep -q "^blacklist[[:space:]]*{" $TM
HAVE_BLACKLIST=1
fi
+if grep -q "^blacklist_exceptions[[:space:]]*{" $TMPFILE ; then
+ HAVE_EXCEPTIONS=1
+fi
+
if grep -q "^defaults[[:space:]]*{" $TMPFILE ; then
HAVE_DEFAULTS=1
fi
@@ -183,11 +272,19 @@ 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
+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"" ; then
HAVE_DISABLE=0
fi
fi
+if [ "$HAVE_BLACKLIST" = "1" ]; then
+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*wwid \"\.\?\*\"" ; then
+ HAVE_WWID_DISABLE=1
+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"" ; then
+ HAVE_WWID_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
@@ -255,17 +352,33 @@ defaults {
_EOF_
fi
-if [ "$ENABLE" = 1 ]; then
+if [ "$ENABLE" = 2 ]; then
+ if [ "$HAVE_DISABLE" = 1 ]; then
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE
+ fi
+ if [ -z "$HAVE_WWID_DISABLE" ]; then
+ sed -i '/^blacklist[[:space:]]*{/ a\
+ wwid ".*"
+' $TMPFILE
+ elif [ "$HAVE_WWID_DISABLE" = 0 ]; then
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"/ wwid ".*"/' $TMPFILE
+ fi
+ if [ "$HAVE_EXCEPTIONS" = 1 ]; then
+ sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/d' $TMPFILE
+ fi
+ echo $HAVE_WWID_DISABLE
+ add_blacklist_exceptions
+elif [ "$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 "*"
+ devnode ".*"
' $TMPFILE
elif [ "$HAVE_DISABLE" = 0 ]; then
- sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[#[:space:]]*devnode \"\.\?\*\"/ devnode ".*"/' $TMPFILE
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"/ devnode ".*"/' $TMPFILE
fi
fi
@@ -303,17 +416,17 @@ elif [ "$FRIENDLY" = "y" ]; then
fi
fi
-if [ -f "$CONFIGFILE" ]; then
- cp $CONFIGFILE $CONFIGFILE.old
+if [ -f "$OUTPUTFILE" ]; then
+ cp $OUTPUTFILE $OUTPUTFILE.old
if [ $? != 0 ]; then
- echo "failed to backup old config file, $CONFIGFILE not updated"
+ echo "failed to backup old config file, $OUTPUTFILE not updated"
exit 1
fi
fi
-cp $TMPFILE $CONFIGFILE
+cp $TMPFILE $OUTPUTFILE
if [ $? != 0 ]; then
- echo "failed to copy new config file into place, check $CONFIGFILE is still OK"
+ echo "failed to copy new config file into place, check $OUTPUTFILE is still OK"
exit 1
fi

View File

@ -0,0 +1,17 @@
---
kpartx/sun.c | 2 --
1 file changed, 2 deletions(-)
Index: multipath-tools-130222/kpartx/sun.c
===================================================================
--- multipath-tools-130222.orig/kpartx/sun.c
+++ multipath-tools-130222/kpartx/sun.c
@@ -82,8 +82,6 @@ read_sun_pt(int fd, struct slice all, st
for(i=0, n=0; i<SUN_DISK_MAXPARTITIONS; i++) {
s = &l->partitions[i];
- if (s->num_sectors == 0)
- continue;
if (n < ns) {
sp[n].start = offset +
be32_to_cpu(s->start_cylinder) * be16_to_cpu(l->nsect) * be16_to_cpu(l->ntrks);

View File

@ -1,7 +1,7 @@
Summary: Tools to manage multipath devices using device-mapper
Name: device-mapper-multipath
Version: 0.4.9
Release: 76%{?dist}
Release: 77%{?dist}
License: GPL+
Group: System Environment/Base
URL: http://christophe.varoqui.free.fr/
@ -125,6 +125,18 @@ Patch0114: 0114-RHBZ-1196394-delayed-reintegration.patch
Patch0115: 0115-RHBZ-1198418-fix-double-free.patch
Patch0116: 0116-UPBZ-1188179-dell-36xxi.patch
Patch0117: 0117-RHBZ-1198424-autodetect-clariion-alua.patch
Patch0118: 0118-UPBZ-1200738-update-eternus-config.patch
Patch0119: 0119-RHBZ-1081397-save-alua-info.patch
Patch0120: 0120-RHBZ-1043093-realloc-fix.patch
Patch0121: 0121-RHBZ-1197234-rules-fix.patch
Patch0122: 0122-RHBZ-1212590-dont-use-var.patch
Patch0123: 0123-UPBZ-1166072-fix-path-offline.patch
Patch0124: 0124-RHBZ-1209275-retrigger-uevents.patch
Patch0125: 0125-RHBZ-1153832-kpartx-delete.patch
Patch0126: 0126-RHBZ-1211383-alias-collision.patch
Patch0127: 0127-RHBZ-1201030-use-blk-availability.patch
Patch0128: 0128-RHBZ-1222123-mpathconf-allow.patch
Patch0129: 0129-RHBZ-1241774-sun-partition-numbering.patch
# runtime
Requires: %{name}-libs = %{version}-%{release}
@ -295,6 +307,18 @@ kpartx manages partition creation and removal for device-mapper devices.
%patch0115 -p1
%patch0116 -p1
%patch0117 -p1
%patch0118 -p1
%patch0119 -p1
%patch0120 -p1
%patch0121 -p1
%patch0122 -p1
%patch0123 -p1
%patch0124 -p1
%patch0125 -p1
%patch0126 -p1
%patch0127 -p1
%patch0128 -p1
%patch0129 -p1
cp %{SOURCE1} .
%build
@ -402,6 +426,42 @@ bin/systemctl --no-reload enable multipathd.service >/dev/null 2>&1 ||:
%{_mandir}/man8/kpartx.8.gz
%changelog
* Fri Aug 7 2015 Benjamin Marzinski <bmarzins@redhat.com> 0.4.9-77
- Modify 0104-RHBZ-631009-deferred-remove.patch
* add man page info
- Refresh 0112-RHBZ-1194917-add-config_dir-option.patch
- Refresh 0114-RHBZ-1196394-delayed-reintegration.patch
- Add 0118-UPBZ-1200738-update-eternus-config.patch
* update default config
- Add 0119-RHBZ-1081397-save-alua-info.patch
* make prioritizers save information between calls to speed them up.
- Add 0120-RHBZ-1043093-realloc-fix.patch
* free old memory if realloc fails.
- Add 0121-RHBZ-1197234-rules-fix.patch
* make sure kpartx runs after an DM_ACTIVATION event occurs.
- Add 0122-RHBZ-1212590-dont-use-var.patch
* use /run instead of /var/run
- Add 0123-UPBZ-1166072-fix-path-offline.patch
* Don't mark quiesce and transport-offline paths as offline
- Add 0124-RHBZ-1209275-retrigger-uevents.patch
* Make multipathd retrigger uevents when paths haven't successfully had
their udev_attribute environment variable set by udev and add
"retrigger_ties" and "retrigger_delay" to control this
- Add 0125-RHBZ-1153832-kpartx-delete.patch
* Delete all partition devices with -d (not just the ones in the partition
table)
- Add 0126-RHBZ-1211383-alias-collision.patch
* make multipathd use the old alias, if rename failed and add
"new_bindings_in_boot" to determine if new bindings can be added to
the bindings file in the initramfs
- Add 0127-RHBZ-1201030-use-blk-availability.patch
* Make multipath use blk-availability.service
- Add 0128-RHBZ-1222123-mpathconf-allow.patch
* Add mpathconf --allow for creating specialized config files.
- Add 0129-RHBZ-1241774-sun-partition-numbering.patch
* Make kpartx correctly number sun partitions.
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.9-76
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild