device-mapper-multipath-0.4.9-60

Add 0067-RHBZ-1022899-fix-udev-partition-handling.patch
  * Make sure to wipe partition devices on change event if they weren't
    wiped on the device add event
Add 0068-RHBZ-1034578-label-partition-devices.patch
  * Make sure that partition devices are labeled like the whole device
Add 0069-UPBZ-1033791-improve-rdac-checker.patch
  *  Use RTPG data in RDAC checker
Add 0070-RHBZ-1036503-blacklist-td-devs.patch
Add 0071-RHBZ-1031546-strip-dev.patch
  * make multipathd interactive commands able to handle /dev/<devnode>
    instead of just <devnode>
This commit is contained in:
Benjamin Marzinski 2013-12-09 09:25:47 -06:00
parent f8d0aa6f9c
commit f5f1bbe03e
6 changed files with 497 additions and 1 deletions

View File

@ -0,0 +1,37 @@
---
multipath/multipath.rules | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
Index: multipath-tools-130222/multipath/multipath.rules
===================================================================
--- multipath-tools-130222.orig/multipath/multipath.rules
+++ multipath-tools-130222/multipath/multipath.rules
@@ -13,12 +13,13 @@ ACTION=="add", ENV{DM_MULTIPATH_DEVICE_P
PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \
ENV{DM_MULTIPATH_DEVICE_PATH}="1", ENV{ID_FS_TYPE}="mpath_member"
-ENV{DM_MULTIPATH_DEVICE_PATH}=="1", \
+ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DM_MULTIPATH_WIPE_PARTS}="1", \
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
ACTION!="change", GOTO="update_timestamp"
IMPORT{db}="DM_MULTIPATH_TIMESTAMP"
IMPORT{db}="DM_MULTIPATH_DEVICE_PATH"
+IMPORT{db}="DM_MULTIPATH_WIPE_PARTS"
# 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}", \
@@ -27,8 +28,13 @@ PROGRAM=="$env{MPATH_SBIN_PATH}/multipat
# If the device isn't part of a multipath device, clear this
ENV{DM_MULTIPATH_DEVICE_PATH}=""
+ENV{DM_MULTIPATH_WIPE_PARTS}=""
LABEL="update_timestamp"
+ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DM_MULTIPATH_WIPE_PARTS}!="1", \
+ ENV{DM_MULTIPATH_WIPE_PARTS}="1", \
+ RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
+
IMPORT{file}="/run/multipathd/timestamp"
LABEL="check_kpartx"

View File

@ -0,0 +1,18 @@
---
multipath/multipath.rules | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: multipath-tools-130222/multipath/multipath.rules
===================================================================
--- multipath-tools-130222.orig/multipath/multipath.rules
+++ multipath-tools-130222/multipath/multipath.rules
@@ -4,7 +4,8 @@ SUBSYSTEM!="block", GOTO="end_mpath"
IMPORT{cmdline}="nompath"
ENV{nompath}=="?*", GOTO="end_mpath"
-ENV{DEVTYPE}=="partition", GOTO="end_mpath"
+ENV{DEVTYPE}=="partition", IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH", \
+ GOTO="end_mpath"
ENV{MPATH_SBIN_PATH}="/sbin"
TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
TEST!="/etc/multipath.conf", GOTO="check_kpartx"

View File

@ -0,0 +1,153 @@
---
libmultipath/checkers/rdac.c | 91 ++++++++++++++++++++++++++++++++++++++-----
libmultipath/discovery.c | 2
2 files changed, 81 insertions(+), 12 deletions(-)
Index: multipath-tools-130222/libmultipath/checkers/rdac.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/checkers/rdac.c
+++ multipath-tools-130222/libmultipath/checkers/rdac.c
@@ -34,6 +34,18 @@
#define MSG_RDAC_UP "rdac checker reports path is up"
#define MSG_RDAC_DOWN "rdac checker reports path is down"
#define MSG_RDAC_GHOST "rdac checker reports path is ghost"
+#define MSG_RDAC_DOWN_TYPE(STR) MSG_RDAC_DOWN": "STR
+
+#define RTPG_UNAVAILABLE 0x3
+#define RTPG_OFFLINE 0xE
+#define RTPG_TRANSITIONING 0xF
+
+#define RTPG_UNAVAIL_NON_RESPONSIVE 0x2
+#define RTPG_UNAVAIL_IN_RESET 0x3
+#define RTPG_UNAVAIL_CFW_DL1 0x4
+#define RTPG_UNAVAIL_CFW_DL2 0x5
+#define RTPG_UNAVAIL_QUIESCED 0x6
+#define RTPG_UNAVAIL_SERVICE_MODE 0x7
struct control_mode_page {
unsigned char header[8];
@@ -199,22 +211,64 @@ struct volume_access_inq
char PQ_PDT;
char dontcare0[7];
char avtcvp;
- char dontcare1;
- char asym_access_state_cur;
+ char vol_ppp;
+ char aas_cur;
char vendor_specific_cur;
- char dontcare2[36];
+ char aas_alt;
+ char vendor_specific_alt;
+ char dontcare1[34];
};
+const char
+*checker_msg_string(struct volume_access_inq *inq)
+{
+ /* lun not connected */
+ if (((inq->PQ_PDT & 0xE0) == 0x20) || (inq->PQ_PDT & 0x7f))
+ return MSG_RDAC_DOWN_TYPE("lun not connected");
+
+ /* if no tpg data is available, give the generic path down message */
+ if (!(inq->avtcvp & 0x10))
+ return MSG_RDAC_DOWN;
+
+ /* controller is booting up */
+ if (((inq->aas_cur & 0x0F) == RTPG_TRANSITIONING) &&
+ (inq->aas_alt & 0x0F) != RTPG_TRANSITIONING)
+ return MSG_RDAC_DOWN_TYPE("ctlr is in startup sequence");
+
+ /* if not unavailable, give generic message */
+ if ((inq->aas_cur & 0x0F) != RTPG_UNAVAILABLE)
+ return MSG_RDAC_DOWN;
+
+ /* target port group unavailable */
+ switch (inq->vendor_specific_cur) {
+ case RTPG_UNAVAIL_NON_RESPONSIVE:
+ return MSG_RDAC_DOWN_TYPE("non-responsive to queries");
+ case RTPG_UNAVAIL_IN_RESET:
+ return MSG_RDAC_DOWN_TYPE("ctlr held in reset");
+ case RTPG_UNAVAIL_CFW_DL1:
+ case RTPG_UNAVAIL_CFW_DL2:
+ return MSG_RDAC_DOWN_TYPE("ctlr firmware downloading");
+ case RTPG_UNAVAIL_QUIESCED:
+ return MSG_RDAC_DOWN_TYPE("ctlr quiesced by admin request");
+ case RTPG_UNAVAIL_SERVICE_MODE:
+ return MSG_RDAC_DOWN_TYPE("ctlr is in service mode");
+ default:
+ return MSG_RDAC_DOWN_TYPE("ctlr is unavailable");
+ }
+}
+
extern int
libcheck_check (struct checker * c)
{
struct volume_access_inq inq;
- int ret;
+ int ret, inqfail;
+ inqfail = 0;
memset(&inq, 0, sizeof(struct volume_access_inq));
if (0 != do_inq(c->fd, 0xC9, &inq, sizeof(struct volume_access_inq),
c->timeout)) {
ret = PATH_DOWN;
+ inqfail = 1;
goto done;
} else if (((inq.PQ_PDT & 0xE0) == 0x20) || (inq.PQ_PDT & 0x7f)) {
/* LUN not connected*/
@@ -222,11 +276,27 @@ libcheck_check (struct checker * c)
goto done;
}
- /* check if controller is reporting asymmetric access state of unavailable */
- if ((inq.avtcvp & 0x10) &&
- ((inq.asym_access_state_cur & 0x0F) == 0x3)) {
- ret = PATH_DOWN;
- goto done;
+ /* If TPGDE bit set, evaluate TPG information */
+ if ((inq.avtcvp & 0x10)) {
+ switch (inq.aas_cur & 0x0F) {
+ /* Never use the path if it reports unavailable */
+ case RTPG_UNAVAILABLE:
+ ret = PATH_DOWN;
+ goto done;
+ /*
+ * If both controllers report transitioning, it
+ * means mode select or STPG is being processed.
+ *
+ * If this controller alone is transitioning, it's
+ * booting and we shouldn't use it yet.
+ */
+ case RTPG_TRANSITIONING:
+ if ((inq.aas_alt & 0xF) != RTPG_TRANSITIONING) {
+ ret = PATH_DOWN;
+ goto done;
+ }
+ break;
+ }
}
/* If owner set or ioship mode is enabled return PATH_UP always */
@@ -238,7 +308,8 @@ libcheck_check (struct checker * c)
done:
switch (ret) {
case PATH_DOWN:
- MSG(c, MSG_RDAC_DOWN);
+ MSG(c, (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") :
+ checker_msg_string(&inq));
break;
case PATH_UP:
MSG(c, MSG_RDAC_UP);
Index: multipath-tools-130222/libmultipath/discovery.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/discovery.c
+++ multipath-tools-130222/libmultipath/discovery.c
@@ -1116,8 +1116,6 @@ pathinfo (struct path *pp, vector hwtabl
if (!strlen(pp->wwid))
get_uid(pp);
get_prio(pp);
- } else {
- pp->priority = PRIO_UNDEF;
}
}

View File

@ -0,0 +1,17 @@
---
libmultipath/blacklist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: multipath-tools-130222/libmultipath/blacklist.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/blacklist.c
+++ multipath-tools-130222/libmultipath/blacklist.c
@@ -163,7 +163,7 @@ setup_default_blist (struct config * con
if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
return 1;
- str = STRDUP("^hd[a-z]");
+ str = STRDUP("^(td|hd)[a-z]");
if (!str)
return 1;
if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))

View File

@ -0,0 +1,248 @@
---
libmultipath/util.c | 22 ++++++++++++++++++++++
libmultipath/util.h | 1 +
multipath/main.c | 23 +----------------------
multipathd/cli_handlers.c | 18 ++++++++++++++++++
4 files changed, 42 insertions(+), 22 deletions(-)
Index: multipath-tools-130222/libmultipath/util.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/util.c
+++ multipath-tools-130222/libmultipath/util.c
@@ -236,6 +236,28 @@ skip_proc:
return 0;
}
+/* This function returns a pointer inside of the supplied pathname string.
+ * If is_path_device is true, it may also modify the supplied string */
+char *convert_dev(char *name, int is_path_device)
+{
+ char *ptr;
+
+ if (!name)
+ return NULL;
+ if (is_path_device) {
+ ptr = strstr(name, "cciss/");
+ if (ptr) {
+ ptr += 5;
+ *ptr = '!';
+ }
+ }
+ if (!strncmp(name, "/dev/", 5) && strlen(name) > 5)
+ ptr = name + 5;
+ else
+ ptr = name;
+ return ptr;
+}
+
dev_t parse_devt(const char *dev_t)
{
int maj, min;
Index: multipath-tools-130222/libmultipath/util.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/util.h
+++ multipath-tools-130222/libmultipath/util.h
@@ -10,6 +10,7 @@ size_t strlcat(char *dst, const char *sr
void remove_trailing_chars(char *path, char c);
int devt2devname (char *, int, char *);
dev_t parse_devt(const char *dev_t);
+char *convert_dev(char *dev, int is_path_device);
#define safe_sprintf(var, format, args...) \
snprintf(var, sizeof(var), format, ##args) >= sizeof(var)
Index: multipath-tools-130222/multipath/main.c
===================================================================
--- multipath-tools-130222.orig/multipath/main.c
+++ multipath-tools-130222/multipath/main.c
@@ -254,16 +254,7 @@ configure (void)
vecs.pathvec = pathvec;
vecs.mpvec = curmp;
- /*
- * dev is "/dev/" . "sysfs block dev"
- */
- if (conf->dev) {
- if (!strncmp(conf->dev, "/dev/", 5) &&
- strlen(conf->dev) > 5)
- dev = conf->dev + 5;
- else
- dev = conf->dev;
- }
+ dev = convert_dev(conf->dev, (conf->dev_type == DEV_DEVNODE));
/*
* if we have a blacklisted device parameter, exit early
@@ -427,16 +418,6 @@ 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[])
{
@@ -577,8 +558,6 @@ 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;
Index: multipath-tools-130222/multipathd/cli_handlers.c
===================================================================
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
+++ multipath-tools-130222/multipathd/cli_handlers.c
@@ -235,6 +235,7 @@ cli_list_map_topology (void * v, char **
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, MAP);
+ param = convert_dev(param, 0);
get_path_layout(vecs->pathvec, 0);
mpp = find_mp_by_str(vecs->mpvec, param);
@@ -416,6 +417,7 @@ cli_add_path (void * v, char ** reply, i
struct path *pp;
int r;
+ param = convert_dev(param, 1);
condlog(2, "%s: add path (operator)", param);
if (filter_devnode(conf->blist_devnode, conf->elist_devnode,
@@ -459,6 +461,7 @@ cli_del_path (void * v, char ** reply, i
char * param = get_keyparam(v, PATH);
struct path *pp;
+ param = convert_dev(param, 1);
condlog(2, "%s: remove path (operator)", param);
pp = find_path_by_dev(vecs->pathvec, param);
if (!pp) {
@@ -478,6 +481,7 @@ cli_add_map (void * v, char ** reply, in
char *alias;
int rc;
+ param = convert_dev(param, 0);
condlog(2, "%s: add map (operator)", param);
if (filter_wwid(conf->blist_wwid, conf->elist_wwid, param) > 0) {
@@ -518,6 +522,7 @@ cli_del_map (void * v, char ** reply, in
char *alias;
int rc;
+ param = convert_dev(param, 0);
condlog(2, "%s: remove map (operator)", param);
minor = dm_get_minor(param);
if (minor < 0) {
@@ -549,6 +554,7 @@ cli_reload(void *v, char **reply, int *l
struct multipath *mpp;
int minor;
+ mapname = convert_dev(mapname, 0);
condlog(2, "%s: reload map (operator)", mapname);
if (sscanf(mapname, "dm-%d", &minor) == 1)
mpp = find_mp_by_minor(vecs->mpvec, minor);
@@ -591,6 +597,7 @@ cli_resize(void *v, char **reply, int *l
struct pathgroup *pgp;
struct path *pp;
+ mapname = convert_dev(mapname, 0);
condlog(2, "%s: resize map (operator)", mapname);
if (sscanf(mapname, "dm-%d", &minor) == 1)
mpp = find_mp_by_minor(vecs->mpvec, minor);
@@ -665,6 +672,7 @@ cli_restore_queueing(void *v, char **rep
struct multipath *mpp;
int minor;
+ mapname = convert_dev(mapname, 0);
condlog(2, "%s: restore map queueing (operator)", mapname);
if (sscanf(mapname, "dm-%d", &minor) == 1)
mpp = find_mp_by_minor(vecs->mpvec, minor);
@@ -716,6 +724,7 @@ cli_disable_queueing(void *v, char **rep
struct multipath *mpp;
int minor;
+ mapname = convert_dev(mapname, 0);
condlog(2, "%s: disable map queueing (operator)", mapname);
if (sscanf(mapname, "dm-%d", &minor) == 1)
mpp = find_mp_by_minor(vecs->mpvec, minor);
@@ -753,6 +762,7 @@ cli_switch_group(void * v, char ** reply
char * mapname = get_keyparam(v, MAP);
int groupnum = atoi(get_keyparam(v, GROUP));
+ mapname = convert_dev(mapname, 0);
condlog(2, "%s: switch to path group #%i (operator)", mapname, groupnum);
return dm_switchgroup(mapname, groupnum);
@@ -775,6 +785,7 @@ cli_suspend(void * v, char ** reply, int
char * param = get_keyparam(v, MAP);
int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param);
+ param = convert_dev(param, 0);
condlog(2, "%s: suspend (operator)", param);
if (!r) /* error */
@@ -796,6 +807,7 @@ cli_resume(void * v, char ** reply, int
char * param = get_keyparam(v, MAP);
int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param);
+ param = convert_dev(param, 0);
condlog(2, "%s: resume (operator)", param);
if (!r) /* error */
@@ -817,6 +829,7 @@ cli_reinstate(void * v, char ** reply, i
char * param = get_keyparam(v, PATH);
struct path * pp;
+ param = convert_dev(param, 1);
pp = find_path_by_dev(vecs->pathvec, param);
if (!pp)
@@ -837,6 +850,7 @@ cli_reassign (void * v, char ** reply, i
{
char * param = get_keyparam(v, MAP);
+ param = convert_dev(param, 0);
condlog(3, "%s: reset devices (operator)", param);
dm_reassign(param);
@@ -851,6 +865,7 @@ cli_fail(void * v, char ** reply, int *
struct path * pp;
int r;
+ param = convert_dev(param, 1);
pp = find_path_by_dev(vecs->pathvec, param);
if (!pp)
@@ -962,6 +977,7 @@ cli_getprstatus (void * v, char ** reply
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, MAP);
+ param = convert_dev(param, 0);
get_path_layout(vecs->pathvec, 0);
mpp = find_mp_by_str(vecs->mpvec, param);
@@ -991,6 +1007,7 @@ cli_setprstatus(void * v, char ** reply,
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, MAP);
+ param = convert_dev(param, 0);
get_path_layout(vecs->pathvec, 0);
mpp = find_mp_by_str(vecs->mpvec, param);
@@ -1013,6 +1030,7 @@ cli_unsetprstatus(void * v, char ** repl
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, MAP);
+ param = convert_dev(param, 0);
get_path_layout(vecs->pathvec, 0);
mpp = find_mp_by_str(vecs->mpvec, param);

View File

@ -1,7 +1,7 @@
Summary: Tools to manage multipath devices using device-mapper
Name: device-mapper-multipath
Version: 0.4.9
Release: 59%{?dist}
Release: 60%{?dist}
License: GPL+
Group: System Environment/Base
URL: http://christophe.varoqui.free.fr/
@ -74,6 +74,11 @@ Patch0063: 0063-RH-fix-warning.patch
Patch0064: 0064-fix-ID_FS-attrs.patch
Patch0065: 0065-UPBZ-995538-fail-rdac-on-unavailable.patch
Patch0066: 0066-UP-dos-4k-partition-fix.patch
Patch0067: 0067-RHBZ-1022899-fix-udev-partition-handling.patch
Patch0068: 0068-RHBZ-1034578-label-partition-devices.patch
Patch0069: 0069-UPBZ-1033791-improve-rdac-checker.patch
Patch0070: 0070-RHBZ-1036503-blacklist-td-devs.patch
Patch0071: 0071-RHBZ-1031546-strip-dev.patch
# runtime
Requires: %{name}-libs = %{version}-%{release}
@ -192,6 +197,11 @@ kpartx manages partition creation and removal for device-mapper devices.
%patch0064 -p1
%patch0065 -p1
%patch0066 -p1
%patch0067 -p1
%patch0068 -p1
%patch0069 -p1
%patch0070 -p1
%patch0071 -p1
cp %{SOURCE1} .
%build
@ -285,6 +295,19 @@ bin/systemctl --no-reload enable multipathd.service >/dev/null 2>&1 ||:
%{_mandir}/man8/kpartx.8.gz
%changelog
* Mon Dec 9 2013 Benjamin Marzinski <bmarzins@redhat.com> 0.4.9-60
- Add 0067-RHBZ-1022899-fix-udev-partition-handling.patch
* Make sure to wipe partition devices on change event if they weren't
wiped on the device add event
- Add 0068-RHBZ-1034578-label-partition-devices.patch
* Make sure that partition devices are labeled like the whole device
- Add 0069-UPBZ-1033791-improve-rdac-checker.patch
* Use RTPG data in RDAC checker
- Add 0070-RHBZ-1036503-blacklist-td-devs.patch
- Add 0071-RHBZ-1031546-strip-dev.patch
* make multipathd interactive commands able to handle /dev/<devnode>
instead of just <devnode>
* Sat Oct 12 2013 Benjamin Marzinski <bmarzins@redhat.com> 0.4.9-59
- Add 0066-UP-dos-4k-partition-fix.patch
* Make kpartx correctly handle 4K sector size devices with dos partitions.