From d3a483f3a0a209ab78a2964d84f5188763ca97b5 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Oct 30 2018 05:00:41 +0000 Subject: import device-mapper-multipath-0.4.9-123.el7 --- diff --git a/SOURCES/0237-RHBZ-1526876-show-sysfs-state.patch b/SOURCES/0237-RHBZ-1526876-show-sysfs-state.patch new file mode 100644 index 0000000..5f77cb2 --- /dev/null +++ b/SOURCES/0237-RHBZ-1526876-show-sysfs-state.patch @@ -0,0 +1,38 @@ +--- + multipath/main.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +Index: multipath-tools-130222/multipath/main.c +=================================================================== +--- multipath-tools-130222.orig/multipath/main.c ++++ multipath-tools-130222/multipath/main.c +@@ -135,7 +135,7 @@ usage (char * progname) + } + + static int +-update_paths (struct multipath * mpp) ++update_paths (struct multipath * mpp, int quick) + { + int i, j; + struct pathgroup * pgp; +@@ -149,6 +149,10 @@ update_paths (struct multipath * mpp) + continue; + + vector_foreach_slot (pgp->paths, pp, j) { ++ if (quick) { ++ pp->mpp = mpp; ++ continue; ++ } + if (!strlen(pp->dev)) { + if (devt2devname(pp->dev, FILE_NAME_SIZE, + pp->dev_t)) { +@@ -213,8 +217,7 @@ get_dm_mpvec (vector curmp, vector pathv + * If not in "fast list mode", we need to fetch information + * about them + */ +- if (conf->cmd != CMD_LIST_SHORT) +- update_paths(mpp); ++ update_paths(mpp, (conf->cmd == CMD_LIST_SHORT)); + + if (conf->cmd == CMD_LIST_LONG) + mpp->bestpg = select_path_group(mpp); diff --git a/SOURCES/0237-RHBZ-1607749-add-transport-blacklist.patch b/SOURCES/0237-RHBZ-1607749-add-transport-blacklist.patch deleted file mode 100644 index f673bfa..0000000 --- a/SOURCES/0237-RHBZ-1607749-add-transport-blacklist.patch +++ /dev/null @@ -1,519 +0,0 @@ ---- - libmultipath/blacklist.c | 50 ++++++++++++++++++++++++++---- - libmultipath/blacklist.h | 3 + - libmultipath/config.c | 16 +++++++++ - libmultipath/config.h | 2 + - libmultipath/dict.c | 38 +++++++++++++++++++++-- - libmultipath/discovery.c | 5 +-- - libmultipath/print.c | 74 +++++++++++++++++++++++++++++++++++++++++++++ - libmultipath/print.h | 2 + - libmultipath/structs.h | 1 - multipath/multipath.conf.5 | 15 +++++++++ - 10 files changed, 194 insertions(+), 12 deletions(-) - -Index: multipath-bz1600672/libmultipath/blacklist.c -=================================================================== ---- multipath-bz1600672.orig/libmultipath/blacklist.c -+++ multipath-bz1600672/libmultipath/blacklist.c -@@ -12,6 +12,8 @@ - #include "structs.h" - #include "config.h" - #include "blacklist.h" -+#include "structs_vec.h" -+#include "print.h" - - extern int - store_ble (vector blist, char * str, int origin) -@@ -211,12 +213,14 @@ setup_default_blist (struct config * con - condlog(3, "%s: (%s) %s", dev, wwid, (M)); \ - else if (env) \ - condlog(3, "%s: (%s) %s", dev, env, (M)); \ -+ else if (protocol) \ -+ condlog(3, "%s: (%s) %s", dev, protocol, (M)); \ - else \ - condlog(3, "%s: %s", dev, (M)) - - void - log_filter (const char *dev, char *vendor, char *product, char *wwid, -- const char *env, int r) -+ const char *env, char *protocol, int r) - { - /* - * Try to sort from most likely to least. -@@ -236,6 +240,9 @@ log_filter (const char *dev, char *vendo - case MATCH_PROPERTY_BLIST: - LOG_BLIST("udev property blacklisted"); - break; -+ case MATCH_PROTOCOL_BLIST: -+ LOG_BLIST("protocol blacklisted"); -+ break; - case MATCH_DEVICE_BLIST_EXCEPT: - LOG_BLIST("vendor/product whitelisted"); - break; -@@ -251,6 +258,9 @@ log_filter (const char *dev, char *vendo - case MATCH_PROPERTY_BLIST_MISSING: - LOG_BLIST("blacklisted, udev property missing"); - break; -+ case MATCH_PROTOCOL_BLIST_EXCEPT: -+ LOG_BLIST("protocol whitelisted"); -+ break; - } - } - -@@ -270,7 +280,7 @@ int - filter_device (vector blist, vector elist, char * vendor, char * product) - { - int r = _filter_device(blist, elist, vendor, product); -- log_filter(NULL, vendor, product, NULL, NULL, r); -+ log_filter(NULL, vendor, product, NULL, NULL, NULL, r); - return r; - } - -@@ -290,7 +300,7 @@ int - filter_devnode (vector blist, vector elist, char * dev) - { - int r = _filter_devnode(blist, elist, dev); -- log_filter(dev, NULL, NULL, NULL, NULL, r); -+ log_filter(dev, NULL, NULL, NULL, NULL, NULL, r); - return r; - } - -@@ -310,7 +320,7 @@ int - filter_wwid (vector blist, vector elist, char * wwid) - { - int r = _filter_wwid(blist, elist, wwid); -- log_filter(NULL, NULL, NULL, wwid, NULL, r); -+ log_filter(NULL, NULL, NULL, wwid, NULL, NULL, r); - return r; - } - -@@ -346,7 +356,7 @@ filter_property(struct config * conf, st - - r = _filter_property(conf, env); - if (r) { -- log_filter(devname, NULL, NULL, NULL, env, r); -+ log_filter(devname, NULL, NULL, NULL, env, NULL, r); - return r; - } - } -@@ -356,13 +366,35 @@ filter_property(struct config * conf, st - * the environment variable _has_ to match. - */ - if (VECTOR_SIZE(conf->elist_property)) { -- log_filter(devname, NULL, NULL, NULL, NULL, -+ log_filter(devname, NULL, NULL, NULL, NULL, NULL, - MATCH_PROPERTY_BLIST_MISSING); - return MATCH_PROPERTY_BLIST_MISSING; - } - return 0; - } - -+static int -+_filter_protocol(vector blist, vector elist, char *protocol_str) -+{ -+ if (_blacklist_exceptions(elist, protocol_str)) -+ return MATCH_PROTOCOL_BLIST_EXCEPT; -+ if (_blacklist(blist, protocol_str)) -+ return MATCH_PROTOCOL_BLIST; -+ return 0; -+} -+ -+int -+filter_protocol(vector blist, vector elist, struct path * pp) -+{ -+ char buf[PROTOCOL_BUF_SIZE]; -+ int r; -+ -+ snprint_path_protocol(buf, sizeof(buf), pp); -+ r = _filter_protocol(blist, elist, buf); -+ log_filter(pp->dev, NULL, NULL, NULL, NULL, buf, r); -+ return r; -+} -+ - int - _filter_path (struct config * conf, struct path * pp) - { -@@ -371,6 +403,9 @@ _filter_path (struct config * conf, stru - r = filter_property(conf, pp->udev); - if (r > 0) - return r; -+ r = filter_protocol(conf->blist_protocol, conf->elist_protocol, pp); -+ if (r > 0) -+ return r; - r = _filter_devnode(conf->blist_devnode, conf->elist_devnode,pp->dev); - if (r > 0) - return r; -@@ -386,7 +421,8 @@ int - filter_path (struct config * conf, struct path * pp) - { - int r=_filter_path(conf, pp); -- log_filter(pp->dev, pp->vendor_id, pp->product_id, pp->wwid, NULL, r); -+ log_filter(pp->dev, pp->vendor_id, pp->product_id, pp->wwid, NULL, -+ NULL, r); - return r; - } - -Index: multipath-bz1600672/libmultipath/blacklist.h -=================================================================== ---- multipath-bz1600672.orig/libmultipath/blacklist.h -+++ multipath-bz1600672/libmultipath/blacklist.h -@@ -10,10 +10,12 @@ - #define MATCH_DEVNODE_BLIST 3 - #define MATCH_PROPERTY_BLIST 4 - #define MATCH_PROPERTY_BLIST_MISSING 5 -+#define MATCH_PROTOCOL_BLIST 6 - #define MATCH_WWID_BLIST_EXCEPT -MATCH_WWID_BLIST - #define MATCH_DEVICE_BLIST_EXCEPT -MATCH_DEVICE_BLIST - #define MATCH_DEVNODE_BLIST_EXCEPT -MATCH_DEVNODE_BLIST - #define MATCH_PROPERTY_BLIST_EXCEPT -MATCH_PROPERTY_BLIST -+#define MATCH_PROTOCOL_BLIST_EXCEPT -MATCH_PROTOCOL_BLIST - - struct blentry { - char * str; -@@ -36,6 +38,7 @@ int filter_wwid (vector, vector, char *) - int filter_device (vector, vector, char *, char *); - int filter_path (struct config *, struct path *); - int filter_property(struct config *, struct udev_device *); -+int filter_protocol(vector, vector, struct path *); - int store_ble (vector, char *, int); - int set_ble_device (vector, char *, char *, int); - void free_blacklist (vector); -Index: multipath-bz1600672/libmultipath/config.c -=================================================================== ---- multipath-bz1600672.orig/libmultipath/config.c -+++ multipath-bz1600672/libmultipath/config.c -@@ -598,11 +598,13 @@ free_config (struct config * conf) - free_blacklist(conf->blist_devnode); - free_blacklist(conf->blist_wwid); - free_blacklist(conf->blist_property); -+ free_blacklist(conf->blist_protocol); - free_blacklist_device(conf->blist_device); - - free_blacklist(conf->elist_devnode); - free_blacklist(conf->elist_wwid); - free_blacklist(conf->elist_property); -+ free_blacklist(conf->elist_protocol); - free_blacklist_device(conf->elist_device); - - free_mptable(conf->mptable); -@@ -788,6 +790,13 @@ load_config (char * file, struct udev *u - goto out; - } - -+ if (conf->blist_protocol == NULL) { -+ conf->blist_protocol = vector_alloc(); -+ -+ if (!conf->blist_protocol) -+ goto out; -+ } -+ - if (conf->elist_devnode == NULL) { - conf->elist_devnode = vector_alloc(); - -@@ -815,6 +824,13 @@ load_config (char * file, struct udev *u - goto out; - } - -+ if (conf->elist_protocol == NULL) { -+ conf->elist_protocol = vector_alloc(); -+ -+ if (!conf->elist_protocol) -+ goto out; -+ } -+ - if (setup_default_blist(conf)) - goto out; - -Index: multipath-bz1600672/libmultipath/config.h -=================================================================== ---- multipath-bz1600672.orig/libmultipath/config.h -+++ multipath-bz1600672/libmultipath/config.h -@@ -190,10 +190,12 @@ struct config { - vector blist_wwid; - vector blist_device; - vector blist_property; -+ vector blist_protocol; - vector elist_devnode; - vector elist_wwid; - vector elist_device; - vector elist_property; -+ vector elist_protocol; - }; - - struct config * conf; -Index: multipath-bz1600672/libmultipath/dict.c -=================================================================== ---- multipath-bz1600672.orig/libmultipath/dict.c -+++ multipath-bz1600672/libmultipath/dict.c -@@ -1065,9 +1065,12 @@ blacklist_handler(vector strvec) - conf->blist_device = vector_alloc(); - if (!conf->blist_property) - conf->blist_property = vector_alloc(); -+ if (!conf->blist_protocol) -+ conf->blist_protocol = vector_alloc(); - - if (!conf->blist_devnode || !conf->blist_wwid || -- !conf->blist_device || !conf->blist_property) -+ !conf->blist_device || !conf->blist_property || -+ !conf->blist_protocol) - return 1; - - return 0; -@@ -1084,9 +1087,12 @@ blacklist_exceptions_handler(vector strv - conf->elist_device = vector_alloc(); - if (!conf->elist_property) - conf->elist_property = vector_alloc(); -+ if (!conf->elist_protocol) -+ conf->elist_protocol = vector_alloc(); - - if (!conf->elist_devnode || !conf->elist_wwid || -- !conf->elist_device || !conf->elist_property) -+ !conf->elist_device || !conf->elist_property || -+ !conf->elist_protocol) - return 1; - - return 0; -@@ -1171,6 +1177,32 @@ ble_except_property_handler(vector strve - } - - static int -+ble_protocol_handler(vector strvec) -+{ -+ char * buff; -+ -+ buff = set_value(strvec); -+ -+ if (!buff) -+ return 1; -+ -+ return store_ble(conf->blist_protocol, buff, ORIGIN_CONFIG); -+} -+ -+static int -+ble_except_protocol_handler(vector strvec) -+{ -+ char * buff; -+ -+ buff = set_value(strvec); -+ -+ if (!buff) -+ return 1; -+ -+ return store_ble(conf->elist_protocol, buff, ORIGIN_CONFIG); -+} -+ -+static int - ble_device_handler(vector strvec) - { - return alloc_ble_device(conf->blist_device); -@@ -3936,6 +3968,7 @@ init_keywords(void) - install_keyword_multi("devnode", &ble_devnode_handler, &snprint_ble_simple); - install_keyword_multi("wwid", &ble_wwid_handler, &snprint_ble_simple); - install_keyword_multi("property", &ble_property_handler, &snprint_ble_simple); -+ install_keyword_multi("protocol", &ble_protocol_handler, &snprint_ble_simple); - install_keyword_multi("device", &ble_device_handler, NULL); - install_sublevel(); - install_keyword("vendor", &ble_vendor_handler, &snprint_bled_vendor); -@@ -3945,6 +3978,7 @@ init_keywords(void) - install_keyword_multi("devnode", &ble_except_devnode_handler, &snprint_ble_simple); - install_keyword_multi("wwid", &ble_except_wwid_handler, &snprint_ble_simple); - install_keyword_multi("property", &ble_except_property_handler, &snprint_ble_simple); -+ install_keyword_multi("protocol", &ble_except_protocol_handler, &snprint_ble_simple); - install_keyword_multi("device", &ble_except_device_handler, NULL); - install_sublevel(); - install_keyword("vendor", &ble_except_vendor_handler, &snprint_bled_vendor); -Index: multipath-bz1600672/libmultipath/discovery.c -=================================================================== ---- multipath-bz1600672.orig/libmultipath/discovery.c -+++ multipath-bz1600672/libmultipath/discovery.c -@@ -1489,9 +1489,10 @@ pathinfo (struct path *pp, vector hwtabl - - if (mask & DI_BLACKLIST && mask & DI_SYSFS) { - if (filter_device(conf->blist_device, conf->elist_device, -- pp->vendor_id, pp->product_id) > 0) { -+ pp->vendor_id, pp->product_id) > 0 || -+ filter_protocol(conf->blist_protocol, conf->elist_protocol, -+ pp) > 0) - return PATHINFO_SKIPPED; -- } - } - - path_state = path_offline(pp); -Index: multipath-bz1600672/libmultipath/print.c -=================================================================== ---- multipath-bz1600672.orig/libmultipath/print.c -+++ multipath-bz1600672/libmultipath/print.c -@@ -601,6 +601,48 @@ snprint_path_checker (char * buff, size_ - return snprint_str(buff, len, c->name); - } - -+/* if you add a protocol string bigger than "scsi:unspec" you must -+ * also change PROTOCOL_BUF_SIZE */ -+int -+snprint_path_protocol(char * buff, size_t len, struct path * pp) -+{ -+ switch (pp->bus) { -+ case SYSFS_BUS_SCSI: -+ switch (pp->sg_id.proto_id) { -+ case SCSI_PROTOCOL_FCP: -+ return snprintf(buff, len, "scsi:fcp"); -+ case SCSI_PROTOCOL_SPI: -+ return snprintf(buff, len, "scsi:spi"); -+ case SCSI_PROTOCOL_SSA: -+ return snprintf(buff, len, "scsi:ssa"); -+ case SCSI_PROTOCOL_SBP: -+ return snprintf(buff, len, "scsi:sbp"); -+ case SCSI_PROTOCOL_SRP: -+ return snprintf(buff, len, "scsi:srp"); -+ case SCSI_PROTOCOL_ISCSI: -+ return snprintf(buff, len, "scsi:iscsi"); -+ case SCSI_PROTOCOL_SAS: -+ return snprintf(buff, len, "scsi:sas"); -+ case SCSI_PROTOCOL_ADT: -+ return snprintf(buff, len, "scsi:adt"); -+ case SCSI_PROTOCOL_ATA: -+ return snprintf(buff, len, "scsi:ata"); -+ case SCSI_PROTOCOL_UNSPEC: -+ default: -+ return snprintf(buff, len, "scsi:unspec"); -+ } -+ case SYSFS_BUS_CCW: -+ return snprintf(buff, len, "ccw"); -+ case SYSFS_BUS_CCISS: -+ return snprintf(buff, len, "cciss"); -+ case SYSFS_BUS_NVME: -+ return snprintf(buff, len, "nvme"); -+ case SYSFS_BUS_UNDEF: -+ default: -+ return snprintf(buff, len, "undef"); -+ } -+} -+ - struct multipath_data mpd[] = { - {'n', "name", 0, snprint_name}, - {'w', "uuid", 0, snprint_multipath_uuid}, -@@ -647,6 +689,7 @@ struct path_data pd[] = { - {'R', "host WWPN", 0, snprint_host_wwpn}, - {'r', "target WWPN", 0, snprint_tgt_wwpn}, - {'a', "host adapter", 0, snprint_host_adapter}, -+ {'P', "protocol", 0, snprint_path_protocol}, - {0, NULL, 0 , NULL} - }; - -@@ -1428,6 +1471,19 @@ snprint_blacklist_report (char * buff, i - - if ((len - fwd - threshold) <= 0) - return len; -+ fwd += snprintf(buff + fwd, len - fwd, "protocol rules:\n" -+ "- blacklist:\n"); -+ if (!snprint_blacklist_group(buff, len, &fwd, &conf->blist_protocol)) -+ return len; -+ -+ if ((len - fwd - threshold) <= 0) -+ return len; -+ fwd += snprintf(buff + fwd, len - fwd, "- exceptions:\n"); -+ if (snprint_blacklist_group(buff, len, &fwd, &conf->elist_protocol) == 0) -+ return len; -+ -+ if ((len - fwd - threshold) <= 0) -+ return len; - fwd += snprintf(buff + fwd, len - fwd, "wwid rules:\n" - "- blacklist:\n"); - if (snprint_blacklist_group(buff, len, &fwd, &conf->blist_wwid) == 0) -@@ -1502,6 +1558,15 @@ snprint_blacklist (char * buff, int len) - if (fwd > len) - return len; - } -+ vector_foreach_slot (conf->blist_protocol, ble, i) { -+ kw = find_keyword(rootkw->sub, "protocol"); -+ if (!kw) -+ return 0; -+ fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n", -+ kw, ble); -+ if (fwd > len) -+ return len; -+ } - rootkw = find_keyword(rootkw->sub, "device"); - if (!rootkw) - return 0; -@@ -1575,6 +1640,15 @@ snprint_blacklist_except (char * buff, i - if (!kw) - return 0; - fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n", -+ kw, ele); -+ if (fwd > len) -+ return len; -+ } -+ vector_foreach_slot (conf->elist_protocol, ele, i) { -+ kw = find_keyword(rootkw->sub, "protocol"); -+ if (!kw) -+ return 0; -+ fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n", - kw, ele); - if (fwd > len) - return len; -Index: multipath-bz1600672/libmultipath/print.h -=================================================================== ---- multipath-bz1600672.orig/libmultipath/print.h -+++ multipath-bz1600672/libmultipath/print.h -@@ -115,6 +115,8 @@ int snprint_host_wwnn (char *, size_t, s - int snprint_host_wwpn (char *, size_t, struct path *); - int snprint_tgt_wwnn (char *, size_t, struct path *); - int snprint_tgt_wwpn (char *, size_t, struct path *); -+#define PROTOCOL_BUF_SIZE sizeof("scsi:unspec") -+int snprint_path_protocol(char *, size_t, struct path *); - - void print_multipath_topology (struct multipath * mpp, int verbosity); - void print_path (struct path * pp, char * style); -Index: multipath-bz1600672/libmultipath/structs.h -=================================================================== ---- multipath-bz1600672.orig/libmultipath/structs.h -+++ multipath-bz1600672/libmultipath/structs.h -@@ -50,7 +50,6 @@ enum failback_mode { - enum sysfs_buses { - SYSFS_BUS_UNDEF, - SYSFS_BUS_SCSI, -- SYSFS_BUS_IDE, - SYSFS_BUS_CCW, - SYSFS_BUS_CCISS, - SYSFS_BUS_RBD, -Index: multipath-bz1600672/multipath/multipath.conf.5 -=================================================================== ---- multipath-bz1600672.orig/multipath/multipath.conf.5 -+++ multipath-bz1600672/multipath/multipath.conf.5 -@@ -632,6 +632,10 @@ Regular expression of the device nodes t - .B property - Regular expresion of the udev property to be excluded. - .TP -+.B protocol -+Regular expression of the protocol to be excluded. See below for a -+list of recognized protocols -+.TP - .B device - Subsection for the device description. This subsection recognizes the - .I vendor -@@ -640,6 +644,13 @@ and - keywords. For a full description of these keywords please see the - .I devices - section description. -+.LP -+The protocol strings that multipath recognizes are \fIscsi:fcp\fR, -+\fIscsi:spi\fR, \fIscsi:ssa\fR, \fIscsi:sbp\fR, \fIscsi:srp\fR, -+\fIscsi:iscsi\fR, \fIscsi:sas\fR, \fIscsi:adt\fR, \fIscsi:ata\fR, -+\fIscsi:unspec\fR, \fIccw\fR, \fIcciss\fR, \fInvme\fR, and \fIundef\fR. -+The protocol that a path is using can be viewed by running -+\fBmultipathd show paths format "%d %P"\fR - .SH "blacklist_exceptions section" - The - .I blacklist_exceptions -@@ -659,6 +670,10 @@ The \fIWorld Wide Identification\fR of a - .B property - Regular expresion of the udev property to be whitelisted. - .TP -+.B protocol -+Regular expression of the protocol to be whitelisted. See the -+\fBblacklist section\fR for a list of recognized protocols -+.TP - .B devnode - Regular expression of the device nodes to be whitelisted. - .TP diff --git a/SOURCES/0238-RHBZ-1508483-mpathconf-info.patch b/SOURCES/0238-RHBZ-1508483-mpathconf-info.patch new file mode 100644 index 0000000..106a941 --- /dev/null +++ b/SOURCES/0238-RHBZ-1508483-mpathconf-info.patch @@ -0,0 +1,45 @@ +--- + libmultipath/config.c | 3 ++- + multipath/mpathconf.8 | 8 ++++++-- + 2 files changed, 8 insertions(+), 3 deletions(-) + +Index: multipath-tools-130222/libmultipath/config.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/config.c ++++ multipath-tools-130222/libmultipath/config.c +@@ -739,7 +739,8 @@ load_config (char * file, struct udev *u + condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices."); + condlog(0, "A default multipath.conf file is located at"); + condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE)); +- condlog(0, "You can run /sbin/mpathconf to create or modify /etc/multipath.conf"); ++ condlog(0, "You can run /sbin/mpathconf --enable to create"); ++ condlog(0, "/etc/multipath.conf. See man mpathconf(8) for more details"); + if (conf->blist_devnode == NULL) { + conf->blist_devnode = vector_alloc(); + if (!conf->blist_devnode) { +Index: multipath-tools-130222/multipath/mpathconf.8 +=================================================================== +--- multipath-tools-130222.orig/multipath/mpathconf.8 ++++ multipath-tools-130222/multipath/mpathconf.8 +@@ -19,7 +19,9 @@ daemon, and configure the + .B multipathd + service to start automatically or not. If + .B mpathconf +-is called with no commands, it will display the current configuration. ++is called with no commands, it will display the current configuration, but ++will not create or modify ++.B /etc/multipath.conf + + The default options for mpathconf are + .B --with_module +@@ -50,7 +52,9 @@ command. + .B --enable + Removes any line that blacklists all device nodes from the + .B /etc/multipath.conf +-blacklist section. ++blacklist section. Also, creates ++.B /etc/multipath.conf ++if it doesn't exist. + .TP + .B --disable + Adds a line that blacklists all device nodes to the diff --git a/SOURCES/0239-RHBZ-1544958-client-timeout.patch b/SOURCES/0239-RHBZ-1544958-client-timeout.patch new file mode 100644 index 0000000..ea38a16 --- /dev/null +++ b/SOURCES/0239-RHBZ-1544958-client-timeout.patch @@ -0,0 +1,17 @@ +--- + libmpathcmd/mpath_cmd.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: multipath-tools-130222/libmpathcmd/mpath_cmd.h +=================================================================== +--- multipath-tools-130222.orig/libmpathcmd/mpath_cmd.h ++++ multipath-tools-130222/libmpathcmd/mpath_cmd.h +@@ -27,7 +27,7 @@ extern "C" { + #endif + + #define DEFAULT_SOCKET "/org/kernel/linux/storage/multipathd" +-#define DEFAULT_REPLY_TIMEOUT 10000 ++#define DEFAULT_REPLY_TIMEOUT 60000 + + + /* diff --git a/SOURCES/0240-UPBZ-1568902-id_size.patch b/SOURCES/0240-UPBZ-1568902-id_size.patch new file mode 100644 index 0000000..9f1009f --- /dev/null +++ b/SOURCES/0240-UPBZ-1568902-id_size.patch @@ -0,0 +1,82 @@ +--- + libmultipath/discovery.c | 12 ++++++------ + libmultipath/structs.h | 11 +++++++++-- + 2 files changed, 15 insertions(+), 8 deletions(-) + +Index: multipath-tools-130222/libmultipath/discovery.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/discovery.c ++++ multipath-tools-130222/libmultipath/discovery.c +@@ -845,12 +845,12 @@ scsi_sysfs_pathinfo (struct path * pp) + + condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); + +- if (sysfs_get_model(parent, pp->product_id, SCSI_PRODUCT_SIZE)) ++ if (sysfs_get_model(parent, pp->product_id, PATH_PRODUCT_SIZE)) + return 1; + + condlog(3, "%s: product = %s", pp->dev, pp->product_id); + +- if (sysfs_get_rev(parent, pp->rev, SCSI_REV_SIZE)) ++ if (sysfs_get_rev(parent, pp->rev, PATH_REV_SIZE)) + return 1; + + condlog(3, "%s: rev = %s", pp->dev, pp->rev); +@@ -904,11 +904,11 @@ nvme_sysfs_pathinfo (struct path * pp) + return 1; + + snprintf(pp->vendor_id, SCSI_VENDOR_SIZE, "NVME"); +- snprintf(pp->product_id, SCSI_PRODUCT_SIZE, "%s", ++ snprintf(pp->product_id, PATH_PRODUCT_SIZE, "%s", + udev_device_get_sysattr_value(parent, "model")); + snprintf(pp->serial, SERIAL_SIZE, "%s", + udev_device_get_sysattr_value(parent, "serial")); +- snprintf(pp->rev, SCSI_REV_SIZE, "%s", ++ snprintf(pp->rev, PATH_REV_SIZE, "%s", + udev_device_get_sysattr_value(parent, "firmware_rev")); + + condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); +@@ -1022,12 +1022,12 @@ cciss_sysfs_pathinfo (struct path * pp) + + condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); + +- if (sysfs_get_model(parent, pp->product_id, SCSI_PRODUCT_SIZE)) ++ if (sysfs_get_model(parent, pp->product_id, PATH_PRODUCT_SIZE)) + return 1; + + condlog(3, "%s: product = %s", pp->dev, pp->product_id); + +- if (sysfs_get_rev(parent, pp->rev, SCSI_REV_SIZE)) ++ if (sysfs_get_rev(parent, pp->rev, PATH_REV_SIZE)) + return 1; + + condlog(3, "%s: rev = %s", pp->dev, pp->rev); +Index: multipath-tools-130222/libmultipath/structs.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/structs.h ++++ multipath-tools-130222/libmultipath/structs.h +@@ -24,6 +24,13 @@ + #define SCSI_PRODUCT_SIZE 17 + #define SCSI_REV_SIZE 5 + #define SCSI_STATE_SIZE 19 ++#define NVME_MODEL_SIZE 41 ++#define NVME_REV_SIZE 9 ++ ++/* This must be the maximum of SCSI and NVME sizes */ ++#define PATH_PRODUCT_SIZE NVME_MODEL_SIZE ++#define PATH_REV_SIZE NVME_REV_SIZE ++ + + #define NO_PATH_RETRY_UNDEF 0 + #define NO_PATH_RETRY_FAIL -1 +@@ -212,8 +219,8 @@ struct path { + struct hd_geometry geom; + char wwid[WWID_SIZE]; + char vendor_id[SCSI_VENDOR_SIZE]; +- char product_id[SCSI_PRODUCT_SIZE]; +- char rev[SCSI_REV_SIZE]; ++ char product_id[PATH_PRODUCT_SIZE]; ++ char rev[PATH_REV_SIZE]; + char serial[SERIAL_SIZE]; + char tgt_node_name[NODE_NAME_SIZE]; + unsigned long long size; diff --git a/SOURCES/0241-RHBZ-1554516-show-path-failures.patch b/SOURCES/0241-RHBZ-1554516-show-path-failures.patch new file mode 100644 index 0000000..c13d8c6 --- /dev/null +++ b/SOURCES/0241-RHBZ-1554516-show-path-failures.patch @@ -0,0 +1,29 @@ +--- + libmultipath/print.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +Index: multipath-tools-130222/libmultipath/print.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/print.c ++++ multipath-tools-130222/libmultipath/print.c +@@ -601,6 +601,12 @@ snprint_path_checker (char * buff, size_ + return snprint_str(buff, len, c->name); + } + ++static int ++snprint_path_failures(char * buff, size_t len, struct path * pp) ++{ ++ return snprint_int(buff, len, pp->failcount); ++} ++ + struct multipath_data mpd[] = { + {'n', "name", 0, snprint_name}, + {'w', "uuid", 0, snprint_multipath_uuid}, +@@ -647,6 +653,7 @@ struct path_data pd[] = { + {'R', "host WWPN", 0, snprint_host_wwpn}, + {'r', "target WWPN", 0, snprint_tgt_wwpn}, + {'a', "host adapter", 0, snprint_host_adapter}, ++ {'0', "failures", 0, snprint_path_failures}, + {0, NULL, 0 , NULL} + }; + diff --git a/SOURCES/0242-RHBZ-1541116-all-tg-pt.patch b/SOURCES/0242-RHBZ-1541116-all-tg-pt.patch new file mode 100644 index 0000000..f56e012 --- /dev/null +++ b/SOURCES/0242-RHBZ-1541116-all-tg-pt.patch @@ -0,0 +1,385 @@ +--- + libmpathpersist/mpath_persist.c | 28 +++++++++++--- + libmultipath/config.c | 3 + + libmultipath/config.h | 2 + + libmultipath/defaults.h | 1 + libmultipath/dict.c | 77 ++++++++++++++++++++++++++++++++++++++++ + libmultipath/propsel.c | 20 ++++++++++ + libmultipath/propsel.h | 1 + libmultipath/structs.h | 7 +++ + multipath/multipath.conf.5 | 7 +++ + 9 files changed, 140 insertions(+), 6 deletions(-) + +Index: multipath-tools-130222-patched/libmpathpersist/mpath_persist.c +=================================================================== +--- multipath-tools-130222-patched.orig/libmpathpersist/mpath_persist.c ++++ multipath-tools-130222-patched/libmpathpersist/mpath_persist.c +@@ -287,6 +287,7 @@ int mpath_persistent_reserve_out ( int f + } + + select_reservation_key(mpp); ++ select_all_tg_pt(mpp); + + memcpy(&prkey, paramp->sa_key, 8); + if (mpp->prkey_source == PRKEY_SOURCE_FILE && prkey && +@@ -419,7 +420,7 @@ int mpath_prout_reg(struct multipath *mp + unsigned int rq_type, struct prout_param_descriptor * paramp, int noisy) + { + +- int i, j; ++ int i, j, k; + struct pathgroup *pgp = NULL; + struct path *pp = NULL; + int rollback = 0; +@@ -444,11 +445,13 @@ int mpath_prout_reg(struct multipath *mp + } + + struct threadinfo thread[active_pathcount]; ++ int hosts[active_pathcount]; + + memset(thread, 0, sizeof(thread)); + + /* init thread parameter */ + for (i =0; i< active_pathcount; i++){ ++ hosts[i] = -1; + thread[i].param.rq_servact = rq_servact; + thread[i].param.rq_scope = rq_scope; + thread[i].param.rq_type = rq_type; +@@ -476,6 +479,17 @@ int mpath_prout_reg(struct multipath *mp + condlog (1, "%s: %s path not up. Skip.", mpp->wwid, pp->dev); + continue; + } ++ if (mpp->all_tg_pt == ALL_TG_PT_ON && ++ pp->sg_id.host_no != -1) { ++ for (k = 0; k < count; k++) { ++ if (pp->sg_id.host_no == hosts[k]) { ++ condlog(3, "%s: %s host %d matches skip.", pp->wwid, pp->dev, pp->sg_id.host_no); ++ break; ++ } ++ } ++ if (k < count) ++ continue; ++ } + strncpy(thread[count].param.dev, pp->dev, FILE_NAME_SIZE); + + if (count && (thread[count].param.paramp->sa_flags & MPATH_F_SPEC_I_PT_MASK)){ +@@ -492,10 +506,12 @@ int mpath_prout_reg(struct multipath *mp + condlog (0, "%s: failed to create thread %d", mpp->wwid, rc); + thread[count].param.status = MPATH_PR_THREAD_ERROR; + } ++ else ++ hosts[count] = pp->sg_id.host_no; + count = count +1; + } + } +- for( i=0; i < active_pathcount ; i++){ ++ for( i=0; i < count ; i++){ + if (thread[i].param.status != MPATH_PR_THREAD_ERROR) { + rc = pthread_join(thread[i].id, NULL); + if (rc){ +@@ -518,7 +534,7 @@ int mpath_prout_reg(struct multipath *mp + } + if (rollback && ((rq_servact == MPATH_PROUT_REG_SA) && sa_key != 0 )){ + condlog (3, "%s: ERROR: initiating pr out rollback", mpp->wwid); +- for( i=0 ; i < active_pathcount ; i++){ ++ for( i=0 ; i < count ; i++){ + if (thread[i].param.status == MPATH_PR_SUCCESS) { + memcpy(&thread[i].param.paramp->key, &thread[i].param.paramp->sa_key, 8); + memset(&thread[i].param.paramp->sa_key, 0, 8); +@@ -532,7 +548,7 @@ int mpath_prout_reg(struct multipath *mp + } else + thread[i].param.status = MPATH_PR_SKIP; + } +- for(i=0; i < active_pathcount ; i++){ ++ for(i=0; i < count ; i++){ + if (thread[i].param.status != MPATH_PR_SKIP && + thread[i].param.status != MPATH_PR_THREAD_ERROR) { + rc = pthread_join(thread[i].id, NULL); +@@ -678,7 +694,7 @@ int mpath_prout_rel(struct multipath *mp + } + } + pthread_attr_destroy (&attr); +- for (i = 0; i < active_pathcount; i++){ ++ for (i = 0; i < count; i++){ + if (thread[i].param.status != MPATH_PR_THREAD_ERROR) { + rc = pthread_join (thread[i].id, NULL); + if (rc){ +@@ -687,7 +703,7 @@ int mpath_prout_rel(struct multipath *mp + } + } + +- for (i = 0; i < active_pathcount; i++){ ++ for (i = 0; i < count; i++){ + /* check thread status here and return the status */ + + if (thread[i].param.status == MPATH_PR_RESERV_CONFLICT) +Index: multipath-tools-130222-patched/libmultipath/config.c +=================================================================== +--- multipath-tools-130222-patched.orig/libmultipath/config.c ++++ multipath-tools-130222-patched/libmultipath/config.c +@@ -349,6 +349,7 @@ merge_hwe (struct hwentry * dst, struct + merge_num(max_sectors_kb); + merge_num(unpriv_sgio); + merge_num(ghost_delay); ++ merge_num(all_tg_pt); + + /* + * Make sure features is consistent with +@@ -414,6 +415,7 @@ overwrite_hwe (struct hwentry * dst, str + overwrite_num(max_sectors_kb); + overwrite_num(unpriv_sgio); + overwrite_num(ghost_delay); ++ overwrite_num(all_tg_pt); + + /* + * Make sure features is consistent with +@@ -700,6 +702,7 @@ load_config (char * file, struct udev *u + conf->max_sectors_kb = DEFAULT_MAX_SECTORS_KB; + conf->unpriv_sgio = DEFAULT_UNPRIV_SGIO; + conf->ghost_delay = DEFAULT_GHOST_DELAY; ++ conf->all_tg_pt = DEFAULT_ALL_TG_PT; + + /* + * preload default hwtable +Index: multipath-tools-130222-patched/libmultipath/config.h +=================================================================== +--- multipath-tools-130222-patched.orig/libmultipath/config.h ++++ multipath-tools-130222-patched/libmultipath/config.h +@@ -71,6 +71,7 @@ struct hwentry { + int max_sectors_kb; + int unpriv_sgio; + int ghost_delay; ++ int all_tg_pt; + char * bl_product; + }; + +@@ -162,6 +163,7 @@ struct config { + int max_sectors_kb; + int unpriv_sgio; + int ghost_delay; ++ int all_tg_pt; + unsigned int version[3]; + + char * dev; +Index: multipath-tools-130222-patched/libmultipath/dict.c +=================================================================== +--- multipath-tools-130222-patched.orig/libmultipath/dict.c ++++ multipath-tools-130222-patched/libmultipath/dict.c +@@ -1051,6 +1051,29 @@ def_ghost_delay_handler(vector strvec) + return 0; + } + ++static int ++def_all_tg_pt_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->all_tg_pt = ALL_TG_PT_OFF; ++ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) || ++ (strlen(buff) == 1 && !strcmp(buff, "1"))) ++ conf->all_tg_pt = ALL_TG_PT_ON; ++ else ++ conf->all_tg_pt = DEFAULT_ALL_TG_PT; ++ ++ FREE(buff); ++ return 0; ++} ++ ++ + /* + * blacklist block handlers + */ +@@ -1969,6 +1992,33 @@ hw_ghost_delay_handler(vector strvec) + return 0; + } + ++static int ++hw_all_tg_pt_handler(vector strvec) ++{ ++ struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable); ++ char * buff; ++ ++ if (!hwe) ++ return 1; ++ ++ buff = set_value(strvec); ++ ++ if (!buff) ++ return 1; ++ ++ if ((strlen(buff) == 2 && !strcmp(buff, "no")) || ++ (strlen(buff) == 1 && !strcmp(buff, "0"))) ++ hwe->all_tg_pt = ALL_TG_PT_OFF; ++ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) || ++ (strlen(buff) == 1 && !strcmp(buff, "1"))) ++ hwe->all_tg_pt = ALL_TG_PT_ON; ++ else ++ hwe->all_tg_pt = ALL_TG_PT_UNDEF; ++ ++ FREE(buff); ++ return 0; ++} ++ + /* + * multipaths block handlers + */ +@@ -3325,6 +3375,19 @@ snprint_hw_ghost_delay (char * buff, int + } + + static int ++snprint_hw_all_tg_pt(char * buff, int len, void * data) ++{ ++ struct hwentry * hwe = (struct hwentry *)data; ++ ++ if (hwe->all_tg_pt == ALL_TG_PT_ON) ++ return snprintf(buff, len, "yes"); ++ else if (hwe->all_tg_pt == ALL_TG_PT_OFF) ++ return snprintf(buff, len, "no"); ++ else ++ return 0; ++} ++ ++static int + snprint_def_polling_interval (char * buff, int len, void * data) + { + return snprintf(buff, len, "%i", conf->checkint); +@@ -3829,6 +3892,15 @@ snprint_def_ghost_delay (char * buff, in + } + + static int ++snprint_def_all_tg_pt(char * buff, int len, void * data) ++{ ++ if (conf->all_tg_pt == ALL_TG_PT_ON) ++ 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; +@@ -3926,6 +3998,7 @@ init_keywords(void) + install_keyword("max_sectors_kb", &def_max_sectors_kb_handler, &snprint_def_max_sectors_kb); + install_keyword("unpriv_sgio", &def_unpriv_sgio_handler, &snprint_def_unpriv_sgio); + install_keyword("ghost_delay", &def_ghost_delay_handler, &snprint_def_ghost_delay); ++ install_keyword("all_tg_pt", &def_all_tg_pt_handler, &snprint_def_all_tg_pt); + __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); +@@ -4000,6 +4073,7 @@ init_keywords(void) + install_keyword("max_sectors_kb", &hw_max_sectors_kb_handler, &snprint_hw_max_sectors_kb); + install_keyword("unpriv_sgio", &hw_unpriv_sgio_handler, &snprint_hw_unpriv_sgio); + install_keyword("ghost_delay", &hw_ghost_delay_handler, &snprint_hw_ghost_delay); ++ install_keyword("all_tg_pt", &hw_all_tg_pt_handler, &snprint_hw_all_tg_pt); + install_sublevel_end(); + + install_keyword_root("overrides", &nop_handler); +@@ -4031,6 +4105,9 @@ init_keywords(void) + install_keyword("delay_wait_checks", &nop_handler, &snprint_nop); + install_keyword("skip_kpartx", &nop_handler, &snprint_nop); + install_keyword("max_sectors_kb", &nop_handler, &snprint_nop); ++ install_keyword("unpriv_sgio", &nop_handler, &snprint_nop); ++ install_keyword("ghost_delay", &nop_handler, &snprint_nop); ++ install_keyword("all_tg_pt", &nop_handler, &snprint_nop); + + install_keyword_root("multipaths", &multipaths_handler); + install_keyword_multi("multipath", &multipath_handler, NULL); +Index: multipath-tools-130222-patched/libmultipath/propsel.c +=================================================================== +--- multipath-tools-130222-patched.orig/libmultipath/propsel.c ++++ multipath-tools-130222-patched/libmultipath/propsel.c +@@ -992,3 +992,23 @@ select_ghost_delay (struct multipath * m + condlog(3, "ghost_delay = DISABLED (internal default)"); + return 0; + } ++ ++extern int ++select_all_tg_pt (struct multipath *mp) ++{ ++ if (mp->hwe && mp->hwe->all_tg_pt != ALL_TG_PT_UNDEF) { ++ mp->all_tg_pt = mp->hwe->all_tg_pt; ++ condlog(3, "all_tg_pt = %i (controller setting)", ++ mp->all_tg_pt); ++ return 0; ++ } ++ if (conf->all_tg_pt != GHOST_DELAY_UNDEF) { ++ mp->all_tg_pt = conf->all_tg_pt; ++ condlog(3, "all_tg_pt = %i (config file default)", ++ mp->all_tg_pt); ++ return 0; ++ } ++ mp->all_tg_pt = DEFAULT_ALL_TG_PT; ++ condlog(3, "all_tg_pt = %i (internal default)", mp->all_tg_pt); ++ return 0; ++} +Index: multipath-tools-130222-patched/libmultipath/structs.h +=================================================================== +--- multipath-tools-130222-patched.orig/libmultipath/structs.h ++++ multipath-tools-130222-patched/libmultipath/structs.h +@@ -154,6 +154,12 @@ enum unpriv_sgio_states { + UNPRIV_SGIO_ON, + }; + ++enum all_tg_pt_states { ++ ALL_TG_PT_UNDEF, ++ ALL_TG_PT_OFF, ++ ALL_TG_PT_ON, ++}; ++ + enum scsi_protocol { + SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */ + SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */ +@@ -324,6 +330,7 @@ struct multipath { + int prkey_source; + struct be64 reservation_key; + unsigned char prflag; ++ int all_tg_pt; + }; + + struct pathgroup { +Index: multipath-tools-130222-patched/libmultipath/propsel.h +=================================================================== +--- multipath-tools-130222-patched.orig/libmultipath/propsel.h ++++ multipath-tools-130222-patched/libmultipath/propsel.h +@@ -28,3 +28,4 @@ int select_skip_kpartx (struct multipath + int select_max_sectors_kb (struct multipath * mp); + int select_unpriv_sgio (struct multipath * mp); + int select_ghost_delay (struct multipath * mp); ++int select_all_tg_pt (struct multipath *mp); +Index: multipath-tools-130222-patched/libmultipath/defaults.h +=================================================================== +--- multipath-tools-130222-patched.orig/libmultipath/defaults.h ++++ multipath-tools-130222-patched/libmultipath/defaults.h +@@ -29,6 +29,7 @@ + #define DEFAULT_MAX_SECTORS_KB MAX_SECTORS_KB_UNDEF + #define DEFAULT_UNPRIV_SGIO UNPRIV_SGIO_OFF + #define DEFAULT_GHOST_DELAY GHOST_DELAY_OFF ++#define DEFAULT_ALL_TG_PT ALL_TG_PT_OFF + + #define DEFAULT_CHECKINT 5 + #define MAX_CHECKINT(a) (a << 2) +Index: multipath-tools-130222-patched/multipath/multipath.conf.5 +=================================================================== +--- multipath-tools-130222-patched.orig/multipath/multipath.conf.5 ++++ multipath-tools-130222-patched/multipath/multipath.conf.5 +@@ -449,6 +449,13 @@ registration is removed, the RESERVATION + It is unset by default. + .RE + .TP ++.B all_tg_pt ++This must be set to \fIyes\fR to successfully use mpathpersist on arrays that ++automatically set and clear registration keys on all target ports from a ++host, instead of per target port per host. ++Default is ++.I no ++.TP + .B retain_attached_hw_handler + If set to + .I yes diff --git a/SOURCES/0243-RHBZ-1498724-save-persist-options.patch b/SOURCES/0243-RHBZ-1498724-save-persist-options.patch new file mode 100644 index 0000000..7b7bb20 --- /dev/null +++ b/SOURCES/0243-RHBZ-1498724-save-persist-options.patch @@ -0,0 +1,504 @@ +--- + libmpathpersist/mpath_persist.c | 3 ++- + libmpathpersist/mpath_updatepr.c | 10 ++++++++-- + libmpathpersist/mpathpr.h | 3 ++- + libmultipath/Makefile | 2 +- + libmultipath/config.h | 2 ++ + libmultipath/dict.c | 24 ++++++++++++++++++------ + libmultipath/prkey.c | 25 ++++++++++++++++++++++--- + libmultipath/prkey.h | 4 ++-- + libmultipath/propsel.c | 13 ++++++++++--- + libmultipath/structs.h | 1 + + libmultipath/util.c | 16 ++++++++++++++++ + libmultipath/util.h | 1 + + multipath/multipath.conf.5 | 8 ++++++-- + multipathd/cli_handlers.c | 15 ++++++++++----- + multipathd/main.c | 1 + + 15 files changed, 102 insertions(+), 26 deletions(-) + +Index: multipath-tools-130222/libmultipath/config.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/config.h ++++ multipath-tools-130222/libmultipath/config.h +@@ -86,6 +86,7 @@ struct mpentry { + char * prio_args; + int prkey_source; + struct be64 reservation_key; ++ uint8_t sa_flags; + int pgpolicy; + int pgfailback; + int rr_weight; +@@ -183,6 +184,7 @@ struct config { + char * config_dir; + int prkey_source; + struct be64 reservation_key; ++ uint8_t sa_flags; + + vector keywords; + vector mptable; +Index: multipath-tools-130222/libmultipath/structs.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/structs.h ++++ multipath-tools-130222/libmultipath/structs.h +@@ -331,6 +331,7 @@ struct multipath { + struct be64 reservation_key; + unsigned char prflag; + int all_tg_pt; ++ uint8_t sa_flags; + }; + + struct pathgroup { +Index: multipath-tools-130222/libmultipath/util.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/util.c ++++ multipath-tools-130222/libmultipath/util.c +@@ -6,6 +6,8 @@ + #include + #include + #include ++#include ++#include + + #include "debug.h" + #include "memory.h" +@@ -317,6 +319,20 @@ int parse_prkey(char *ptr, uint64_t *prk + return 0; + } + ++int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags) ++{ ++ char *flagstr; ++ ++ flagstr = strchr(ptr, ':'); ++ *flags = 0; ++ if (flagstr) { ++ *flagstr++ = '\0'; ++ if (strlen(flagstr) == 5 && strcmp(flagstr, "aptpl") == 0) ++ *flags = MPATH_F_APTPL_MASK; ++ } ++ return parse_prkey(ptr, prkey); ++} ++ + int safe_write(int fd, const void *buf, size_t count) + { + while (count > 0) { +Index: multipath-tools-130222/libmultipath/util.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/util.h ++++ multipath-tools-130222/libmultipath/util.h +@@ -15,6 +15,7 @@ dev_t parse_devt(const char *dev_t); + char *convert_dev(char *dev, int is_path_device); + int in_initrd(void); + int parse_prkey(char *ptr, uint64_t *prkey); ++int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags); + int safe_write(int fd, const void *buf, size_t count); + + #define safe_sprintf(var, format, args...) \ +Index: multipath-tools-130222/libmultipath/Makefile +=================================================================== +--- multipath-tools-130222.orig/libmultipath/Makefile ++++ multipath-tools-130222/libmultipath/Makefile +@@ -8,7 +8,7 @@ SONAME=0 + DEVLIB = libmultipath.so + LIBS = $(DEVLIB).$(SONAME) + LIBDEPS = -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd +-CFLAGS += -fPIC -I$(mpathcmddir) ++CFLAGS += -fPIC -I$(mpathcmddir) -I$(mpathpersistdir) + + OBJS = memory.o parser.o vector.o devmapper.o \ + hwtable.o blacklist.o util.o dmparser.o config.o \ +Index: multipath-tools-130222/libmultipath/dict.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/dict.c ++++ multipath-tools-130222/libmultipath/dict.c +@@ -23,6 +23,8 @@ + #include "util.h" + #include "prkey.h" + #include ++#include ++#include + + /* + * default block handlers +@@ -557,6 +559,7 @@ def_reservation_key_handler(vector strve + { + char *buff; + uint64_t prkey = 0; ++ uint8_t flags; + + buff = set_value(strvec); + if (!buff) +@@ -568,12 +571,13 @@ def_reservation_key_handler(vector strve + FREE(buff); + return 0; + } +- else if (parse_prkey(buff, &prkey) != 0) { ++ else if (parse_prkey_flags(buff, &prkey, &flags) != 0) { + FREE(buff); + return 1; + } + + conf->prkey_source = PRKEY_SOURCE_CONF; ++ conf->sa_flags = flags; + put_be64(conf->reservation_key, prkey); + FREE(buff); + return 0; +@@ -2403,6 +2407,7 @@ mp_reservation_key_handler (vector strve + char *buff; + struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable); + uint64_t prkey; ++ uint8_t flags; + + if (!mpe) + return 1; +@@ -2417,12 +2422,13 @@ mp_reservation_key_handler (vector strve + FREE(buff); + return 0; + } +- else if (parse_prkey(buff, &prkey) != 0) { ++ else if (parse_prkey_flags(buff, &prkey, &flags) != 0) { + FREE(buff); + return 1; + } + + mpe->prkey_source = PRKEY_SOURCE_CONF; ++ mpe->sa_flags = flags; + put_be64(mpe->reservation_key, prkey); + FREE(buff); + return 0; +@@ -2838,14 +2844,17 @@ snprint_mp_prio_args(char * buff, int le + static int + snprint_mp_reservation_key (char * buff, int len, void * data) + { ++ char *flagstr = ""; + struct mpentry * mpe = (struct mpentry *)data; + + if (mpe->prkey_source == PRKEY_SOURCE_NONE) + return 0; + if (mpe->prkey_source == PRKEY_SOURCE_FILE) + return snprintf(buff, len, "file"); +- return snprintf(buff, len, "0x%" PRIx64, +- get_be64(mpe->reservation_key)); ++ if (mpe->sa_flags == MPATH_F_APTPL_MASK) ++ flagstr = ":aptpl"; ++ return snprintf(buff, len, "0x%" PRIx64 "%s", ++ get_be64(mpe->reservation_key), flagstr); + } + + static int +@@ -3716,12 +3725,15 @@ snprint_def_prkeys_file (char * buff, in + static int + snprint_def_reservation_key(char * buff, int len, void * data) + { ++ char *flagstr = ""; + if (conf->prkey_source == PRKEY_SOURCE_NONE) + return 0; + if (conf->prkey_source == PRKEY_SOURCE_FILE) + return snprintf(buff, len, "file"); +- return snprintf(buff, len, "0x%" PRIx64, +- get_be64(conf->reservation_key)); ++ if (conf->sa_flags == MPATH_F_APTPL_MASK) ++ flagstr = ":aptpl"; ++ return snprintf(buff, len, "0x%" PRIx64 "%s", ++ get_be64(conf->reservation_key), flagstr); + } + + static int +Index: multipath-tools-130222/libmpathpersist/mpath_persist.c +=================================================================== +--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c ++++ multipath-tools-130222/libmpathpersist/mpath_persist.c +@@ -295,7 +295,8 @@ int mpath_persistent_reserve_out ( int f + rq_servact == MPATH_PROUT_REG_SA) || + rq_servact == MPATH_PROUT_REG_IGN_SA)) { + memcpy(&mpp->reservation_key, paramp->sa_key, 8); +- if (update_prkey(alias, get_be64(mpp->reservation_key))) { ++ if (update_prkey_flags(alias, get_be64(mpp->reservation_key), ++ paramp->sa_flags)) { + condlog(0, "%s: failed to set prkey for multipathd.", + alias); + ret = MPATH_PR_DMMP_ERROR; +Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c +=================================================================== +--- multipath-tools-130222.orig/libmpathpersist/mpath_updatepr.c ++++ multipath-tools-130222/libmpathpersist/mpath_updatepr.c +@@ -15,6 +15,8 @@ + #include + #include + #include "memory.h" ++#include ++#include + + unsigned long mem_allocated; /* Total memory used in Bytes */ + +@@ -54,11 +56,15 @@ int update_prflag(char *mapname, int set + return do_update_pr(mapname, (set)? "setprstatus" : "unsetprstatus"); + } + +-int update_prkey(char *mapname, uint64_t prkey) { ++int update_prkey_flags(char *mapname, uint64_t prkey, uint8_t sa_flags) { + char str[256]; ++ char *flagstr = ""; + ++ if (sa_flags & MPATH_F_APTPL_MASK) ++ flagstr = ":aptpl"; + if (prkey) +- snprintf(str, sizeof(str), "setprkey key %" PRIx64, prkey); ++ snprintf(str, sizeof(str), "setprkey key %" PRIx64 "%s", prkey, ++ flagstr); + else + snprintf(str, sizeof(str), "unsetprkey"); + return do_update_pr(mapname, str); +Index: multipath-tools-130222/libmpathpersist/mpathpr.h +=================================================================== +--- multipath-tools-130222.orig/libmpathpersist/mpathpr.h ++++ multipath-tools-130222/libmpathpersist/mpathpr.h +@@ -50,7 +50,8 @@ int send_prout_activepath(char * dev, in + unsigned int rq_type, struct prout_param_descriptor * paramp, int noisy); + + int update_prflag(char *mapname, int set); +-int update_prkey(char *mapname, uint64_t prkey); ++int update_prkey_flags(char *mapname, uint64_t prkey, uint8_t sa_flags); ++#define update_prkey(mapname, prkey) update_prkey_flags(mapname, prkey, 0) + void * mpath_alloc_prin_response(int prin_sa); + int update_map_pr(struct multipath *mpp); + int devt2devname (char *devname, char *devt); +Index: multipath-tools-130222/libmultipath/prkey.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/prkey.c ++++ multipath-tools-130222/libmultipath/prkey.c +@@ -11,6 +11,8 @@ + #include + #include + #include ++#include ++#include + + #define KEYSIZE 19 + #define PRKEY_READ 0 +@@ -109,7 +111,7 @@ static int do_prkey(int fd, char *wwid, + return 0; + } + +-int get_prkey(struct multipath *mpp, uint64_t *prkey) ++int get_prkey(struct multipath *mpp, uint64_t *prkey, uint8_t *sa_flags) + { + int fd; + int unused; +@@ -125,6 +127,9 @@ int get_prkey(struct multipath *mpp, uin + ret = do_prkey(fd, mpp->wwid, keystr, PRKEY_READ); + if (ret) + goto out_file; ++ *sa_flags = 0; ++ if (strchr(keystr, 'X')) ++ *sa_flags = MPATH_F_APTPL_MASK; + ret = !!parse_prkey(keystr, prkey); + out_file: + close(fd); +@@ -132,7 +137,7 @@ out: + return ret; + } + +-int set_prkey(struct multipath *mpp, uint64_t prkey) ++int set_prkey(struct multipath *mpp, uint64_t prkey, uint8_t sa_flags) + { + int fd; + int can_write = 1; +@@ -142,6 +147,12 @@ int set_prkey(struct multipath *mpp, uin + if (!strlen(mpp->wwid)) + goto out; + ++ if (sa_flags & ~MPATH_F_APTPL_MASK) { ++ condlog(0, "unsupported pr flags, 0x%x", ++ sa_flags & ~MPATH_F_APTPL_MASK); ++ sa_flags &= MPATH_F_APTPL_MASK; ++ } ++ + fd = open_file(conf->prkeys_file, &can_write, PRKEYS_FILE_HEADER); + if (fd < 0) + goto out; +@@ -150,7 +161,15 @@ int set_prkey(struct multipath *mpp, uin + goto out_file; + } + if (prkey) { +- snprintf(keystr, KEYSIZE, "0x%016" PRIx64, prkey); ++ /* using the capitalization of the 'x' is a hack, but ++ * it's unlikely that mpath_persist will support more options ++ * since sg_persist doesn't, and this lets us keep the ++ * same file format as before instead of needing to change ++ * the format of the prkeys file */ ++ if (sa_flags) ++ snprintf(keystr, KEYSIZE, "0X%016" PRIx64, prkey); ++ else ++ snprintf(keystr, KEYSIZE, "0x%016" PRIx64, prkey); + keystr[KEYSIZE - 1] = '\0'; + ret = do_prkey(fd, mpp->wwid, keystr, PRKEY_WRITE); + } +Index: multipath-tools-130222/libmultipath/prkey.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/prkey.h ++++ multipath-tools-130222/libmultipath/prkey.h +@@ -13,7 +13,7 @@ + "# prkey wwid\n" \ + "#\n" + +-int set_prkey(struct multipath *mpp, uint64_t prkey); +-int get_prkey(struct multipath *mpp, uint64_t *prkey); ++int set_prkey(struct multipath *mpp, uint64_t prkey, uint8_t sa_flags); ++int get_prkey(struct multipath *mpp, uint64_t *prkey, uint8_t *sa_flags); + + #endif /* _PRKEY_H */ +Index: multipath-tools-130222/libmultipath/propsel.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/propsel.c ++++ multipath-tools-130222/libmultipath/propsel.c +@@ -20,6 +20,8 @@ + #include "prioritizers/alua_rtpg.h" + #include "prkey.h" + #include ++#include ++#include + + pgpolicyfn *pgpolicies[] = { + NULL, +@@ -715,10 +717,12 @@ select_reservation_key (struct multipath + uint64_t prkey; + char *origin = NULL; + char *from_file = ""; ++ char *flagstr = ""; + + if (mp->mpe && mp->mpe->prkey_source != PRKEY_SOURCE_NONE) { + mp->prkey_source = mp->mpe->prkey_source; + mp->reservation_key = mp->mpe->reservation_key; ++ mp->sa_flags = mp->mpe->sa_flags; + origin = "multipath setting"; + goto out; + } +@@ -726,6 +730,7 @@ select_reservation_key (struct multipath + if (conf->prkey_source != PRKEY_SOURCE_NONE) { + mp->prkey_source = conf->prkey_source; + mp->reservation_key = conf->reservation_key; ++ mp->sa_flags = conf->sa_flags; + origin = "config file default"; + goto out; + } +@@ -736,14 +741,16 @@ select_reservation_key (struct multipath + out: + if (mp->prkey_source == PRKEY_SOURCE_FILE) { + from_file = " (from prkeys file)"; +- if (get_prkey(mp, &prkey) != 0) ++ if (get_prkey(mp, &prkey, &mp->sa_flags) != 0) + put_be64(mp->reservation_key, 0); + else + put_be64(mp->reservation_key, prkey); + } ++ if (mp->sa_flags & MPATH_F_APTPL_MASK) ++ flagstr = ":aptpl"; + if (get_be64(mp->reservation_key)) +- condlog(0, "%s: reservation_key = 0x%" PRIx64 " (%s)%s", +- mp->alias, get_be64(mp->reservation_key), origin, ++ condlog(0, "%s: reservation_key = 0x%" PRIx64 "%s (%s)%s", ++ mp->alias, get_be64(mp->reservation_key), flagstr, origin, + from_file); + return 0; + } +Index: multipath-tools-130222/multipathd/cli_handlers.c +=================================================================== +--- multipath-tools-130222.orig/multipathd/cli_handlers.c ++++ multipath-tools-130222/multipathd/cli_handlers.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -1242,6 +1243,7 @@ cli_getprkey(void * v, char ** reply, in + struct multipath * mpp; + struct vectors * vecs = (struct vectors *)data; + char *mapname = get_keyparam(v, MAP); ++ char *flagstr = ""; + + mapname = convert_dev(mapname, 0); + condlog(3, "%s: get persistent reservation key (operator)", mapname); +@@ -1257,8 +1259,10 @@ cli_getprkey(void * v, char ** reply, in + *len = strlen(*reply) + 1; + return 0; + } +- snprintf(*reply, 20, "0x%" PRIx64 "\n", +- get_be64(mpp->reservation_key)); ++ if (mpp->sa_flags & MPATH_F_APTPL_MASK) ++ flagstr = ":aptpl"; ++ snprintf(*reply, 20, "0x%" PRIx64 "%s\n", ++ get_be64(mpp->reservation_key), flagstr); + (*reply)[19] = '\0'; + *len = strlen(*reply) + 1; + return 0; +@@ -1278,7 +1282,7 @@ cli_unsetprkey(void * v, char ** reply, + if (!mpp) + return 1; + +- return set_prkey(mpp, 0); ++ return set_prkey(mpp, 0, 0); + } + + int cli_setprkey(void * v, char ** reply, int * len, void * data) +@@ -1288,6 +1292,7 @@ int cli_setprkey(void * v, char ** reply + char *mapname = get_keyparam(v, MAP); + char *keyparam = get_keyparam(v, KEY); + uint64_t prkey; ++ uint8_t flags; + + mapname = convert_dev(mapname, 0); + condlog(3, "%s: set persistent reservation key (operator)", mapname); +@@ -1296,10 +1301,10 @@ int cli_setprkey(void * v, char ** reply + if (!mpp) + return 1; + +- if (parse_prkey(keyparam, &prkey) != 0) { ++ if (parse_prkey_flags(keyparam, &prkey, &flags) != 0) { + condlog(0, "%s: invalid prkey : '%s'", mapname, keyparam); + return 1; + } + +- return set_prkey(mpp, prkey); ++ return set_prkey(mpp, prkey, flags); + } +Index: multipath-tools-130222/multipathd/main.c +=================================================================== +--- multipath-tools-130222.orig/multipathd/main.c ++++ multipath-tools-130222/multipathd/main.c +@@ -2324,6 +2324,7 @@ void * mpath_pr_event_handler_fn (void + + param= malloc(sizeof(struct prout_param_descriptor)); + memset(param, 0 , sizeof(struct prout_param_descriptor)); ++ param->sa_flags = mpp->sa_flags; + memcpy(param->sa_key, &mpp->reservation_key, 8); + param->num_transportid = 0; + +Index: multipath-tools-130222/multipath/multipath.conf.5 +=================================================================== +--- multipath-tools-130222.orig/multipath/multipath.conf.5 ++++ multipath-tools-130222/multipath/multipath.conf.5 +@@ -438,14 +438,18 @@ This is the service action reservation k + set for all multipath devices using persistent reservations, and it must be + the same as the RESERVATION KEY field of the PERSISTENT RESERVE OUT parameter + list which contains an 8-byte value provided by the application client to the +-device server to identify the I_T nexus. ++device server to identify the I_T nexus. If the \fI--param-aptpl\fR option is ++used when registering the key with mpathpersist, \fB:aptpl\fR must be appended ++to the end of the reservation key. ++ + .RS + .PP + Alternatively, this can be set to \fBfile\fR, which will store the RESERVATION + KEY registered by mpathpersist in the \fIprkeys_file\fR. multipathd will then + use this key to register additional paths as they appear. When the + registration is removed, the RESERVATION KEY is removed from the +-\fIprkeys_file\fR. ++\fIprkeys_file\fR. The prkeys file will automatically keep track of whether ++the key was registered with \fI--param-aptpl\fR. + It is unset by default. + .RE + .TP diff --git a/SOURCES/0244-RHBZ-1562247-remove-rbd.patch b/SOURCES/0244-RHBZ-1562247-remove-rbd.patch new file mode 100644 index 0000000..931aed6 --- /dev/null +++ b/SOURCES/0244-RHBZ-1562247-remove-rbd.patch @@ -0,0 +1,1159 @@ +--- + libmultipath/checkers.c | 23 - + libmultipath/checkers.h | 5 + libmultipath/checkers/Makefile | 7 + libmultipath/checkers/cciss_tur.c | 5 + libmultipath/checkers/directio.c | 5 + libmultipath/checkers/emc_clariion.c | 5 + libmultipath/checkers/hp_sw.c | 5 + libmultipath/checkers/rbd.c | 652 ----------------------------------- + libmultipath/checkers/rdac.c | 5 + libmultipath/checkers/readsector0.c | 5 + libmultipath/checkers/tur.c | 5 + libmultipath/discovery.c | 112 ------ + libmultipath/hwtable.c | 14 + libmultipath/structs.h | 1 + multipath.conf.annotated | 4 + multipath/multipath.conf.5 | 3 + multipathd/main.c | 13 + 17 files changed, 18 insertions(+), 851 deletions(-) + +Index: multipath-tools-130222/libmultipath/checkers/rbd.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers/rbd.c ++++ /dev/null +@@ -1,652 +0,0 @@ +-/* +- * Copyright (c) 2016 Red Hat +- * Copyright (c) 2004 Christophe Varoqui +- * +- * Code based off of tur.c and ceph's krbd.cc +- */ +-#define _GNU_SOURCE +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include "rados/librados.h" +- +-#include "structs.h" +-#include "checkers.h" +- +-#include "../libmultipath/debug.h" +-#include "../libmultipath/uevent.h" +-#include "../libmultipath/util.h" +- +-struct rbd_checker_context; +-typedef int (thread_fn)(struct rbd_checker_context *ct, char *msg); +- +-#define RBD_MSG(msg, fmt, args...) snprintf(msg, CHECKER_MSG_LEN, fmt, ##args); +- +-#define RBD_FEATURE_EXCLUSIVE_LOCK (1 << 2) +- +-struct rbd_checker_context { +- int rbd_bus_id; +- char *client_addr; +- char *config_info; +- char *snap; +- char *pool; +- char *image; +- char *username; +- int remapped; +- int blacklisted; +- int lock_on_read:1; +- +- rados_t cluster; +- +- int state; +- int running; +- time_t time; +- thread_fn *fn; +- pthread_t thread; +- pthread_mutex_t lock; +- pthread_cond_t active; +- pthread_spinlock_t hldr_lock; +- int holders; +- char message[CHECKER_MSG_LEN]; +-}; +- +-int libcheck_init(struct checker * c) +-{ +- struct rbd_checker_context *ct; +- struct udev_device *block_dev; +- struct udev_device *bus_dev; +- struct udev *udev; +- struct stat sb; +- const char *block_name, *addr, *config_info, *features_str; +- const char *image, *pool, *snap, *username; +- uint64_t features = 0; +- char sysfs_path[PATH_SIZE]; +- int ret; +- +- ct = malloc(sizeof(struct rbd_checker_context)); +- if (!ct) +- return 1; +- memset(ct, 0, sizeof(struct rbd_checker_context)); +- ct->holders = 1; +- pthread_cond_init(&ct->active, NULL); +- pthread_mutex_init(&ct->lock, NULL); +- pthread_spin_init(&ct->hldr_lock, PTHREAD_PROCESS_PRIVATE); +- c->context = ct; +- +- /* +- * The rbd block layer sysfs device is not linked to the rbd bus +- * device that we interact with, so figure that out now. +- */ +- if (fstat(c->fd, &sb) != 0) +- goto free_ct; +- +- udev = udev_new(); +- if (!udev) +- goto free_ct; +- +- block_dev = udev_device_new_from_devnum(udev, 'b', sb.st_rdev); +- if (!block_dev) +- goto free_udev; +- +- block_name = udev_device_get_sysname(block_dev); +- ret = sscanf(block_name, "rbd%d", &ct->rbd_bus_id); +- +- udev_device_unref(block_dev); +- if (ret != 1) +- goto free_udev; +- +- snprintf(sysfs_path, sizeof(sysfs_path), "/sys/bus/rbd/devices/%d", +- ct->rbd_bus_id); +- bus_dev = udev_device_new_from_syspath(udev, sysfs_path); +- if (!bus_dev) +- goto free_udev; +- +- addr = udev_device_get_sysattr_value(bus_dev, "client_addr"); +- if (!addr) { +- condlog(0, "rbd%d: Could not find client_addr in rbd sysfs. " +- "Try updating kernel", ct->rbd_bus_id); +- goto free_dev; +- } +- +- ct->client_addr = strdup(addr); +- if (!ct->client_addr) +- goto free_dev; +- +- features_str = udev_device_get_sysattr_value(bus_dev, "features"); +- if (!features_str) +- goto free_addr; +- features = strtoll(features_str, NULL, 16); +- if (!(features & RBD_FEATURE_EXCLUSIVE_LOCK)) { +- condlog(3, "rbd%d: Exclusive lock not set.", ct->rbd_bus_id); +- goto free_addr; +- } +- +- config_info = udev_device_get_sysattr_value(bus_dev, "config_info"); +- if (!config_info) +- goto free_addr; +- +- if (!strstr(config_info, "noshare")) { +- condlog(3, "rbd%d: Only nonshared clients supported.", +- ct->rbd_bus_id); +- goto free_addr; +- } +- +- if (strstr(config_info, "lock_on_read")) +- ct->lock_on_read = 1; +- +- ct->config_info = strdup(config_info); +- if (!ct->config_info) +- goto free_addr; +- +- username = strstr(config_info, "name="); +- if (username) { +- char *end; +- int len; +- +- username += 5; +- end = strchr(username, ','); +- if (!end) +- goto free_info; +- len = end - username; +- +- ct->username = malloc(len + 1); +- if (!ct->username) +- goto free_info; +- strncpy(ct->username, username, len); +- ct->username[len] = '\0'; +- } +- +- image = udev_device_get_sysattr_value(bus_dev, "name"); +- if (!image) +- goto free_username; +- +- ct->image = strdup(image); +- if (!ct->image) +- goto free_info; +- +- pool = udev_device_get_sysattr_value(bus_dev, "pool"); +- if (!pool) +- goto free_image; +- +- ct->pool = strdup(pool); +- if (!ct->pool) +- goto free_image; +- +- snap = udev_device_get_sysattr_value(bus_dev, "current_snap"); +- if (!snap) +- goto free_pool; +- +- if (strcmp("-", snap)) { +- ct->snap = strdup(snap); +- if (!ct->snap) +- goto free_pool; +- } +- +- if (rados_create(&ct->cluster, NULL) < 0) { +- condlog(0, "rbd%d: Could not create rados cluster", +- ct->rbd_bus_id); +- goto free_snap; +- } +- +- if (rados_conf_read_file(ct->cluster, NULL) < 0) { +- condlog(0, "rbd%d: Could not read rados conf", ct->rbd_bus_id); +- goto shutdown_rados; +- } +- +- ret = rados_connect(ct->cluster); +- if (ret < 0) { +- condlog(0, "rbd%d: Could not connect to rados cluster", +- ct->rbd_bus_id); +- goto shutdown_rados; +- } +- +- udev_device_unref(bus_dev); +- udev_unref(udev); +- +- condlog(3, "rbd%d checker init %s %s/%s@%s %s", ct->rbd_bus_id, +- ct->client_addr, ct->pool, ct->image, ct->snap ? ct->snap : "-", +- ct->username ? ct->username : "none"); +- return 0; +- +-shutdown_rados: +- rados_shutdown(ct->cluster); +-free_snap: +- if (ct->snap) +- free(ct->snap); +-free_pool: +- free(ct->pool); +-free_image: +- free(ct->image); +-free_username: +- if (ct->username) +- free(ct->username); +-free_info: +- free(ct->config_info); +-free_addr: +- free(ct->client_addr); +-free_dev: +- udev_device_unref(bus_dev); +-free_udev: +- udev_unref(udev); +-free_ct: +- free(ct); +- return 1; +-} +- +-void cleanup_context(struct rbd_checker_context *ct) +-{ +- pthread_mutex_destroy(&ct->lock); +- pthread_cond_destroy(&ct->active); +- pthread_spin_destroy(&ct->hldr_lock); +- +- rados_shutdown(ct->cluster); +- +- if (ct->username) +- free(ct->username); +- if (ct->snap) +- free(ct->snap); +- free(ct->pool); +- free(ct->image); +- free(ct->config_info); +- free(ct->client_addr); +- free(ct); +-} +- +-void libcheck_free(struct checker * c) +-{ +- if (c->context) { +- struct rbd_checker_context *ct = c->context; +- int holders; +- pthread_t thread; +- +- pthread_spin_lock(&ct->hldr_lock); +- ct->holders--; +- holders = ct->holders; +- thread = ct->thread; +- pthread_spin_unlock(&ct->hldr_lock); +- if (holders) +- pthread_cancel(thread); +- else +- cleanup_context(ct); +- c->context = NULL; +- } +-} +- +-static int rbd_is_blacklisted(struct rbd_checker_context *ct, char *msg) +-{ +- char *addr_tok, *start, *save; +- char *cmd[2]; +- char *blklist, *stat; +- size_t blklist_len, stat_len; +- int ret; +- char *end; +- +- cmd[0] = "{\"prefix\": \"osd blacklist ls\"}"; +- cmd[1] = NULL; +- +- ret = rados_mon_command(ct->cluster, (const char **)cmd, 1, "", 0, +- &blklist, &blklist_len, &stat, &stat_len); +- if (ret < 0) { +- RBD_MSG(msg, "checker failed: mon command failed %d", ret); +- return ret; +- } +- +- if (!blklist || !blklist_len) +- goto free_bufs; +- +- /* +- * parse list of addrs with the format +- * ipv4:port/nonce date time\n +- * or +- * [ipv6]:port/nonce date time\n +- */ +- ret = 0; +- for (start = blklist; ; start = NULL) { +- addr_tok = strtok_r(start, "\n", &save); +- if (!addr_tok || !strlen(addr_tok)) +- break; +- +- end = strchr(addr_tok, ' '); +- if (!end) { +- RBD_MSG(msg, "checker failed: invalid blacklist %s", +- addr_tok); +- break; +- } +- *end = '\0'; +- +- if (!strcmp(addr_tok, ct->client_addr)) { +- ct->blacklisted = 1; +- RBD_MSG(msg, "%s is blacklisted", ct->client_addr); +- ret = 1; +- break; +- } +- } +- +-free_bufs: +- rados_buffer_free(blklist); +- rados_buffer_free(stat); +- return ret; +-} +- +-int rbd_check(struct rbd_checker_context *ct, char *msg) +-{ +- if (ct->blacklisted || rbd_is_blacklisted(ct, msg) == 1) +- return PATH_DOWN; +- +- RBD_MSG(msg, "checker reports path is up"); +- /* +- * Path may have issues, but the ceph cluster is at least +- * accepting IO, so we can attempt to do IO. +- * +- * TODO: in future versions, we can run other tests to +- * verify OSDs and networks. +- */ +- return PATH_UP; +-} +- +-static int sysfs_write_rbd_bus(const char *which, const char *buf, +- size_t buf_len) +-{ +- char sysfs_path[PATH_SIZE]; +- int fd; +- int r; +- +- /* we require newer kernels so single_major should alwayws be there */ +- snprintf(sysfs_path, sizeof(sysfs_path), +- "/sys/bus/rbd/%s_single_major", which); +- fd = open(sysfs_path, O_WRONLY); +- if (fd < 0) +- return -errno; +- +- r = safe_write(fd, buf, buf_len); +- close(fd); +- return r; +-} +- +-static int rbd_remap(struct rbd_checker_context *ct) +-{ +- char *argv[11]; +- pid_t pid; +- int ret = 0, i = 0; +- int status; +- +- pid = fork(); +- switch (pid) { +- case 0: +- argv[i++] = "rbd"; +- argv[i++] = "map"; +- if (ct->lock_on_read) +- argv[i++] = "-o noshare,lock_on_read"; +- else +- argv[i++] = "-o noshare"; +- if (ct->username) { +- argv[i++] = "--id"; +- argv[i++] = ct->username; +- } +- argv[i++] = "--pool"; +- argv[i++] = ct->pool; +- if (ct->snap) { +- argv[i++] = "--snap"; +- argv[i++] = ct->snap; +- } +- argv[i++] = ct->image; +- argv[i] = NULL; +- +- ret = execvp(argv[0], argv); +- condlog(0, "rbd%d: Error executing rbd: %s", ct->rbd_bus_id, +- strerror(errno)); +- exit(-1); +- case -1: +- condlog(0, "rbd%d: fork failed: %s", ct->rbd_bus_id, +- strerror(errno)); +- return -1; +- default: +- ret = -1; +- wait(&status); +- if (WIFEXITED(status)) { +- status = WEXITSTATUS(status); +- if (status == 0) +- ret = 0; +- else +- condlog(0, "rbd%d: failed with %d", +- ct->rbd_bus_id, status); +- } +- } +- +- return ret; +-} +- +-static int sysfs_write_rbd_remove(const char *buf, int buf_len) +-{ +- return sysfs_write_rbd_bus("remove", buf, buf_len); +-} +- +-static int rbd_rm_blacklist(struct rbd_checker_context *ct) +-{ +- char *cmd[2]; +- char *stat, *cmd_str; +- size_t stat_len; +- int ret; +- +- ret = asprintf(&cmd_str, "{\"prefix\": \"osd blacklist\", \"blacklistop\": \"rm\", \"addr\": \"%s\"}", +- ct->client_addr); +- if (ret == -1) +- return -ENOMEM; +- +- cmd[0] = cmd_str; +- cmd[1] = NULL; +- +- ret = rados_mon_command(ct->cluster, (const char **)cmd, 1, "", 0, +- NULL, 0, &stat, &stat_len); +- if (ret < 0) { +- condlog(1, "rbd%d: repair failed to remove blacklist for %s %d", +- ct->rbd_bus_id, ct->client_addr, ret); +- goto free_cmd; +- } +- +- condlog(1, "rbd%d: repair rm blacklist for %s", +- ct->rbd_bus_id, ct->client_addr); +- free(stat); +-free_cmd: +- free(cmd_str); +- return ret; +-} +- +-static int rbd_repair(struct rbd_checker_context *ct, char *msg) +-{ +- char del[17]; +- int ret; +- +- if (!ct->blacklisted) +- return PATH_UP; +- +- if (!ct->remapped) { +- ret = rbd_remap(ct); +- if (ret) { +- RBD_MSG(msg, "repair failed to remap. Err %d", ret); +- return PATH_DOWN; +- } +- } +- ct->remapped = 1; +- +- snprintf(del, sizeof(del), "%d force", ct->rbd_bus_id); +- ret = sysfs_write_rbd_remove(del, strlen(del) + 1); +- if (ret) { +- RBD_MSG(msg, "repair failed to clean up. Err %d", ret); +- return PATH_DOWN; +- } +- +- ret = rbd_rm_blacklist(ct); +- if (ret) { +- RBD_MSG(msg, "repair could not remove blacklist entry. Err %d", +- ret); +- return PATH_DOWN; +- } +- +- ct->remapped = 0; +- ct->blacklisted = 0; +- +- RBD_MSG(msg, "has been repaired"); +- return PATH_UP; +-} +- +-#define rbd_thread_cleanup_push(ct) pthread_cleanup_push(cleanup_func, ct) +-#define rbd_thread_cleanup_pop(ct) pthread_cleanup_pop(1) +- +-void cleanup_func(void *data) +-{ +- int holders; +- struct rbd_checker_context *ct = data; +- pthread_spin_lock(&ct->hldr_lock); +- ct->holders--; +- holders = ct->holders; +- ct->thread = 0; +- pthread_spin_unlock(&ct->hldr_lock); +- if (!holders) +- cleanup_context(ct); +-} +- +-void *rbd_thread(void *ctx) +-{ +- struct rbd_checker_context *ct = ctx; +- int state; +- +- condlog(3, "rbd%d: thread starting up", ct->rbd_bus_id); +- +- ct->message[0] = '\0'; +- /* This thread can be canceled, so setup clean up */ +- rbd_thread_cleanup_push(ct) +- +- /* checker start up */ +- pthread_mutex_lock(&ct->lock); +- ct->state = PATH_PENDING; +- pthread_mutex_unlock(&ct->lock); +- +- state = ct->fn(ct, ct->message); +- +- /* checker done */ +- pthread_mutex_lock(&ct->lock); +- ct->state = state; +- pthread_mutex_unlock(&ct->lock); +- pthread_cond_signal(&ct->active); +- +- condlog(3, "rbd%d: thead finished, state %s", ct->rbd_bus_id, +- checker_state_name(state)); +- rbd_thread_cleanup_pop(ct); +- return ((void *)0); +-} +- +-static void rbd_timeout(struct timespec *tsp) +-{ +- struct timeval now; +- +- gettimeofday(&now, NULL); +- tsp->tv_sec = now.tv_sec; +- tsp->tv_nsec = now.tv_usec * 1000; +- tsp->tv_nsec += 1000000; /* 1 millisecond */ +-} +- +-static int rbd_exec_fn(struct checker *c, thread_fn *fn) +-{ +- struct rbd_checker_context *ct = c->context; +- struct timespec tsp; +- pthread_attr_t attr; +- int rbd_status, r; +- +- if (c->sync) +- return fn(ct, c->message); +- /* +- * Async mode +- */ +- r = pthread_mutex_lock(&ct->lock); +- if (r != 0) { +- condlog(2, "rbd%d: mutex lock failed with %d", ct->rbd_bus_id, +- r); +- MSG(c, "rbd%d: thread failed to initialize", ct->rbd_bus_id); +- return PATH_WILD; +- } +- +- if (ct->running) { +- /* Check if checker is still running */ +- if (ct->thread) { +- condlog(3, "rbd%d: thread not finished", +- ct->rbd_bus_id); +- rbd_status = PATH_PENDING; +- } else { +- /* checker done */ +- ct->running = 0; +- rbd_status = ct->state; +- strncpy(c->message, ct->message, CHECKER_MSG_LEN); +- c->message[CHECKER_MSG_LEN - 1] = '\0'; +- } +- pthread_mutex_unlock(&ct->lock); +- } else { +- /* Start new checker */ +- ct->state = PATH_UNCHECKED; +- ct->fn = fn; +- pthread_spin_lock(&ct->hldr_lock); +- ct->holders++; +- pthread_spin_unlock(&ct->hldr_lock); +- setup_thread_attr(&attr, 32 * 1024, 1); +- r = pthread_create(&ct->thread, &attr, rbd_thread, ct); +- if (r) { +- pthread_mutex_unlock(&ct->lock); +- ct->thread = 0; +- ct->holders--; +- condlog(3, "rbd%d failed to start rbd thread, using sync mode", +- ct->rbd_bus_id); +- return fn(ct, c->message); +- } +- pthread_attr_destroy(&attr); +- rbd_timeout(&tsp); +- r = pthread_cond_timedwait(&ct->active, &ct->lock, &tsp); +- rbd_status = ct->state; +- strncpy(c->message, ct->message,CHECKER_MSG_LEN); +- c->message[CHECKER_MSG_LEN -1] = '\0'; +- pthread_mutex_unlock(&ct->lock); +- +- if (ct->thread && +- (rbd_status == PATH_PENDING || rbd_status == PATH_UNCHECKED)) { +- condlog(3, "rbd%d: thread still running", +- ct->rbd_bus_id); +- ct->running = 1; +- rbd_status = PATH_PENDING; +- } +- } +- +- return rbd_status; +-} +- +-void libcheck_repair(struct checker * c) +-{ +- struct rbd_checker_context *ct = c->context; +- +- if (!ct || !ct->blacklisted) +- return; +- rbd_exec_fn(c, rbd_repair); +-} +- +-int libcheck_check(struct checker * c) +-{ +- struct rbd_checker_context *ct = c->context; +- +- if (!ct) +- return PATH_UNCHECKED; +- +- if (ct->blacklisted) +- return PATH_DOWN; +- +- return rbd_exec_fn(c, rbd_check); +-} +Index: multipath-tools-130222/multipathd/main.c +=================================================================== +--- multipath-tools-130222.orig/multipathd/main.c ++++ multipath-tools-130222/multipathd/main.c +@@ -1291,16 +1291,6 @@ int update_path_groups(struct multipath + return 0; + } + +-void repair_path(struct path * pp) +-{ +- if (pp->state != PATH_DOWN) +- return; +- +- checker_repair(&pp->checker); +- if (strlen(checker_message(&pp->checker))) +- LOG_MSG(1, checker_message(&pp->checker)); +-} +- + void + check_path (struct vectors * vecs, struct path * pp) + { +@@ -1421,7 +1411,6 @@ check_path (struct vectors * vecs, struc + pp->mpp->failback_tick = 0; + + pp->mpp->stat_path_failures++; +- repair_path(pp); + return; + } + +@@ -1501,7 +1490,7 @@ check_path (struct vectors * vecs, struc + } + + pp->state = newstate; +- repair_path(pp); ++ + + if (pp->mpp->wait_for_udev) + return; +Index: multipath-tools-130222/libmultipath/checkers.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers.c ++++ multipath-tools-130222/libmultipath/checkers.c +@@ -139,13 +139,6 @@ struct checker * add_checker (char * nam + if (!c->free) + goto out; + +- c->repair = (void (*)(struct checker *)) dlsym(c->handle, +- "libcheck_repair"); +- errstr = dlerror(); +- if (errstr != NULL) +- condlog(0, "A dynamic linking error occurred: (%s)", errstr); +- if (!c->repair) +- goto out; + done: + c->fd = 0; + c->sync = 1; +@@ -214,21 +207,6 @@ void checker_put (struct checker * dst) + free_checker(src); + } + +-void checker_repair (struct checker * c) +-{ +- if (!c || !checker_selected(c)) +- return; +- +- c->message[0] = '\0'; +- if (c->disable) { +- MSG(c, "checker disabled"); +- return; +- } +- +- if (c->repair) +- c->repair(c); +-} +- + int checker_check (struct checker * c, int path_state) + { + int r; +@@ -297,7 +275,6 @@ void checker_get (struct checker * dst, + dst->sync = src->sync; + strncpy(dst->name, src->name, CHECKER_NAME_LEN); + strncpy(dst->message, src->message, CHECKER_MSG_LEN); +- dst->repair = src->repair; + dst->check = src->check; + dst->init = src->init; + dst->free = src->free; +Index: multipath-tools-130222/libmultipath/hwtable.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/hwtable.c ++++ multipath-tools-130222/libmultipath/hwtable.c +@@ -1171,20 +1171,6 @@ static struct hwentry default_hw[] = { + .checker_name = TUR, + .dev_loss = 30, + }, +- { +- /* +- * Red Hat +- * +- * Maintainer: Mike Christie +- * Mail: mchristi@redhat.com +- */ +- .vendor = "Ceph", +- .product = "RBD", +- .pgpolicy = FAILOVER, +- .no_path_retry = NO_PATH_RETRY_FAIL, +- .checker_name = RBD, +- .deferred_remove = DEFERRED_REMOVE_ON, +- }, + /* + * Generic NVMe devices + */ +Index: multipath-tools-130222/libmultipath/checkers/Makefile +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers/Makefile ++++ multipath-tools-130222/libmultipath/checkers/Makefile +@@ -14,17 +14,10 @@ LIBS= \ + libcheckhp_sw.so \ + libcheckrdac.so + +-ifeq ($(shell test -r /usr/include/rados/librados.h && echo 1),1) +-LIBS += libcheckrbd.so +-endif +- + CFLAGS += -fPIC -I.. + + all: $(LIBS) + +-libcheckrbd.so: rbd.o +- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ -lrados -ludev +- + libcheckdirectio.so: libsg.o directio.o + $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ -laio + +Index: multipath-tools-130222/multipath.conf.annotated +=================================================================== +--- multipath-tools-130222.orig/multipath.conf.annotated ++++ multipath-tools-130222/multipath.conf.annotated +@@ -97,7 +97,7 @@ + # # scope : multipath & multipathd + # # desc : the default method used to determine the paths' state + # # values : readsector0|tur|emc_clariion|hp_sw|directio|rdac| +-# cciss_tur|hp_tur|rbd ++# cciss_tur|hp_tur + # # default : directio + # # + # path_checker directio +@@ -493,7 +493,7 @@ + # # scope : multipathd & multipathd + # # desc : path checking algorithm to use to check path state + # # values : readsector0|tur|emc_clariion|hp_sw|directio|rdac| +-# # cciss_tur|hp_tur|rbd ++# # cciss_tur|hp_tur + # # + # path_checker directio + # +Index: multipath-tools-130222/multipath/multipath.conf.5 +=================================================================== +--- multipath-tools-130222.orig/multipath/multipath.conf.5 ++++ multipath-tools-130222/multipath/multipath.conf.5 +@@ -287,9 +287,6 @@ Read the first sector with direct I/O. + .B none + Do not check the device, fallback to use the values retrieved from sysfs + .TP +-.B rbd +-Check if the path is in the Ceph blacklist. +-.TP + Default value is \fIdirectio\fR. + .RE + .TP +Index: multipath-tools-130222/libmultipath/checkers.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers.h ++++ multipath-tools-130222/libmultipath/checkers.h +@@ -76,7 +76,6 @@ enum path_check_state { + #define READSECTOR0 "readsector0" + #define CCISS_TUR "cciss_tur" + #define NONE "none" +-#define RBD "rbd" + + #define DEFAULT_CHECKER DIRECTIO + +@@ -107,9 +106,6 @@ struct checker { + multipath-wide. Use MALLOC if + you want to stuff data in. */ + int (*check)(struct checker *); +- void (*repair)(struct checker *); /* called if check returns +- PATH_DOWN to bring path into +- usable state */ + int (*init)(struct checker *); /* to allocate the context */ + void (*free)(struct checker *); /* to free the context */ + }; +@@ -129,7 +125,6 @@ void checker_set_async (struct checker * + void checker_set_fd (struct checker *, int); + void checker_enable (struct checker *); + void checker_disable (struct checker *); +-void checker_repair (struct checker *); + int checker_check (struct checker *, int); + int checker_selected (struct checker *); + char * checker_name (struct checker *); +Index: multipath-tools-130222/libmultipath/checkers/cciss_tur.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers/cciss_tur.c ++++ multipath-tools-130222/libmultipath/checkers/cciss_tur.c +@@ -63,11 +63,6 @@ void libcheck_free (struct checker * c) + return; + } + +-void libcheck_repair (struct checker * c) +-{ +- return; +-} +- + extern int + libcheck_check (struct checker * c) + { +Index: multipath-tools-130222/libmultipath/checkers/directio.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers/directio.c ++++ multipath-tools-130222/libmultipath/checkers/directio.c +@@ -116,11 +116,6 @@ void libcheck_free (struct checker * c) + free(ct); + } + +-void libcheck_repair (struct checker * c) +-{ +- return; +-} +- + static int + check_state(int fd, struct directio_context *ct, int sync, int timeout_secs) + { +Index: multipath-tools-130222/libmultipath/checkers/emc_clariion.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers/emc_clariion.c ++++ multipath-tools-130222/libmultipath/checkers/emc_clariion.c +@@ -90,11 +90,6 @@ void libcheck_free (struct checker * c) + free(c->context); + } + +-void libcheck_repair (struct checker * c) +-{ +- return; +-} +- + int libcheck_check (struct checker * c) + { + unsigned char sense_buffer[128] = { 0, }; +Index: multipath-tools-130222/libmultipath/checkers/hp_sw.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers/hp_sw.c ++++ multipath-tools-130222/libmultipath/checkers/hp_sw.c +@@ -44,11 +44,6 @@ void libcheck_free (struct checker * c) + return; + } + +-void libcheck_repair (struct checker * c) +-{ +- return; +-} +- + static int + do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op, + void *resp, int mx_resp_len, int noisy, unsigned int timeout) +Index: multipath-tools-130222/libmultipath/checkers/rdac.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers/rdac.c ++++ multipath-tools-130222/libmultipath/checkers/rdac.c +@@ -139,11 +139,6 @@ void libcheck_free (struct checker * c) + return; + } + +-void libcheck_repair (struct checker * c) +-{ +- return; +-} +- + static int + do_inq(int sg_fd, unsigned int pg_op, void *resp, int mx_resp_len, + unsigned int timeout) +Index: multipath-tools-130222/libmultipath/checkers/readsector0.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers/readsector0.c ++++ multipath-tools-130222/libmultipath/checkers/readsector0.c +@@ -23,11 +23,6 @@ void libcheck_free (struct checker * c) + return; + } + +-void libcheck_repair (struct checker * c) +-{ +- return; +-} +- + int libcheck_check (struct checker * c) + { + unsigned char buf[4096]; +Index: multipath-tools-130222/libmultipath/checkers/tur.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers/tur.c ++++ multipath-tools-130222/libmultipath/checkers/tur.c +@@ -187,11 +187,6 @@ void libcheck_free (struct checker * c) + return; + } + +-void libcheck_repair (struct checker * c) +-{ +- return; +-} +- + #define TUR_MSG(msg, fmt, args...) snprintf(msg, CHECKER_MSG_LEN, fmt, ##args); + + int +Index: multipath-tools-130222/libmultipath/discovery.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/discovery.c ++++ multipath-tools-130222/libmultipath/discovery.c +@@ -922,21 +922,6 @@ nvme_sysfs_pathinfo (struct path * pp) + } + + static int +-rbd_sysfs_pathinfo (struct path * pp) +-{ +- sprintf(pp->vendor_id, "Ceph"); +- sprintf(pp->product_id, "RBD"); +- +- condlog(3, "%s: vendor = %s product = %s", pp->dev, pp->vendor_id, +- pp->product_id); +- /* +- * set the hwe configlet pointer +- */ +- pp->hwe = find_hwe(conf->hwtable, pp->vendor_id, pp->product_id, NULL); +- return 0; +-} +- +-static int + ccw_sysfs_pathinfo (struct path * pp) + { + struct udev_device *parent; +@@ -1151,8 +1136,6 @@ sysfs_pathinfo(struct path * pp) + pp->bus = SYSFS_BUS_CCW; + if (!strncmp(pp->dev,"sd", 2)) + pp->bus = SYSFS_BUS_SCSI; +- if (!strncmp(pp->dev,"rbd", 3)) +- pp->bus = SYSFS_BUS_RBD; + if (!strncmp(pp->dev,"nvme", 4)) + pp->bus = SYSFS_BUS_NVME; + +@@ -1167,9 +1150,6 @@ sysfs_pathinfo(struct path * pp) + } else if (pp->bus == SYSFS_BUS_CCISS) { + if (cciss_sysfs_pathinfo(pp)) + return 1; +- } else if (pp->bus == SYSFS_BUS_RBD) { +- if (rbd_sysfs_pathinfo(pp)) +- return 1; + } else if (pp->bus == SYSFS_BUS_NVME) { + if (nvme_sysfs_pathinfo(pp)) + return 1; +@@ -1275,55 +1255,6 @@ get_prio (struct path * pp) + return 0; + } + +-static int +-get_rbd_uid(struct path * pp) +-{ +- struct udev_device *rbd_bus_dev; +- int ret, rbd_bus_id; +- const char *pool, *image, *snap; +- char sysfs_path[PATH_SIZE]; +- uint64_t snap_id, max_snap_id = -3; +- +- ret = sscanf(pp->dev, "rbd%d", &rbd_bus_id); +- if (ret != 1) +- return -EINVAL; +- +- snprintf(sysfs_path, sizeof(sysfs_path), "/sys/bus/rbd/devices/%d", +- rbd_bus_id); +- rbd_bus_dev = udev_device_new_from_syspath(conf->udev, sysfs_path); +- if (!rbd_bus_dev) +- return -ENODEV; +- +- ret = -EINVAL; +- pool = udev_device_get_sysattr_value(rbd_bus_dev, "pool_id"); +- if (!pool) +- goto free_dev; +- +- image = udev_device_get_sysattr_value(rbd_bus_dev, "image_id"); +- if (!image) +- goto free_dev; +- +- snap = udev_device_get_sysattr_value(rbd_bus_dev, "snap_id"); +- if (!snap) +- goto free_dev; +- snap_id = strtoull(snap, NULL, 19); +- if (snap_id >= max_snap_id) +- ret = snprintf(pp->wwid, WWID_SIZE, "%s-%s", pool, image); +- else +- ret = snprintf(pp->wwid, WWID_SIZE, "%s-%s-%s", pool, +- image, snap); +- if (ret < WWID_SIZE) { +- ret = 0; +- } else { +- condlog(0, "%s: wwid overflow", pp->dev); +- ret = -EOVERFLOW; +- } +- +-free_dev: +- udev_device_unref(rbd_bus_dev); +- return ret; +-} +- + /* + * Mangle string of length *len starting at start + * by removing character sequence "00" (hex for a 0 byte), +@@ -1405,7 +1336,6 @@ get_uid (struct path * pp, struct udev_d + { + char *c; + const char *value; +- int ret; + + if (!pp->uid_attribute) + select_getuid(pp); +@@ -1416,34 +1346,22 @@ get_uid (struct path * pp, struct udev_d + } + + memset(pp->wwid, 0, WWID_SIZE); +- if (pp->bus == SYSFS_BUS_RBD) { +- ret = get_rbd_uid(pp); +- if (ret) { +- condlog(1, "%s: failed to get sysfs uid: %s", +- pp->dev, strerror(-ret)); +- pp->missing_udev_info = INFO_MISSING; +- pp->tick = conf->retrigger_delay; +- } ++ value = udev_device_get_property_value(udev, pp->uid_attribute); ++ if ((!value || strlen(value) == 0) && conf->cmd == CMD_VALID_PATH) ++ value = getenv(pp->uid_attribute); ++ if (value && strlen(value)) { ++ size_t len = strlcpy(pp->wwid, value, WWID_SIZE); ++ if (len > WWID_SIZE && ++ !fix_broken_nvme_wwid(pp, value, WWID_SIZE)) ++ condlog(0, "%s: wwid overflow", pp->dev); ++ condlog(4, "%s: got wwid of '%s'", pp->dev, pp->wwid); ++ pp->missing_udev_info = INFO_OK; ++ pp->tick = 0; + } else { +- value = udev_device_get_property_value(udev, +- pp->uid_attribute); +- if ((!value || strlen(value) == 0) && +- conf->cmd == CMD_VALID_PATH) +- value = getenv(pp->uid_attribute); +- if (value && strlen(value)) { +- size_t len = strlcpy(pp->wwid, value, WWID_SIZE); +- if (len > WWID_SIZE && +- !fix_broken_nvme_wwid(pp, value, WWID_SIZE)) +- condlog(0, "%s: wwid overflow", pp->dev); +- condlog(4, "%s: got wwid of '%s'", pp->dev, pp->wwid); +- 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; +- } ++ 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 */ +Index: multipath-tools-130222/libmultipath/structs.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/structs.h ++++ multipath-tools-130222/libmultipath/structs.h +@@ -60,7 +60,6 @@ enum sysfs_buses { + SYSFS_BUS_IDE, + SYSFS_BUS_CCW, + SYSFS_BUS_CCISS, +- SYSFS_BUS_RBD, + SYSFS_BUS_NVME, + }; + diff --git a/SOURCES/0245-RHBZ-1584228-fix-readsector0_size.patch b/SOURCES/0245-RHBZ-1584228-fix-readsector0_size.patch new file mode 100644 index 0000000..c15013d --- /dev/null +++ b/SOURCES/0245-RHBZ-1584228-fix-readsector0_size.patch @@ -0,0 +1,17 @@ +--- + libmultipath/checkers/readsector0.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: multipath-tools-130222/libmultipath/checkers/readsector0.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/checkers/readsector0.c ++++ multipath-tools-130222/libmultipath/checkers/readsector0.c +@@ -29,7 +29,7 @@ int libcheck_check (struct checker * c) + unsigned char sbuf[SENSE_BUFF_LEN]; + int ret; + +- ret = sg_read(c->fd, &buf[0], 4069, &sbuf[0], ++ ret = sg_read(c->fd, &buf[0], 4096, &sbuf[0], + SENSE_BUFF_LEN, c->timeout); + + switch (ret) diff --git a/SOURCES/0246-RHBZ-1593459-add-transport-blacklist.patch b/SOURCES/0246-RHBZ-1593459-add-transport-blacklist.patch new file mode 100644 index 0000000..7eb88cf --- /dev/null +++ b/SOURCES/0246-RHBZ-1593459-add-transport-blacklist.patch @@ -0,0 +1,519 @@ +--- + libmultipath/blacklist.c | 50 ++++++++++++++++++++++++++---- + libmultipath/blacklist.h | 3 + + libmultipath/config.c | 16 +++++++++ + libmultipath/config.h | 2 + + libmultipath/dict.c | 38 +++++++++++++++++++++-- + libmultipath/discovery.c | 5 +-- + libmultipath/print.c | 74 +++++++++++++++++++++++++++++++++++++++++++++ + libmultipath/print.h | 2 + + libmultipath/structs.h | 1 + multipath/multipath.conf.5 | 15 +++++++++ + 10 files changed, 194 insertions(+), 12 deletions(-) + +Index: multipath-tools-130222/libmultipath/blacklist.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/blacklist.c ++++ multipath-tools-130222/libmultipath/blacklist.c +@@ -12,6 +12,8 @@ + #include "structs.h" + #include "config.h" + #include "blacklist.h" ++#include "structs_vec.h" ++#include "print.h" + + extern int + store_ble (vector blist, char * str, int origin) +@@ -211,12 +213,14 @@ setup_default_blist (struct config * con + condlog(3, "%s: (%s) %s", dev, wwid, (M)); \ + else if (env) \ + condlog(3, "%s: (%s) %s", dev, env, (M)); \ ++ else if (protocol) \ ++ condlog(3, "%s: (%s) %s", dev, protocol, (M)); \ + else \ + condlog(3, "%s: %s", dev, (M)) + + void + log_filter (const char *dev, char *vendor, char *product, char *wwid, +- const char *env, int r) ++ const char *env, char *protocol, int r) + { + /* + * Try to sort from most likely to least. +@@ -236,6 +240,9 @@ log_filter (const char *dev, char *vendo + case MATCH_PROPERTY_BLIST: + LOG_BLIST("udev property blacklisted"); + break; ++ case MATCH_PROTOCOL_BLIST: ++ LOG_BLIST("protocol blacklisted"); ++ break; + case MATCH_DEVICE_BLIST_EXCEPT: + LOG_BLIST("vendor/product whitelisted"); + break; +@@ -251,6 +258,9 @@ log_filter (const char *dev, char *vendo + case MATCH_PROPERTY_BLIST_MISSING: + LOG_BLIST("blacklisted, udev property missing"); + break; ++ case MATCH_PROTOCOL_BLIST_EXCEPT: ++ LOG_BLIST("protocol whitelisted"); ++ break; + } + } + +@@ -270,7 +280,7 @@ int + filter_device (vector blist, vector elist, char * vendor, char * product) + { + int r = _filter_device(blist, elist, vendor, product); +- log_filter(NULL, vendor, product, NULL, NULL, r); ++ log_filter(NULL, vendor, product, NULL, NULL, NULL, r); + return r; + } + +@@ -290,7 +300,7 @@ int + filter_devnode (vector blist, vector elist, char * dev) + { + int r = _filter_devnode(blist, elist, dev); +- log_filter(dev, NULL, NULL, NULL, NULL, r); ++ log_filter(dev, NULL, NULL, NULL, NULL, NULL, r); + return r; + } + +@@ -310,7 +320,7 @@ int + filter_wwid (vector blist, vector elist, char * wwid) + { + int r = _filter_wwid(blist, elist, wwid); +- log_filter(NULL, NULL, NULL, wwid, NULL, r); ++ log_filter(NULL, NULL, NULL, wwid, NULL, NULL, r); + return r; + } + +@@ -346,7 +356,7 @@ filter_property(struct config * conf, st + + r = _filter_property(conf, env); + if (r) { +- log_filter(devname, NULL, NULL, NULL, env, r); ++ log_filter(devname, NULL, NULL, NULL, env, NULL, r); + return r; + } + } +@@ -356,13 +366,35 @@ filter_property(struct config * conf, st + * the environment variable _has_ to match. + */ + if (VECTOR_SIZE(conf->elist_property)) { +- log_filter(devname, NULL, NULL, NULL, NULL, ++ log_filter(devname, NULL, NULL, NULL, NULL, NULL, + MATCH_PROPERTY_BLIST_MISSING); + return MATCH_PROPERTY_BLIST_MISSING; + } + return 0; + } + ++static int ++_filter_protocol(vector blist, vector elist, char *protocol_str) ++{ ++ if (_blacklist_exceptions(elist, protocol_str)) ++ return MATCH_PROTOCOL_BLIST_EXCEPT; ++ if (_blacklist(blist, protocol_str)) ++ return MATCH_PROTOCOL_BLIST; ++ return 0; ++} ++ ++int ++filter_protocol(vector blist, vector elist, struct path * pp) ++{ ++ char buf[PROTOCOL_BUF_SIZE]; ++ int r; ++ ++ snprint_path_protocol(buf, sizeof(buf), pp); ++ r = _filter_protocol(blist, elist, buf); ++ log_filter(pp->dev, NULL, NULL, NULL, NULL, buf, r); ++ return r; ++} ++ + int + _filter_path (struct config * conf, struct path * pp) + { +@@ -371,6 +403,9 @@ _filter_path (struct config * conf, stru + r = filter_property(conf, pp->udev); + if (r > 0) + return r; ++ r = filter_protocol(conf->blist_protocol, conf->elist_protocol, pp); ++ if (r > 0) ++ return r; + r = _filter_devnode(conf->blist_devnode, conf->elist_devnode,pp->dev); + if (r > 0) + return r; +@@ -386,7 +421,8 @@ int + filter_path (struct config * conf, struct path * pp) + { + int r=_filter_path(conf, pp); +- log_filter(pp->dev, pp->vendor_id, pp->product_id, pp->wwid, NULL, r); ++ log_filter(pp->dev, pp->vendor_id, pp->product_id, pp->wwid, NULL, ++ NULL, r); + return r; + } + +Index: multipath-tools-130222/libmultipath/blacklist.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/blacklist.h ++++ multipath-tools-130222/libmultipath/blacklist.h +@@ -10,10 +10,12 @@ + #define MATCH_DEVNODE_BLIST 3 + #define MATCH_PROPERTY_BLIST 4 + #define MATCH_PROPERTY_BLIST_MISSING 5 ++#define MATCH_PROTOCOL_BLIST 6 + #define MATCH_WWID_BLIST_EXCEPT -MATCH_WWID_BLIST + #define MATCH_DEVICE_BLIST_EXCEPT -MATCH_DEVICE_BLIST + #define MATCH_DEVNODE_BLIST_EXCEPT -MATCH_DEVNODE_BLIST + #define MATCH_PROPERTY_BLIST_EXCEPT -MATCH_PROPERTY_BLIST ++#define MATCH_PROTOCOL_BLIST_EXCEPT -MATCH_PROTOCOL_BLIST + + struct blentry { + char * str; +@@ -36,6 +38,7 @@ int filter_wwid (vector, vector, char *) + int filter_device (vector, vector, char *, char *); + int filter_path (struct config *, struct path *); + int filter_property(struct config *, struct udev_device *); ++int filter_protocol(vector, vector, struct path *); + int store_ble (vector, char *, int); + int set_ble_device (vector, char *, char *, int); + void free_blacklist (vector); +Index: multipath-tools-130222/libmultipath/config.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/config.c ++++ multipath-tools-130222/libmultipath/config.c +@@ -600,11 +600,13 @@ free_config (struct config * conf) + free_blacklist(conf->blist_devnode); + free_blacklist(conf->blist_wwid); + free_blacklist(conf->blist_property); ++ free_blacklist(conf->blist_protocol); + free_blacklist_device(conf->blist_device); + + free_blacklist(conf->elist_devnode); + free_blacklist(conf->elist_wwid); + free_blacklist(conf->elist_property); ++ free_blacklist(conf->elist_protocol); + free_blacklist_device(conf->elist_device); + + free_mptable(conf->mptable); +@@ -792,6 +794,13 @@ load_config (char * file, struct udev *u + goto out; + } + ++ if (conf->blist_protocol == NULL) { ++ conf->blist_protocol = vector_alloc(); ++ ++ if (!conf->blist_protocol) ++ goto out; ++ } ++ + if (conf->elist_devnode == NULL) { + conf->elist_devnode = vector_alloc(); + +@@ -819,6 +828,13 @@ load_config (char * file, struct udev *u + goto out; + } + ++ if (conf->elist_protocol == NULL) { ++ conf->elist_protocol = vector_alloc(); ++ ++ if (!conf->elist_protocol) ++ goto out; ++ } ++ + if (setup_default_blist(conf)) + goto out; + +Index: multipath-tools-130222/libmultipath/config.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/config.h ++++ multipath-tools-130222/libmultipath/config.h +@@ -194,10 +194,12 @@ struct config { + vector blist_wwid; + vector blist_device; + vector blist_property; ++ vector blist_protocol; + vector elist_devnode; + vector elist_wwid; + vector elist_device; + vector elist_property; ++ vector elist_protocol; + }; + + struct config * conf; +Index: multipath-tools-130222/libmultipath/dict.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/dict.c ++++ multipath-tools-130222/libmultipath/dict.c +@@ -1092,9 +1092,12 @@ blacklist_handler(vector strvec) + conf->blist_device = vector_alloc(); + if (!conf->blist_property) + conf->blist_property = vector_alloc(); ++ if (!conf->blist_protocol) ++ conf->blist_protocol = vector_alloc(); + + if (!conf->blist_devnode || !conf->blist_wwid || +- !conf->blist_device || !conf->blist_property) ++ !conf->blist_device || !conf->blist_property || ++ !conf->blist_protocol) + return 1; + + return 0; +@@ -1111,9 +1114,12 @@ blacklist_exceptions_handler(vector strv + conf->elist_device = vector_alloc(); + if (!conf->elist_property) + conf->elist_property = vector_alloc(); ++ if (!conf->elist_protocol) ++ conf->elist_protocol = vector_alloc(); + + if (!conf->elist_devnode || !conf->elist_wwid || +- !conf->elist_device || !conf->elist_property) ++ !conf->elist_device || !conf->elist_property || ++ !conf->elist_protocol) + return 1; + + return 0; +@@ -1198,6 +1204,32 @@ ble_except_property_handler(vector strve + } + + static int ++ble_protocol_handler(vector strvec) ++{ ++ char * buff; ++ ++ buff = set_value(strvec); ++ ++ if (!buff) ++ return 1; ++ ++ return store_ble(conf->blist_protocol, buff, ORIGIN_CONFIG); ++} ++ ++static int ++ble_except_protocol_handler(vector strvec) ++{ ++ char * buff; ++ ++ buff = set_value(strvec); ++ ++ if (!buff) ++ return 1; ++ ++ return store_ble(conf->elist_protocol, buff, ORIGIN_CONFIG); ++} ++ ++static int + ble_device_handler(vector strvec) + { + return alloc_ble_device(conf->blist_device); +@@ -4021,6 +4053,7 @@ init_keywords(void) + install_keyword_multi("devnode", &ble_devnode_handler, &snprint_ble_simple); + install_keyword_multi("wwid", &ble_wwid_handler, &snprint_ble_simple); + install_keyword_multi("property", &ble_property_handler, &snprint_ble_simple); ++ install_keyword_multi("protocol", &ble_protocol_handler, &snprint_ble_simple); + install_keyword_multi("device", &ble_device_handler, NULL); + install_sublevel(); + install_keyword("vendor", &ble_vendor_handler, &snprint_bled_vendor); +@@ -4030,6 +4063,7 @@ init_keywords(void) + install_keyword_multi("devnode", &ble_except_devnode_handler, &snprint_ble_simple); + install_keyword_multi("wwid", &ble_except_wwid_handler, &snprint_ble_simple); + install_keyword_multi("property", &ble_except_property_handler, &snprint_ble_simple); ++ install_keyword_multi("protocol", &ble_except_protocol_handler, &snprint_ble_simple); + install_keyword_multi("device", &ble_except_device_handler, NULL); + install_sublevel(); + install_keyword("vendor", &ble_except_vendor_handler, &snprint_bled_vendor); +Index: multipath-tools-130222/libmultipath/print.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/print.c ++++ multipath-tools-130222/libmultipath/print.c +@@ -607,6 +607,48 @@ snprint_path_failures(char * buff, size_ + return snprint_int(buff, len, pp->failcount); + } + ++/* if you add a protocol string bigger than "scsi:unspec" you must ++ * also change PROTOCOL_BUF_SIZE */ ++int ++snprint_path_protocol(char * buff, size_t len, struct path * pp) ++{ ++ switch (pp->bus) { ++ case SYSFS_BUS_SCSI: ++ switch (pp->sg_id.proto_id) { ++ case SCSI_PROTOCOL_FCP: ++ return snprintf(buff, len, "scsi:fcp"); ++ case SCSI_PROTOCOL_SPI: ++ return snprintf(buff, len, "scsi:spi"); ++ case SCSI_PROTOCOL_SSA: ++ return snprintf(buff, len, "scsi:ssa"); ++ case SCSI_PROTOCOL_SBP: ++ return snprintf(buff, len, "scsi:sbp"); ++ case SCSI_PROTOCOL_SRP: ++ return snprintf(buff, len, "scsi:srp"); ++ case SCSI_PROTOCOL_ISCSI: ++ return snprintf(buff, len, "scsi:iscsi"); ++ case SCSI_PROTOCOL_SAS: ++ return snprintf(buff, len, "scsi:sas"); ++ case SCSI_PROTOCOL_ADT: ++ return snprintf(buff, len, "scsi:adt"); ++ case SCSI_PROTOCOL_ATA: ++ return snprintf(buff, len, "scsi:ata"); ++ case SCSI_PROTOCOL_UNSPEC: ++ default: ++ return snprintf(buff, len, "scsi:unspec"); ++ } ++ case SYSFS_BUS_CCW: ++ return snprintf(buff, len, "ccw"); ++ case SYSFS_BUS_CCISS: ++ return snprintf(buff, len, "cciss"); ++ case SYSFS_BUS_NVME: ++ return snprintf(buff, len, "nvme"); ++ case SYSFS_BUS_UNDEF: ++ default: ++ return snprintf(buff, len, "undef"); ++ } ++} ++ + struct multipath_data mpd[] = { + {'n', "name", 0, snprint_name}, + {'w', "uuid", 0, snprint_multipath_uuid}, +@@ -654,6 +696,7 @@ struct path_data pd[] = { + {'r', "target WWPN", 0, snprint_tgt_wwpn}, + {'a', "host adapter", 0, snprint_host_adapter}, + {'0', "failures", 0, snprint_path_failures}, ++ {'P', "protocol", 0, snprint_path_protocol}, + {0, NULL, 0 , NULL} + }; + +@@ -1435,6 +1478,19 @@ snprint_blacklist_report (char * buff, i + + if ((len - fwd - threshold) <= 0) + return len; ++ fwd += snprintf(buff + fwd, len - fwd, "protocol rules:\n" ++ "- blacklist:\n"); ++ if (!snprint_blacklist_group(buff, len, &fwd, &conf->blist_protocol)) ++ return len; ++ ++ if ((len - fwd - threshold) <= 0) ++ return len; ++ fwd += snprintf(buff + fwd, len - fwd, "- exceptions:\n"); ++ if (snprint_blacklist_group(buff, len, &fwd, &conf->elist_protocol) == 0) ++ return len; ++ ++ if ((len - fwd - threshold) <= 0) ++ return len; + fwd += snprintf(buff + fwd, len - fwd, "wwid rules:\n" + "- blacklist:\n"); + if (snprint_blacklist_group(buff, len, &fwd, &conf->blist_wwid) == 0) +@@ -1509,6 +1565,15 @@ snprint_blacklist (char * buff, int len) + if (fwd > len) + return len; + } ++ vector_foreach_slot (conf->blist_protocol, ble, i) { ++ kw = find_keyword(rootkw->sub, "protocol"); ++ if (!kw) ++ return 0; ++ fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n", ++ kw, ble); ++ if (fwd > len) ++ return len; ++ } + rootkw = find_keyword(rootkw->sub, "device"); + if (!rootkw) + return 0; +@@ -1582,6 +1647,15 @@ snprint_blacklist_except (char * buff, i + if (!kw) + return 0; + fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n", ++ kw, ele); ++ if (fwd > len) ++ return len; ++ } ++ vector_foreach_slot (conf->elist_protocol, ele, i) { ++ kw = find_keyword(rootkw->sub, "protocol"); ++ if (!kw) ++ return 0; ++ fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n", + kw, ele); + if (fwd > len) + return len; +Index: multipath-tools-130222/libmultipath/print.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/print.h ++++ multipath-tools-130222/libmultipath/print.h +@@ -115,6 +115,8 @@ int snprint_host_wwnn (char *, size_t, s + int snprint_host_wwpn (char *, size_t, struct path *); + int snprint_tgt_wwnn (char *, size_t, struct path *); + int snprint_tgt_wwpn (char *, size_t, struct path *); ++#define PROTOCOL_BUF_SIZE sizeof("scsi:unspec") ++int snprint_path_protocol(char *, size_t, struct path *); + + void print_multipath_topology (struct multipath * mpp, int verbosity); + void print_path (struct path * pp, char * style); +Index: multipath-tools-130222/libmultipath/structs.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/structs.h ++++ multipath-tools-130222/libmultipath/structs.h +@@ -57,7 +57,6 @@ enum failback_mode { + enum sysfs_buses { + SYSFS_BUS_UNDEF, + SYSFS_BUS_SCSI, +- SYSFS_BUS_IDE, + SYSFS_BUS_CCW, + SYSFS_BUS_CCISS, + SYSFS_BUS_NVME, +Index: multipath-tools-130222/libmultipath/discovery.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/discovery.c ++++ multipath-tools-130222/libmultipath/discovery.c +@@ -1407,9 +1407,10 @@ pathinfo (struct path *pp, vector hwtabl + + if (mask & DI_BLACKLIST && mask & DI_SYSFS) { + if (filter_device(conf->blist_device, conf->elist_device, +- pp->vendor_id, pp->product_id) > 0) { ++ pp->vendor_id, pp->product_id) > 0 || ++ filter_protocol(conf->blist_protocol, conf->elist_protocol, ++ pp) > 0) + return PATHINFO_SKIPPED; +- } + } + + path_state = path_offline(pp); +Index: multipath-tools-130222/multipath/multipath.conf.5 +=================================================================== +--- multipath-tools-130222.orig/multipath/multipath.conf.5 ++++ multipath-tools-130222/multipath/multipath.conf.5 +@@ -640,6 +640,10 @@ Regular expression of the device nodes t + .B property + Regular expresion of the udev property to be excluded. + .TP ++.B protocol ++Regular expression of the protocol to be excluded. See below for a ++list of recognized protocols ++.TP + .B device + Subsection for the device description. This subsection recognizes the + .I vendor +@@ -648,6 +652,13 @@ and + keywords. For a full description of these keywords please see the + .I devices + section description. ++.LP ++The protocol strings that multipath recognizes are \fIscsi:fcp\fR, ++\fIscsi:spi\fR, \fIscsi:ssa\fR, \fIscsi:sbp\fR, \fIscsi:srp\fR, ++\fIscsi:iscsi\fR, \fIscsi:sas\fR, \fIscsi:adt\fR, \fIscsi:ata\fR, ++\fIscsi:unspec\fR, \fIccw\fR, \fIcciss\fR, \fInvme\fR, and \fIundef\fR. ++The protocol that a path is using can be viewed by running ++\fBmultipathd show paths format "%d %P"\fR + .SH "blacklist_exceptions section" + The + .I blacklist_exceptions +@@ -667,6 +678,10 @@ The \fIWorld Wide Identification\fR of a + .B property + Regular expresion of the udev property to be whitelisted. + .TP ++.B protocol ++Regular expression of the protocol to be whitelisted. See the ++\fBblacklist section\fR for a list of recognized protocols ++.TP + .B devnode + Regular expression of the device nodes to be whitelisted. + .TP diff --git a/SOURCES/0247-RHBZ-1585824-mpathconf-allow-doc.patch b/SOURCES/0247-RHBZ-1585824-mpathconf-allow-doc.patch new file mode 100644 index 0000000..4af5baa --- /dev/null +++ b/SOURCES/0247-RHBZ-1585824-mpathconf-allow-doc.patch @@ -0,0 +1,36 @@ +--- + multipath/mpathconf.8 | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +Index: multipath-tools-130222/multipath/mpathconf.8 +=================================================================== +--- multipath-tools-130222.orig/multipath/mpathconf.8 ++++ multipath-tools-130222/multipath/mpathconf.8 +@@ -61,6 +61,16 @@ Adds a line that blacklists all device n + .B /etc/multipath.conf + blacklist section. If no blacklist section exists, it will create one. + .TP ++.B --allow \fB\fP ++Modifies the \fB/etc/multipath/conf\fP blacklist to blacklist all ++wwids and the blacklist_exceptions to whitelist \fB\fP. \fB\fP ++can be in the form of MAJOR:MINOR, a wwid, or the name of a device-mapper ++device, either a multipath device, or any device on stacked on top of one or ++more multipath devices. This command can be used multiple times to allow ++multiple devices. \fBNOTE:\fP This action will create a configuration file that ++mpathconf will not be able to revert back to its previous state. Because ++of this, \fB--outfile\fP is required when using \fB--allow\fP. ++.TP + .B --user_friendly_name \fP { \fBy\fP | \fBn\fP } + If set to \fBy\fP, this adds the line + .B user_friendly_names yes +@@ -76,6 +86,10 @@ to the + .B /etc/multipath.conf + defaults section. If set to \fBn\fP, this removes the line, if present. This + command can be used aldong with any other command. ++.TP ++.B --outfile \fB\fP ++Write the resulting multipath configuration to \fB\fP instead of ++\fB/etc/multipath.conf\fP. + .SH OPTIONS + .TP + .B --with_module\fP { \fBy\fP | \fBn\fP } diff --git a/SOURCES/0248-RHBZ-1594360-fix-param-rk-doc.patch b/SOURCES/0248-RHBZ-1594360-fix-param-rk-doc.patch new file mode 100644 index 0000000..3377c76 --- /dev/null +++ b/SOURCES/0248-RHBZ-1594360-fix-param-rk-doc.patch @@ -0,0 +1,32 @@ +--- + mpathpersist/main.c | 2 ++ + mpathpersist/mpathpersist.8 | 3 +++ + 2 files changed, 5 insertions(+) + +Index: multipath-tools-130222/mpathpersist/main.c +=================================================================== +--- multipath-tools-130222.orig/mpathpersist/main.c ++++ multipath-tools-130222/mpathpersist/main.c +@@ -677,6 +677,8 @@ static void usage() + " --out|-o request PR Out command\n" + " --param-aptpl|-Z PR Out parameter 'APTPL'\n" + " --read-keys|-k PR In: Read Keys\n" ++ " --param-rk=RK|-K RK PR Out parameter reservation " ++ "key\n" + " --param-sark=SARK|-S SARK PR Out parameter service " + "action\n" + " reservation key (SARK is in " +Index: multipath-tools-130222/mpathpersist/mpathpersist.8 +=================================================================== +--- multipath-tools-130222.orig/mpathpersist/mpathpersist.8 ++++ multipath-tools-130222/mpathpersist/mpathpersist.8 +@@ -48,6 +48,9 @@ PR Out parameter 'APTPL' + \fB\-\-read\-keys\fR|\-k + PR In: Read Keys + .TP ++\fB\-\-param\-rk\fR=\fIRK\fR|\-K RK ++PR Out parameter reservation key (RK is in hex) ++.TP + \fB\-\-param\-sark\fR=\fISARK\fR|\-S SARK + PR Out parameter service action + reservation key (SARK is in hex) diff --git a/SOURCES/0249-RHBZ-1610263-mpathpersist-max-fds.patch b/SOURCES/0249-RHBZ-1610263-mpathpersist-max-fds.patch new file mode 100644 index 0000000..4ad0525 --- /dev/null +++ b/SOURCES/0249-RHBZ-1610263-mpathpersist-max-fds.patch @@ -0,0 +1,228 @@ +--- + libmpathpersist/mpath_persist.c | 4 +++- + libmpathpersist/mpath_pr_ioctl.c | 4 +++- + libmpathpersist/mpathpr.h | 1 - + libmultipath/configure.c | 29 +++++++++++++++++++++++++++++ + libmultipath/configure.h | 1 + + mpathpersist/main.c | 8 +++++++- + multipath/main.c | 13 +------------ + multipathd/main.c | 28 +--------------------------- + 8 files changed, 45 insertions(+), 43 deletions(-) + +Index: multipath-tools-130222/libmpathpersist/mpath_persist.c +=================================================================== +--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c ++++ multipath-tools-130222/libmpathpersist/mpath_persist.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + #include "mpath_persist.h" + #include "mpathpr.h" +@@ -71,7 +72,8 @@ updatepaths (struct multipath * mpp) + + vector_foreach_slot (pgp->paths, pp, j){ + if (!strlen(pp->dev)){ +- if (devt2devname(pp->dev, pp->dev_t)){ ++ if (devt2devname(pp->dev, sizeof(pp->dev), ++ pp->dev_t)){ + /* + * path is not in sysfs anymore + */ +Index: multipath-tools-130222/libmpathpersist/mpath_pr_ioctl.c +=================================================================== +--- multipath-tools-130222.orig/libmpathpersist/mpath_pr_ioctl.c ++++ multipath-tools-130222/libmpathpersist/mpath_pr_ioctl.c +@@ -1,5 +1,6 @@ + #include + #include ++#include + + #include + #include +@@ -306,7 +307,8 @@ int prin_do_scsi_ioctl(char * dev, int r + snprintf(devname, FILE_NAME_SIZE, "/dev/%s",dev); + fd = open(devname, O_WRONLY); + if(fd < 0){ +- condlog(0, "%s: Unable to open device ", dev); ++ condlog(0, "%s: Unable to open device: %s", devname, ++ strerror(errno)); + return MPATH_PR_FILE_ERROR; + } + +Index: multipath-tools-130222/libmpathpersist/mpathpr.h +=================================================================== +--- multipath-tools-130222.orig/libmpathpersist/mpathpr.h ++++ multipath-tools-130222/libmpathpersist/mpathpr.h +@@ -54,6 +54,5 @@ int update_prkey_flags(char *mapname, ui + #define update_prkey(mapname, prkey) update_prkey_flags(mapname, prkey, 0) + void * mpath_alloc_prin_response(int prin_sa); + int update_map_pr(struct multipath *mpp); +-int devt2devname (char *devname, char *devt); + + #endif +Index: multipath-tools-130222/mpathpersist/main.c +=================================================================== +--- multipath-tools-130222.orig/mpathpersist/main.c ++++ multipath-tools-130222/mpathpersist/main.c +@@ -5,6 +5,10 @@ + #include + #include + #include ++#include ++#include ++#include ++#include + #include + #include + #include +@@ -264,7 +268,7 @@ int main (int argc, char * argv[]) + + /* set verbosity */ + noisy = (loglevel >= 3) ? 1 : hex; +- verbose = (loglevel >= 3)? 3: loglevel; ++ verbose = (loglevel >= 4)? 4 : loglevel; + + if ((prout_flag + prin_flag) == 0) + { +@@ -356,6 +360,8 @@ int main (int argc, char * argv[]) + goto out; + } + ++ set_max_fds(conf->max_fds); ++ + /* open device */ + if ((fd = open (device_name, O_WRONLY)) < 0) + { +Index: multipath-tools-130222/libmultipath/configure.c +=================================================================== +--- multipath-tools-130222.orig/libmultipath/configure.c ++++ multipath-tools-130222/libmultipath/configure.c +@@ -15,6 +15,8 @@ + #include + #include + #include ++#include ++#include + + #include "checkers.h" + #include "vector.h" +@@ -1143,3 +1145,30 @@ extern int reload_map(struct vectors *ve + + return 0; + } ++ ++void set_max_fds(int max_fds) ++{ ++ struct rlimit fd_limit; ++ ++ if (!max_fds) ++ return; ++ ++ if (getrlimit(RLIMIT_NOFILE, &fd_limit) < 0) { ++ condlog(0, "can't get open fds limit: %s", ++ strerror(errno)); ++ fd_limit.rlim_cur = 0; ++ fd_limit.rlim_max = 0; ++ } ++ if (fd_limit.rlim_cur < conf->max_fds) { ++ fd_limit.rlim_cur = conf->max_fds; ++ if (fd_limit.rlim_max < conf->max_fds) ++ fd_limit.rlim_max = conf->max_fds; ++ if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) ++ condlog(0, "can't set open fds limit to %lu/%lu : %s", ++ fd_limit.rlim_cur, fd_limit.rlim_max, ++ strerror(errno)); ++ else ++ condlog(3, "set open fds limit to %lu/%lu", ++ fd_limit.rlim_cur, fd_limit.rlim_max); ++ } ++} +Index: multipath-tools-130222/libmultipath/configure.h +=================================================================== +--- multipath-tools-130222.orig/libmultipath/configure.h ++++ multipath-tools-130222/libmultipath/configure.h +@@ -33,3 +33,4 @@ int get_refwwid (char * dev, enum devtyp + int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh); + int sysfs_get_host_adapter_name(struct path *pp, char *adapter_name); + void trigger_uevents (struct multipath *mpp); ++void set_max_fds(int max_fds); +Index: multipath-tools-130222/multipath/main.c +=================================================================== +--- multipath-tools-130222.orig/multipath/main.c ++++ multipath-tools-130222/multipath/main.c +@@ -52,8 +52,6 @@ + #include + #include + #include +-#include +-#include + #include + #include + #include "dev_t.h" +@@ -638,16 +636,7 @@ main (int argc, char *argv[]) + } + } + conf->daemon = 0; +- +- if (conf->max_fds) { +- struct rlimit fd_limit; +- +- fd_limit.rlim_cur = conf->max_fds; +- fd_limit.rlim_max = conf->max_fds; +- if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) +- condlog(0, "can't set open fds limit to %d : %s", +- conf->max_fds, strerror(errno)); +- } ++ set_max_fds(conf->max_fds); + + if (init_checkers()) { + condlog(0, "failed to initialize checkers"); +Index: multipath-tools-130222/multipathd/main.c +=================================================================== +--- multipath-tools-130222.orig/multipathd/main.c ++++ multipath-tools-130222/multipathd/main.c +@@ -12,8 +12,6 @@ + #include + #include + #include +-#include +-#include + #include + #include + #include +@@ -1946,31 +1944,7 @@ child (void * param) + + setlogmask(LOG_UPTO(conf->verbosity + 3)); + +- if (conf->max_fds) { +- struct rlimit fd_limit; +- +- if (getrlimit(RLIMIT_NOFILE, &fd_limit) < 0) { +- condlog(0, "can't get open fds limit: %s", +- strerror(errno)); +- fd_limit.rlim_cur = 0; +- fd_limit.rlim_max = 0; +- } +- if (fd_limit.rlim_cur < conf->max_fds) { +- fd_limit.rlim_cur = conf->max_fds; +- if (fd_limit.rlim_max < conf->max_fds) +- fd_limit.rlim_max = conf->max_fds; +- if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) { +- condlog(0, "can't set open fds limit to " +- "%lu/%lu : %s", +- fd_limit.rlim_cur, fd_limit.rlim_max, +- strerror(errno)); +- } else { +- condlog(3, "set open fds limit to %lu/%lu", +- fd_limit.rlim_cur, fd_limit.rlim_max); +- } +- } +- +- } ++ set_max_fds(conf->max_fds); + + vecs = gvecs = init_vecs(); + if (!vecs) { diff --git a/SPECS/device-mapper-multipath.spec b/SPECS/device-mapper-multipath.spec index ffdebf3..a2e3f50 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: 119%{?dist}.1 +Release: 123%{?dist} License: GPL+ Group: System Environment/Base URL: http://christophe.varoqui.free.fr/ @@ -243,7 +243,19 @@ Patch0233: 0233-RHBZ-1451852-1482629-nimble-config.patch Patch0234: 0234-RHBZ-1500109-doc-typo.patch Patch0235: 0235-RHBZ-1480638-NVMe-support.patch Patch0236: 0236-RHBZ-1525348-fix-msg.patch -Patch0237: 0237-RHBZ-1607749-add-transport-blacklist.patch +Patch0237: 0237-RHBZ-1526876-show-sysfs-state.patch +Patch0238: 0238-RHBZ-1508483-mpathconf-info.patch +Patch0239: 0239-RHBZ-1544958-client-timeout.patch +Patch0240: 0240-UPBZ-1568902-id_size.patch +Patch0241: 0241-RHBZ-1554516-show-path-failures.patch +Patch0242: 0242-RHBZ-1541116-all-tg-pt.patch +Patch0243: 0243-RHBZ-1498724-save-persist-options.patch +Patch0244: 0244-RHBZ-1562247-remove-rbd.patch +Patch0245: 0245-RHBZ-1584228-fix-readsector0_size.patch +Patch0246: 0246-RHBZ-1593459-add-transport-blacklist.patch +Patch0247: 0247-RHBZ-1585824-mpathconf-allow-doc.patch +Patch0248: 0248-RHBZ-1594360-fix-param-rk-doc.patch +Patch0249: 0249-RHBZ-1610263-mpathpersist-max-fds.patch # runtime Requires: %{name}-libs = %{version}-%{release} @@ -568,6 +580,18 @@ device-mapper-multipath's libdmmp C API library %patch0235 -p1 %patch0236 -p1 %patch0237 -p1 +%patch0238 -p1 +%patch0239 -p1 +%patch0240 -p1 +%patch0241 -p1 +%patch0242 -p1 +%patch0243 -p1 +%patch0244 -p1 +%patch0245 -p1 +%patch0246 -p1 +%patch0247 -p1 +%patch0248 -p1 +%patch0249 -p1 cp %{SOURCE1} . %build @@ -685,10 +709,43 @@ fi %{_pkgconfdir}/libdmmp.pc %changelog -* Tue Jul 24 2018 Benjamin Marzinski 0.4.9-119.1 -- Add 0237-RHBZ-1607749-add-transport-blacklist.patch +* Fri Aug 10 2018 Benjamin Marzinski 0.4.9-123 +- Add 0249-RHBZ-1610263-mpathpersist-max-fds.patch + * make mpathpersist honor max_fds multipath.conf parameter +- Resolves: bz #1610263 + +* Wed Aug 1 2018 Benjamin Marzinski 0.4.9-122 +- Add 0248-RHBZ-1594360-fix-param-rk-doc.patch +- Resolves: bz #1594360 + +* Thu Jun 21 2018 Benjamin Marzinski 0.4.9-121 +- Add 0245-RHBZ-1584228-fix-readsector0_size.patch + * correctly figure IO size +- Add 0246-RHBZ-1593459-add-transport-blacklist.patch * and new blacklist option, "protocol" -- Resolves: bz #1607749 +- Add 0247-RHBZ-1585824-mpathconf-allow-doc.patch +- Resolves: bz #1584228, #1585824, #1593459 + +* Wed Jun 6 2018 Benjamin Marzinski 0.4.9-120 +- Add 0237-RHBZ-1526876-show-sysfs-state.patch + * Correctly get sysfs state for multipath -l output +- Add 0238-RHBZ-1508483-mpathconf-info.patch +- Add 0239-RHBZ-1544958-client-timeout.patch + * increase maximum multipathd client reply timeout to 60 seconds +- Add 0240-UPBZ-1568902-id_size.patch + * increase maximum size of product and revision strings to deal with nvme +- Add 0241-RHBZ-1554516-show-path-failures.patch + * add a path failures multipathd path format wildcard +- Add 0242-RHBZ-1541116-all-tg-pt.patch + * add all_tg_pt configuration option to make mpathpersist send only + one registration per host +- Add 0243-RHBZ-1498724-save-persist-options.patch + * allow ":aptpl" to be added to the reservation_key to fix multipathd + aptpl persistent reservation handling +- Add 0244-RHBZ-1562247-remove-rbd.patch + * remove multipath support for rbd +- Resolves: bz #1498724, #1508483, #1526876, #1541116, #1544958, #1554516 +- Resolves: bz #1562247, #1568902 * Wed Jan 31 2018 Benjamin Marzinski 0.4.9-119 - Add 0236-RHBZ-1525348-fix-msg.patch