diff --git a/SOURCES/0067-RHBZ-1022899-fix-udev-partition-handling.patch b/SOURCES/0067-RHBZ-1022899-fix-udev-partition-handling.patch new file mode 100644 index 0000000..6f0a3d8 --- /dev/null +++ b/SOURCES/0067-RHBZ-1022899-fix-udev-partition-handling.patch @@ -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" diff --git a/SOURCES/0068-RHBZ-1034578-label-partition-devices.patch b/SOURCES/0068-RHBZ-1034578-label-partition-devices.patch new file mode 100644 index 0000000..e8008f7 --- /dev/null +++ b/SOURCES/0068-RHBZ-1034578-label-partition-devices.patch @@ -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" diff --git a/SOURCES/0069-UPBZ-1033791-improve-rdac-checker.patch b/SOURCES/0069-UPBZ-1033791-improve-rdac-checker.patch new file mode 100644 index 0000000..c838f29 --- /dev/null +++ b/SOURCES/0069-UPBZ-1033791-improve-rdac-checker.patch @@ -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; + } + } + diff --git a/SOURCES/0070-RHBZ-1036503-blacklist-td-devs.patch b/SOURCES/0070-RHBZ-1036503-blacklist-td-devs.patch new file mode 100644 index 0000000..ffcae46 --- /dev/null +++ b/SOURCES/0070-RHBZ-1036503-blacklist-td-devs.patch @@ -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)) diff --git a/SOURCES/0071-RHBZ-1031546-strip-dev.patch b/SOURCES/0071-RHBZ-1031546-strip-dev.patch new file mode 100644 index 0000000..64118c2 --- /dev/null +++ b/SOURCES/0071-RHBZ-1031546-strip-dev.patch @@ -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); + diff --git a/SOURCES/0072-RHBZ-1039199-check-loop-control.patch b/SOURCES/0072-RHBZ-1039199-check-loop-control.patch new file mode 100644 index 0000000..21bd0c3 --- /dev/null +++ b/SOURCES/0072-RHBZ-1039199-check-loop-control.patch @@ -0,0 +1,46 @@ +--- + kpartx/lopart.c | 18 ++++++++++++++++-- + 1 file changed, 16 insertions(+), 2 deletions(-) + +Index: multipath-tools-130222/kpartx/lopart.c +=================================================================== +--- multipath-tools-130222.orig/kpartx/lopart.c ++++ multipath-tools-130222/kpartx/lopart.c +@@ -32,6 +32,10 @@ + #include "lopart.h" + #include "xstrncpy.h" + ++#ifndef LOOP_CTL_GET_FREE ++#define LOOP_CTL_GET_FREE 0x4C82 ++#endif ++ + #if !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) \ + && !defined (__s390x__) + #define int2ptr(x) ((void *) ((int) x)) +@@ -140,14 +144,24 @@ find_unused_loop_device (void) + + char dev[20]; + char *loop_formats[] = { "/dev/loop%d", "/dev/loop/%d" }; +- int i, j, fd, somedev = 0, someloop = 0, loop_known = 0; ++ int i, j, fd, first = 0, somedev = 0, someloop = 0, loop_known = 0; + struct stat statbuf; + struct loop_info loopinfo; + FILE *procdev; + ++ if (stat("/dev/loop-control", &statbuf) == 0 && ++ S_ISCHR(statbuf.st_mode)) { ++ fd = open("/dev/loop-control", O_RDWR); ++ if (fd >= 0) { ++ first = ioctl(fd, LOOP_CTL_GET_FREE); ++ close(fd); ++ } ++ if (first < 0) ++ first = 0; ++ } + for (j = 0; j < SIZE(loop_formats); j++) { + +- for(i = 0; i < 256; i++) { ++ for(i = first; i < 256; i++) { + sprintf(dev, loop_formats[j], i); + + if (stat (dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) { diff --git a/SOURCES/0073-RH-update-build-flags.patch b/SOURCES/0073-RH-update-build-flags.patch new file mode 100644 index 0000000..3ab72d0 --- /dev/null +++ b/SOURCES/0073-RH-update-build-flags.patch @@ -0,0 +1,33 @@ +--- + Makefile.inc | 2 +- + libmultipath/checkers/rdac.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +Index: multipath-tools-130222/Makefile.inc +=================================================================== +--- multipath-tools-130222.orig/Makefile.inc ++++ multipath-tools-130222/Makefile.inc +@@ -39,7 +39,7 @@ GZIP = /bin/gzip -9 -c + INSTALL_PROGRAM = install + + ifndef RPM_OPT_FLAGS +- RPM_OPT_FLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 ++ RPM_OPT_FLAGS = -O2 -g -pipe -Wformat-security -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 + endif + + LDFLAGS += -Wl,-z,relro +Index: multipath-tools-130222/libmultipath/checkers/rdac.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers/rdac.c ++++ multipath-tools-130222/libmultipath/checkers/rdac.c +@@ -308,8 +308,8 @@ libcheck_check (struct checker * c) + done: + switch (ret) { + case PATH_DOWN: +- MSG(c, (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") : +- checker_msg_string(&inq)); ++ MSG(c, "%s", (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") : ++ checker_msg_string(&inq)); + break; + case PATH_UP: + MSG(c, MSG_RDAC_UP); diff --git a/SOURCES/0074-RHBZ-1056976-dm-mpath-rules.patch b/SOURCES/0074-RHBZ-1056976-dm-mpath-rules.patch new file mode 100644 index 0000000..9f6c880 --- /dev/null +++ b/SOURCES/0074-RHBZ-1056976-dm-mpath-rules.patch @@ -0,0 +1,64 @@ +--- + multipath/11-dm-mpath.rules | 34 ++++++++++++++++++++++++++++++++++ + multipath/Makefile | 2 ++ + 2 files changed, 36 insertions(+) + +Index: multipath-tools-130222/multipath/11-dm-mpath.rules +=================================================================== +--- /dev/null ++++ multipath-tools-130222/multipath/11-dm-mpath.rules +@@ -0,0 +1,34 @@ ++ACTION!="add|change", GOTO="mpath_end" ++ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="mpath_end" ++ENV{DM_UUID}!="mpath-?*", GOTO="mpath_end" ++ ++# Do not initiate scanning if no path is available, ++# otherwise there would be a hang or IO error on access. ++# We'd like to avoid this, especially within udev processing. ++ENV{DM_NR_VALID_PATHS}!="?*", IMPORT{db}="DM_NR_VALID_PATHS" ++ENV{DM_NR_VALID_PATHS}=="0", ENV{DM_NOSCAN}="1" ++ ++# Also skip all foreign rules if no path is available. ++# Remember the original value of DM_DISABLE_OTHER_RULES_FLAG ++# and restore it back once we have at least one path available. ++IMPORT{db}="DM_DISABLE_OTHER_RULES_FLAG_OLD" ++ENV{DM_ACTION}=="PATH_FAILED",\ ++ ENV{DM_NR_VALID_PATHS}=="0",\ ++ ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}=="",\ ++ ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}",\ ++ ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1" ++ENV{DM_ACTION}=="PATH_REINSTATED",\ ++ ENV{DM_NR_VALID_PATHS}=="1",\ ++ ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="$env{DM_DISABLE_OTHER_RULES_FLAG_OLD}",\ ++ ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="",\ ++ ENV{DM_ACTIVATION}="1" ++ ++# DM_SUBSYSTEM_UDEV_FLAG0 is the "RELOAD" flag for multipath subsystem. ++# Drop the DM_ACTIVATION flag here as mpath reloads tables if any of its ++# paths are lost/recovered. For any stack above the mpath device, this is not ++# something that should be reacted upon since it would be useless extra work. ++# It's exactly mpath's job to provide *seamless* device access to any of the ++# paths that are available underneath. ++ENV{DM_SUBSYSTEM_UDEV_FLAG0}=="1", ENV{DM_ACTIVATION}="0" ++ ++LABEL="mpath_end" +Index: multipath-tools-130222/multipath/Makefile +=================================================================== +--- multipath-tools-130222.orig/multipath/Makefile ++++ multipath-tools-130222/multipath/Makefile +@@ -25,6 +25,7 @@ install: + $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) -d $(DESTDIR)/usr/lib/udev/rules.d + $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules ++ $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)/usr/lib/udev/rules.d/11-dm-mpath.rules + $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) +@@ -33,6 +34,7 @@ install: + + uninstall: + rm $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules ++ rm $(DESTDIR)/usr/lib/udev/rules.d/11-dm-mpath.rules + rm $(DESTDIR)$(bindir)/$(EXEC) + rm $(DESTDIR)$(bindir)/mpathconf + rm $(DESTDIR)$(mandir)/$(EXEC).8.gz diff --git a/SOURCES/0075-RHBZ-1056976-reload-flag.patch b/SOURCES/0075-RHBZ-1056976-reload-flag.patch new file mode 100644 index 0000000..ee2cdee --- /dev/null +++ b/SOURCES/0075-RHBZ-1056976-reload-flag.patch @@ -0,0 +1,246 @@ +--- + kpartx/devmapper.c | 4 ++-- + kpartx/devmapper.h | 8 +++++++- + kpartx/kpartx.c | 6 +++--- + libmultipath/configure.c | 4 ++-- + libmultipath/devmapper.c | 26 ++++++++++++++------------ + libmultipath/devmapper.h | 10 ++++++++-- + multipathd/cli_handlers.c | 4 ++-- + 7 files changed, 38 insertions(+), 24 deletions(-) + +Index: multipath-tools-130222/kpartx/devmapper.c +=================================================================== +--- multipath-tools-130222.orig/kpartx/devmapper.c ++++ multipath-tools-130222/kpartx/devmapper.c +@@ -60,7 +60,7 @@ dm_prereq (char * str, int x, int y, int + } + + extern int +-dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie) { ++dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie, uint16_t udev_flags) { + int r = 0; + int udev_wait_flag = (task == DM_DEVICE_RESUME || + task == DM_DEVICE_REMOVE); +@@ -78,7 +78,7 @@ 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, (udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK)) ++ if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, ((udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK) | udev_flags)) + goto out; + r = dm_task_run(dmt); + +Index: multipath-tools-130222/kpartx/devmapper.h +=================================================================== +--- multipath-tools-130222.orig/kpartx/devmapper.h ++++ multipath-tools-130222/kpartx/devmapper.h +@@ -2,10 +2,16 @@ + #define MINOR(dev) ((dev & 0xff) | ((dev >> 12) & 0xfff00)) + #define MKDEV(ma,mi) ((mi & 0xff) | (ma << 8) | ((mi & ~0xff) << 12)) + ++#ifdef DM_SUBSYSTEM_UDEV_FLAG0 ++#define MPATH_UDEV_RELOAD_FLAG DM_SUBSYSTEM_UDEV_FLAG0 ++#else ++#define MPATH_UDEV_RELOAD_FLAG 0 ++#endif ++ + extern int udev_sync; + + int dm_prereq (char *, int, int, int); +-int dm_simplecmd (int, const char *, int, uint32_t *); ++int dm_simplecmd (int, const char *, int, uint32_t *, uint16_t); + int dm_addmap (int, const char *, const char *, const char *, uint64_t, + int, const char *, int, mode_t, uid_t, gid_t, uint32_t *); + int dm_map_present (char *); +Index: multipath-tools-130222/kpartx/kpartx.c +=================================================================== +--- multipath-tools-130222.orig/kpartx/kpartx.c ++++ multipath-tools-130222/kpartx/kpartx.c +@@ -421,7 +421,7 @@ main(int argc, char **argv){ + continue; + + if (!dm_simplecmd(DM_DEVICE_REMOVE, partname, +- 0, &cookie)) { ++ 0, &cookie, 0)) { + r++; + continue; + } +@@ -473,7 +473,7 @@ main(int argc, char **argv){ + } + if (op == DM_DEVICE_RELOAD && + !dm_simplecmd(DM_DEVICE_RESUME, partname, +- 1, &cookie)) { ++ 1, &cookie, MPATH_UDEV_RELOAD_FLAG)) { + fprintf(stderr, "resume failed on %s\n", + partname); + r++; +@@ -505,7 +505,7 @@ main(int argc, char **argv){ + continue; + + if (!dm_simplecmd(DM_DEVICE_REMOVE, +- partname, 1, &cookie)) { ++ partname, 1, &cookie, 0)) { + r++; + continue; + } +Index: multipath-tools-130222/libmultipath/configure.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/configure.c ++++ multipath-tools-130222/libmultipath/configure.c +@@ -390,13 +390,13 @@ domap (struct multipath * mpp, char * pa + case ACT_RELOAD: + r = dm_addmap_reload(mpp, params); + if (r) +- r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias); ++ r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, MPATH_UDEV_RELOAD_FLAG); + break; + + case ACT_RESIZE: + r = dm_addmap_reload(mpp, params); + if (r) +- r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1); ++ r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1, 0); + break; + + case ACT_RENAME: +Index: multipath-tools-130222/libmultipath/devmapper.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/devmapper.c ++++ multipath-tools-130222/libmultipath/devmapper.c +@@ -103,7 +103,9 @@ dm_lib_prereq (void) + { + char version[64]; + int v[3]; +-#ifdef LIBDM_API_COOKIE ++#if defined(DM_SUBSYSTEM_UDEV_FLAG0) ++ int minv[3] = {1, 2, 82}; ++#elif defined(LIBDM_API_COOKIE) + int minv[3] = {1, 2, 38}; + #else + int minv[3] = {1, 2, 8}; +@@ -200,7 +202,7 @@ dm_prereq (void) + } + + static int +-dm_simplecmd (int task, const char *name, int no_flush, int need_sync) { ++dm_simplecmd (int task, const char *name, int no_flush, int need_sync, uint16_t udev_flags) { + int r = 0; + int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME || + task == DM_DEVICE_REMOVE)); +@@ -219,7 +221,7 @@ 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, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0)) ++ if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags)) + goto out; + r = dm_task_run (dmt); + +@@ -229,13 +231,13 @@ dm_simplecmd (int task, const char *name + } + + extern int +-dm_simplecmd_flush (int task, const char *name, int needsync) { +- return dm_simplecmd(task, name, 0, needsync); ++dm_simplecmd_flush (int task, const char *name, int needsync, uint16_t udev_flags) { ++ return dm_simplecmd(task, name, 0, needsync, udev_flags); + } + + extern int +-dm_simplecmd_noflush (int task, const char *name) { +- return dm_simplecmd(task, name, 1, 1); ++dm_simplecmd_noflush (int task, const char *name, uint16_t udev_flags) { ++ return dm_simplecmd(task, name, 1, 1, udev_flags); + } + + extern int +@@ -670,7 +672,7 @@ _dm_flush_map (const char * mapname, int + return 1; + } + +- r = dm_simplecmd_flush(DM_DEVICE_REMOVE, mapname, need_sync); ++ r = dm_simplecmd_flush(DM_DEVICE_REMOVE, mapname, need_sync, 0); + + if (r) { + condlog(4, "multipath map %s removed", mapname); +@@ -703,14 +705,14 @@ dm_suspend_and_flush_map (const char * m + if (s) + queue_if_no_path = 0; + else +- s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0); ++ s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0, 0); + + if (!dm_flush_map(mapname)) { + condlog(4, "multipath map %s removed", mapname); + return 0; + } + condlog(2, "failed to remove multipath map %s", mapname); +- dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname); ++ dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname, 0); + if (queue_if_no_path) + s = dm_queue_if_no_path((char *)mapname, 1); + return 1; +@@ -1077,7 +1079,7 @@ dm_remove_partmaps (const char * mapname + condlog(4, "partition map %s removed", + names->name); + dm_simplecmd_flush(DM_DEVICE_REMOVE, names->name, +- need_sync); ++ need_sync, 0); + } + + next = names->next; +@@ -1305,7 +1307,7 @@ int dm_reassign_table(const char *name, + condlog(3, "%s: failed to reassign targets", name); + goto out_reload; + } +- dm_simplecmd_noflush(DM_DEVICE_RESUME, name); ++ dm_simplecmd_noflush(DM_DEVICE_RESUME, name, MPATH_UDEV_RELOAD_FLAG); + } + r = 1; + +Index: multipath-tools-130222/libmultipath/devmapper.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/devmapper.h ++++ multipath-tools-130222/libmultipath/devmapper.h +@@ -6,11 +6,17 @@ + #define TGT_MPATH "multipath" + #define TGT_PART "linear" + ++#ifdef DM_SUBSYSTEM_UDEV_FLAG0 ++#define MPATH_UDEV_RELOAD_FLAG DM_SUBSYSTEM_UDEV_FLAG0 ++#else ++#define MPATH_UDEV_RELOAD_FLAG 0 ++#endif ++ + void dm_init(void); + int dm_prereq (void); + int dm_drv_version (unsigned int * version, char * str); +-int dm_simplecmd_flush (int, const char *, int); +-int dm_simplecmd_noflush (int, const char *); ++int dm_simplecmd_flush (int, const char *, int, uint16_t); ++int dm_simplecmd_noflush (int, const char *, uint16_t); + int dm_addmap_create (struct multipath *mpp, char *params); + int dm_addmap_reload (struct multipath *mpp, char *params); + int dm_map_present (const char *); +Index: multipath-tools-130222/multipathd/cli_handlers.c +=================================================================== +--- multipath-tools-130222.orig/multipathd/cli_handlers.c ++++ multipath-tools-130222/multipathd/cli_handlers.c +@@ -783,7 +783,7 @@ cli_suspend(void * v, char ** reply, int + { + struct vectors * vecs = (struct vectors *)data; + char * param = get_keyparam(v, MAP); +- int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param); ++ int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param, 0); + + param = convert_dev(param, 0); + condlog(2, "%s: suspend (operator)", param); +@@ -805,7 +805,7 @@ cli_resume(void * v, char ** reply, int + { + struct vectors * vecs = (struct vectors *)data; + char * param = get_keyparam(v, MAP); +- int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param); ++ int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param, 0); + + param = convert_dev(param, 0); + condlog(2, "%s: resume (operator)", param); diff --git a/SOURCES/0076-RHBZ-1056686-add-hw_str_match.patch b/SOURCES/0076-RHBZ-1056686-add-hw_str_match.patch new file mode 100644 index 0000000..dc9aca6 --- /dev/null +++ b/SOURCES/0076-RHBZ-1056686-add-hw_str_match.patch @@ -0,0 +1,125 @@ +--- + libmultipath/config.c | 10 ++++++++-- + libmultipath/config.h | 1 + + libmultipath/dict.c | 28 ++++++++++++++++++++++++++++ + multipath/multipath.conf.5 | 11 +++++++++++ + 4 files changed, 48 insertions(+), 2 deletions(-) + +Index: multipath-tools-130222/libmultipath/config.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/config.c ++++ multipath-tools-130222/libmultipath/config.c +@@ -431,11 +431,16 @@ restart: + break; + j = n; + vector_foreach_slot_after(hw, hwe2, j) { +- if (hwe_regmatch(hwe1, hwe2)) ++ if (conf->hw_strmatch) { ++ if (hwe_strmatch(hwe2, hwe1)) ++ continue; ++ } ++ else if (hwe_regmatch(hwe1, hwe2)) + continue; + /* dup */ + merge_hwe(hwe2, hwe1); +- if (hwe_strmatch(hwe2, hwe1) == 0) { ++ if (conf->hw_strmatch || ++ hwe_strmatch(hwe2, hwe1) == 0) { + vector_del_slot(hw, i); + free_hwe(hwe1); + n -= 1; +@@ -550,6 +555,7 @@ load_config (char * file, struct udev *u + conf->fast_io_fail = DEFAULT_FAST_IO_FAIL; + conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER; + conf->detect_prio = DEFAULT_DETECT_PRIO; ++ conf->hw_strmatch = 0; + + /* + * preload default hwtable +Index: multipath-tools-130222/libmultipath/config.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/config.h ++++ multipath-tools-130222/libmultipath/config.h +@@ -107,6 +107,7 @@ struct config { + int log_checker_err; + int allow_queueing; + int find_multipaths; ++ int hw_strmatch; + uid_t uid; + gid_t gid; + mode_t mode; +Index: multipath-tools-130222/libmultipath/dict.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/dict.c ++++ multipath-tools-130222/libmultipath/dict.c +@@ -693,6 +693,25 @@ def_detect_prio_handler(vector strvec) + return 0; + } + ++static int ++def_hw_strmatch_handler(vector strvec) ++{ ++ char *buff; ++ ++ buff = set_value(strvec); ++ if (!buff) ++ return 1; ++ ++ if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) || ++ !strncmp(buff, "1", 1)) ++ conf->hw_strmatch = 1; ++ else ++ conf->hw_strmatch = 0; ++ ++ FREE(buff); ++ return 0; ++} ++ + /* + * blacklist block handlers + */ +@@ -2795,6 +2814,14 @@ snprint_def_detect_prio(char * buff, int + } + + static int ++snprint_def_hw_strmatch(char * buff, int len, void * data) ++{ ++ if (conf->hw_strmatch) ++ return snprintf(buff, len, "yes"); ++ return snprintf(buff, len, "no"); ++} ++ ++static int + snprint_ble_simple (char * buff, int len, void * data) + { + struct blentry * ble = (struct blentry *)data; +@@ -2861,6 +2888,7 @@ init_keywords(void) + install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths); + install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler); + install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio); ++ install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch); + __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/multipath/multipath.conf.5 +=================================================================== +--- multipath-tools-130222.orig/multipath/multipath.conf.5 ++++ multipath-tools-130222/multipath/multipath.conf.5 +@@ -400,6 +400,17 @@ will automatically use the + .I alua + prioritizer. If not, the prioritizer will be selected as usual. Default is + .I no ++.TP ++.B hw_str_match ++If set to ++.I yes ++, the vendor, product, and revision parameters of user device configs will be ++string matched against the built-in device configs to determine if they should ++modify an existing config, or create a new one. If set to ++.I no ++, the user device configs will be regular expression matched against the ++built-in configs instead. Default is ++.I no + . + .SH "blacklist section" + The diff --git a/SOURCES/0077-RHBZ-1054806-mpathconf-always-reload.patch b/SOURCES/0077-RHBZ-1054806-mpathconf-always-reload.patch new file mode 100644 index 0000000..467da8a --- /dev/null +++ b/SOURCES/0077-RHBZ-1054806-mpathconf-always-reload.patch @@ -0,0 +1,16 @@ +--- + multipath/mpathconf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: multipath-tools-130222/multipath/mpathconf +=================================================================== +--- multipath-tools-130222.orig/multipath/mpathconf ++++ multipath-tools-130222/multipath/mpathconf +@@ -316,6 +316,6 @@ elif [ "$ENABLE" = 0 ]; then + if [ "$HAVE_MULTIPATHD" = 1 ]; then + systemctl stop multipathd.service + fi +-elif [ -n "$CHANGED_CONFIG" -a "$HAVE_MULTIPATHD" = 1 ]; then ++elif [ "$HAVE_MULTIPATHD" = 1 ]; then + systemctl reload multipathd.service + fi diff --git a/SOURCES/0078-RHBZ-1054044-fix-mpathconf-manpage.patch b/SOURCES/0078-RHBZ-1054044-fix-mpathconf-manpage.patch new file mode 100644 index 0000000..b06b410 --- /dev/null +++ b/SOURCES/0078-RHBZ-1054044-fix-mpathconf-manpage.patch @@ -0,0 +1,17 @@ +--- + multipath/mpathconf.8 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: multipath-tools-130222/multipath/mpathconf.8 +=================================================================== +--- multipath-tools-130222.orig/multipath/mpathconf.8 ++++ multipath-tools-130222/multipath/mpathconf.8 +@@ -86,7 +86,7 @@ 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 ++to stop 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. diff --git a/SOURCES/0079-RHBZ-1070581-add-wwid-option.patch b/SOURCES/0079-RHBZ-1070581-add-wwid-option.patch new file mode 100644 index 0000000..e967a51 --- /dev/null +++ b/SOURCES/0079-RHBZ-1070581-add-wwid-option.patch @@ -0,0 +1,93 @@ +--- + multipath/main.c | 19 ++++++++++++++++--- + multipath/multipath.8 | 5 ++++- + 2 files changed, 20 insertions(+), 4 deletions(-) + +Index: multipath-tools-130222/multipath/main.c +=================================================================== +--- multipath-tools-130222.orig/multipath/main.c ++++ multipath-tools-130222/multipath/main.c +@@ -85,7 +85,7 @@ usage (char * progname) + { + fprintf (stderr, VERSION_STRING); + fprintf (stderr, "Usage:\n"); +- fprintf (stderr, " %s [-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); ++ fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-T tm:val] [-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); +@@ -98,6 +98,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" \ ++ " -a add a device wwid to the wwids file\n" \ + " -c check if a device should be a path in a multipath device\n" \ + " -T tm:val\n" \ + " check if tm matches the multipathd timestamp. If so val is\n" \ +@@ -292,6 +293,15 @@ configure (void) + } + goto out; + } ++ if (conf->dry_run == 5) { ++ r = remember_wwid(refwwid); ++ if (r == 0) ++ printf("wwid '%s' added\n", refwwid); ++ else ++ printf("failed adding '%s' to wwids file\n", ++ refwwid); ++ goto out; ++ } + condlog(3, "scope limited to %s", refwwid); + if (conf->dry_run == 2) { + if (check_wwids_file(refwwid, 0) == 0){ +@@ -428,7 +438,7 @@ main (int argc, char *argv[]) + int r = 1; + long int timestamp = -1; + int valid = -1; +- while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { ++ while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { + switch(arg) { + case 'T': + if (optarg[0] == ':') +@@ -464,7 +474,7 @@ main (int argc, char *argv[]) + if (dm_prereq()) + exit(1); + +- while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { ++ while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { + switch(arg) { + case 1: printf("optarg : %s\n",optarg); + break; +@@ -537,6 +547,9 @@ main (int argc, char *argv[]) + case 'W': + conf->dry_run = 4; + break; ++ case 'a': ++ conf->dry_run = 5; ++ break; + case ':': + fprintf(stderr, "Missing option argument\n"); + usage(argv[0]); +Index: multipath-tools-130222/multipath/multipath.8 +=================================================================== +--- multipath-tools-130222.orig/multipath/multipath.8 ++++ multipath-tools-130222/multipath/multipath.8 +@@ -8,7 +8,7 @@ multipath \- Device mapper target autoco + .RB [\| \-b\ \c + .IR bindings_file \|] + .RB [\| \-d \|] +-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-w | \-W \|] ++.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-w | \-W \|] + .RB [\| \-p\ \c + .BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|] + .RB [\| device \|] +@@ -68,6 +68,9 @@ check if a block device should be a path + .B \-q + allow device tables with queue_if_no_path when multipathd is not running + .TP ++.B \-a ++add the wwid for the specified device to the wwids file ++.TP + .B \-w + remove the wwid for the specified device from the wwids file + .TP diff --git a/SOURCES/0080-RHBZ-1075796-cmdline-wwid.patch b/SOURCES/0080-RHBZ-1075796-cmdline-wwid.patch new file mode 100644 index 0000000..f943aa3 --- /dev/null +++ b/SOURCES/0080-RHBZ-1075796-cmdline-wwid.patch @@ -0,0 +1,157 @@ +--- + libmultipath/wwids.c | 44 ++++++++++++++++++++++++++++++++++++++++++ + libmultipath/wwids.h | 1 + multipath/main.c | 12 ++++++++--- + multipath/multipath.8 | 5 +++- + multipathd/multipathd.service | 1 + 5 files changed, 59 insertions(+), 4 deletions(-) + +Index: multipath-tools-130222/libmultipath/wwids.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/wwids.c ++++ multipath-tools-130222/libmultipath/wwids.c +@@ -305,3 +305,47 @@ remember_wwid(char *wwid) + condlog(4, "wwid %s already in wwids file", wwid); + return 0; + } ++ ++int remember_cmdline_wwid(void) ++{ ++ FILE *f = NULL; ++ char buf[LINE_MAX], *next, *ptr; ++ int ret = 0; ++ ++ f = fopen("/proc/cmdline", "re"); ++ if (!f) { ++ condlog(0, "can't open /proc/cmdline : %s", strerror(errno)); ++ return -1; ++ } ++ ++ if (!fgets(buf, sizeof(buf), f)) { ++ if (ferror(f)) ++ condlog(0, "read of /proc/cmdline failed : %s", ++ strerror(errno)); ++ else ++ condlog(0, "couldn't read /proc/cmdline"); ++ fclose(f); ++ return -1; ++ } ++ fclose(f); ++ next = buf; ++ while((ptr = strstr(next, "mpath.wwid="))) { ++ ptr += 11; ++ next = strpbrk(ptr, " \t\n"); ++ if (next) { ++ *next = '\0'; ++ next++; ++ } ++ if (strlen(ptr)) { ++ if (remember_wwid(ptr) != 0) ++ ret = -1; ++ } ++ else { ++ condlog(0, "empty mpath.wwid kernel command line option"); ++ ret = -1; ++ } ++ if (!next) ++ break; ++ } ++ return ret; ++} +Index: multipath-tools-130222/libmultipath/wwids.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/wwids.h ++++ multipath-tools-130222/libmultipath/wwids.h +@@ -17,5 +17,6 @@ int remember_wwid(char *wwid); + int check_wwids_file(char *wwid, int write_wwid); + int remove_wwid(char *wwid); + int replace_wwids(vector mp); ++int remember_cmdline_wwid(void); + + #endif /* _WWIDS_H */ +Index: multipath-tools-130222/multipath/main.c +=================================================================== +--- multipath-tools-130222.orig/multipath/main.c ++++ multipath-tools-130222/multipath/main.c +@@ -85,7 +85,7 @@ usage (char * progname) + { + fprintf (stderr, VERSION_STRING); + fprintf (stderr, "Usage:\n"); +- fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); ++ fprintf (stderr, " %s [-a|-A|-c|-w|-W] [-d] [-T tm:val] [-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); +@@ -99,6 +99,8 @@ usage (char * progname) + " -f flush a multipath device map\n" \ + " -F flush all multipath device maps\n" \ + " -a add a device wwid to the wwids file\n" \ ++ " -A add devices from kernel command line mpath.wwids\n" ++ " parameters to wwids file\n" \ + " -c check if a device should be a path in a multipath device\n" \ + " -T tm:val\n" \ + " check if tm matches the multipathd timestamp. If so val is\n" \ +@@ -438,7 +440,7 @@ main (int argc, char *argv[]) + int r = 1; + long int timestamp = -1; + int valid = -1; +- while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { ++ while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { + switch(arg) { + case 'T': + if (optarg[0] == ':') +@@ -474,7 +476,7 @@ main (int argc, char *argv[]) + if (dm_prereq()) + exit(1); + +- while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { ++ while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { + switch(arg) { + case 1: printf("optarg : %s\n",optarg); + break; +@@ -538,6 +540,10 @@ main (int argc, char *argv[]) + goto out; + case 'T': + break; ++ case 'A': ++ if (remember_cmdline_wwid() != 0) ++ exit(1); ++ exit(0); + case 'h': + usage(argv[0]); + exit(0); +Index: multipath-tools-130222/multipathd/multipathd.service +=================================================================== +--- multipath-tools-130222.orig/multipathd/multipathd.service ++++ multipath-tools-130222/multipathd/multipathd.service +@@ -11,6 +11,7 @@ Conflicts=shutdown.target + Type=forking + PIDFile=/var/run/multipathd/multipathd.pid + ExecStartPre=/sbin/modprobe dm-multipath ++ExecStartPre=-/sbin/multipath -A + ExecStart=/sbin/multipathd + ExecReload=/sbin/multipathd reconfigure + #ExecStop=/path/to/scrip delete-me if not necessary +Index: multipath-tools-130222/multipath/multipath.8 +=================================================================== +--- multipath-tools-130222.orig/multipath/multipath.8 ++++ multipath-tools-130222/multipath/multipath.8 +@@ -8,7 +8,7 @@ multipath \- Device mapper target autoco + .RB [\| \-b\ \c + .IR bindings_file \|] + .RB [\| \-d \|] +-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-w | \-W \|] ++.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-A | \-w | \-W \|] + .RB [\| \-p\ \c + .BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|] + .RB [\| device \|] +@@ -71,6 +71,9 @@ allow device tables with queue_if_no_pat + .B \-a + add the wwid for the specified device to the wwids file + .TP ++.B \-A ++add wwids from any kernel command line mpath.wwid parameters to the wwids file ++.TP + .B \-w + remove the wwid for the specified device from the wwids file + .TP diff --git a/SPECS/device-mapper-multipath.spec b/SPECS/device-mapper-multipath.spec index afe671e..891931e 100644 --- a/SPECS/device-mapper-multipath.spec +++ b/SPECS/device-mapper-multipath.spec @@ -1,7 +1,7 @@ Summary: Tools to manage multipath devices using device-mapper Name: device-mapper-multipath Version: 0.4.9 -Release: 58%{?dist} +Release: 66%{?dist} License: GPL+ Group: System Environment/Base URL: http://christophe.varoqui.free.fr/ @@ -74,18 +74,32 @@ Patch0063: 0063-RH-fix-warning.patch Patch0064: 0064-RHBZ-1010040-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 +Patch0072: 0072-RHBZ-1039199-check-loop-control.patch +Patch0073: 0073-RH-update-build-flags.patch +Patch0074: 0074-RHBZ-1056976-dm-mpath-rules.patch +Patch0075: 0075-RHBZ-1056976-reload-flag.patch +Patch0076: 0076-RHBZ-1056686-add-hw_str_match.patch +Patch0077: 0077-RHBZ-1054806-mpathconf-always-reload.patch +Patch0078: 0078-RHBZ-1054044-fix-mpathconf-manpage.patch +Patch0079: 0079-RHBZ-1070581-add-wwid-option.patch +Patch0080: 0080-RHBZ-1075796-cmdline-wwid.patch # runtime Requires: %{name}-libs = %{version}-%{release} Requires: kpartx = %{version}-%{release} -Requires: device-mapper >= 1.02.39-1 +Requires: device-mapper >= 1.02.82-2 Requires: initscripts Requires(post): systemd-units systemd-sysv chkconfig Requires(preun): systemd-units Requires(postun): systemd-units # build/setup -BuildRequires: libaio-devel, device-mapper-devel >= 1.02.39-1 +BuildRequires: libaio-devel, device-mapper-devel >= 1.02.82-2 BuildRequires: libselinux-devel, libsepol-devel BuildRequires: readline-devel, ncurses-devel BuildRequires: systemd-units, systemd-devel @@ -192,6 +206,20 @@ 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 +%patch0072 -p1 +%patch0073 -p1 +%patch0074 -p1 +%patch0075 -p1 +%patch0076 -p1 +%patch0077 -p1 +%patch0078 -p1 +%patch0079 -p1 +%patch0080 -p1 cp %{SOURCE1} . %build @@ -258,6 +286,7 @@ bin/systemctl --no-reload enable multipathd.service >/dev/null 2>&1 ||: %{_mandir}/man8/mpathconf.8.gz %{_mandir}/man8/mpathpersist.8.gz %config /usr/lib/udev/rules.d/62-multipath.rules +%config /usr/lib/udev/rules.d/11-dm-mpath.rules %doc AUTHOR COPYING FAQ %doc multipath.conf %dir /etc/multipath @@ -285,6 +314,76 @@ bin/systemctl --no-reload enable multipathd.service >/dev/null 2>&1 ||: %{_mandir}/man8/kpartx.8.gz %changelog +* Wed Mar 12 2014 Benjamin Marzinski 0.4.9-66 +- Add 0080-RHBZ-1075796-cmdline-wwid.patch + * add multipath option "-A" to add wwids specified by the kernel + command line mapth.wwid options. +- Resolves: bz #1075796 + +* Mon Mar 3 2014 Benjamin Marzinski 0.4.9-65 +- Add 0078-RHBZ-1054044-fix-mpathconf-manpage.patch + * Fix typo +- Add 0079-RHBZ-1070581-add-wwid-option.patch + * add multipath option "-a". To add a device's wwid to the wwids file +- Resolves: bz #1054044, #1070581 + +* Thu Jan 30 2014 Benjamin Marzinski 0.4.9-64 +- Modify 0076-RHBZ-1056686-add-hw_str_match.patch + * Fix memory leak +- Resolves: bz #1056686 + +* Wed Jan 29 2014 Benjamin Marzinski 0.4.9-63 +- Modify 0072-RHBZ-1039199-check-loop-control.patch + * only call close on the /dev/loop-control fd the open succeeds +- Add 0073-RH-update-build-flags.patch + * fix print call to work with -Werror=format-security compile flag, and + change compilation flags for non-rpmbuild compiles +- Add 0074-RHBZ-1056976-dm-mpath-rules.patch + * Add rules to keep from doing work in udev if there are no + active paths, or if the event was for a multipath device + reloading its table due to a path change. +- Add 0075-RHBZ-1056976-reload-flag.patch + * multipath code to identify reloads that the new rules can + ignore +- Add 0076-RHBZ-1056686-add-hw_str_match.patch + * add a new default config paramter, "hw_str_match", to make user + device configs only overwrite builtin device configs if the + identifier strings match exactly, like the default in RHEL6. +- Add 0077-RHBZ-1054806-mpathconf-always-reload.patch + * Make mpathconf always reconfgure multipathd when you run it with + a reconfigure option and --with-multipathd=y, even if the + configuration doesn't change. +- Update Requires and BuildRequires for device-mapper to 1.02.82-2 +- Install new udev rules file /usr/lib/udev/rules.d/11-dm-mpath.rules +- Related: bz #1039199 +- Resolves: bz #1054806, #1056686, #1056976 + +* Fri Jan 24 2014 Daniel Mach - 0.4.9-62 +- Mass rebuild 2014-01-24 + +* Fri Dec 27 2013 Daniel Mach - 0.4.9-61 +- Mass rebuild 2013-12-27 + +* Wed Dec 11 2013 Benjamin Marzinski 0.4.9-60 +- Add 0072-RHBZ-1039199-check-loop-control.patch + * Make kpartx use LOOP_CTL_GET_FREE and loop-control to find a free + loop device. This will autoload the loop module. +- Resolves: bz #1039199 + +* Mon Dec 9 2013 Benjamin Marzinski 0.4.9-59 +- 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/ + instead of just +- Resolves: bz #1022899, #1031546, #1033791, #1034578, #1036503 + * Thu Oct 24 2013 Benjamin Marzinski 0.4.9-58 - 0066-UP-dos-4k-partition-fix.patch * Make kpartx correctly handle 4K sector size devices with dos partitions.