From eba52c6932bf2884b7a4dd6762ae3d716ae1dce0 Mon Sep 17 00:00:00 2001 From: basebuilder_pel7x64builder0 Date: Wed, 20 Jun 2018 13:31:28 +0200 Subject: [PATCH] device-mapper-multipath source patches added Signed-off-by: basebuilder_pel7x64builder0 --- .../0001-RH-dont_start_with_no_config.patch | 1 + SOURCES/0002-RH-multipath.rules.patch | 20 +- ...Make-build-system-RH-Fedora-friendly.patch | 63 +- ...-multipathd-blacklist-all-by-default.patch | 18 +- SOURCES/0005-RH-add-mpathconf.patch | 72 +-- SOURCES/0006-RH-add-find-multipaths.patch | 100 +-- SOURCES/0007-RH-add-hp_tur-checker.patch | 126 ++-- .../0008-RH-revert-partition-changes.patch | 36 +- SOURCES/0009-RH-RHEL5-style-partitions.patch | 151 ++--- .../0010-RH-dont-remove-map-on-enomem.patch | 12 +- SOURCES/0012-RH-kpartx-msg.patch | 22 +- ...3-RHBZ-883981-cleanup-rpmdiff-issues.patch | 72 +-- .../0014-RH-handle-other-sector-sizes.patch | 20 +- SOURCES/0015-RH-fix-output-buffer.patch | 10 +- .../0016-RH-dont-print-ghost-messages.patch | 12 +- SOURCES/0018-RH-fix-factorize.patch | 12 +- SOURCES/0019-RH-fix-sockets.patch | 40 +- ...0020-RHBZ-907360-static-pthread-init.patch | 23 +- ...1-RHBZ-919119-respect-kernel-cmdline.patch | 5 +- SOURCES/0022-RH-multipathd-check-wwids.patch | 11 +- SOURCES/0023-RH-multipath-wipe-wwid.patch | 112 ++-- SOURCES/0024-RH-multipath-wipe-wwids.patch | 66 +- SOURCES/0025-UPBZ-916668_add_maj_min.patch | 23 +- SOURCES/0026-fix-checker-time.patch | 14 +- SOURCES/0027-RH-get-wwid.patch | 6 +- .../0028-RHBZ-929078-refresh-udev-dev.patch | 32 +- SOURCES/0029-RH-no-prio-put-msg.patch | 10 +- ...RHBZ-916528-override-queue-no-daemon.patch | 122 ++-- .../0031-RHBZ-957188-kpartx-use-dm-name.patch | 12 +- .../0032-RHBZ-956464-mpathconf-defaults.patch | 12 +- SOURCES/0033-RHBZ-829963-e-series-conf.patch | 32 +- .../0034-RHBZ-851416-mpathconf-display.patch | 30 +- SOURCES/0035-RHBZ-891921-list-mpp.patch | 13 +- SOURCES/0037-RHBZ-768873-fix-rename.patch | 15 +- SOURCES/0038-RHBZ-799860-netapp-config.patch | 12 +- SOURCES/0039-RH-detect-prio-fix.patch | 6 +- SOURCES/0040-RH-bindings-fix.patch | 92 +-- SOURCES/0041-RH-check-for-erofs.patch | 48 +- SOURCES/0042-UP-fix-signal-handling.patch | 299 ++++----- SOURCES/0043-RH-signal-waiter.patch | 54 +- SOURCES/0044-RHBZ-976688-fix-wipe-wwids.patch | 14 +- SOURCES/0045-RHBZ-977297-man-page-fix.patch | 2 +- .../0046-RHBZ-883981-move-udev-rules.patch | 22 +- ...0047-RHBZ-kpartx-read-only-loop-devs.patch | 36 +- SOURCES/0048-RH-print-defaults.patch | 8 +- SOURCES/0049-RH-remove-ID_FS_TYPE.patch | 10 +- SOURCES/0050-RH-listing-speedup.patch | 12 +- SOURCES/0051-UP-fix-cli-resize.patch | 14 +- SOURCES/0052-RH-fix-bad-derefs.patch | 46 +- SOURCES/0053-UP-fix-failback.patch | 16 +- SOURCES/0054-UP-keep-udev-ref.patch | 225 +++---- SOURCES/0055-UP-handle-quiesced-paths.patch | 12 +- SOURCES/0056-UP-alua-prio-fix.patch | 12 +- SOURCES/0057-UP-fix-tmo.patch | 162 ++--- SOURCES/0058-UP-fix-failback.patch | 12 +- SOURCES/0059-UP-flush-failure-queueing.patch | 34 +- SOURCES/0060-UP-uevent-loop-udev.patch | 96 +-- SOURCES/0061-RH-display-find-mpaths.patch | 5 +- SOURCES/0062-RH-dont-free-vecs.patch | 25 +- SOURCES/0063-RH-fix-warning.patch | 18 +- .../0064-RHBZ-1010040-fix-ID_FS-attrs.patch | 184 +++--- ...UPBZ-995538-fail-rdac-on-unavailable.patch | 14 +- SOURCES/0066-UP-dos-4k-partition-fix.patch | 88 +-- ...-1022899-fix-udev-partition-handling.patch | 16 +- ...RHBZ-1034578-label-partition-devices.patch | 2 +- ...69-UPBZ-1033791-improve-rdac-checker.patch | 67 +- .../0070-RHBZ-1036503-blacklist-td-devs.patch | 12 +- SOURCES/0071-RHBZ-1031546-strip-dev.patch | 251 ++++---- ...0072-RHBZ-1039199-check-loop-control.patch | 26 +- SOURCES/0073-RH-update-build-flags.patch | 14 +- .../0074-RHBZ-1056976-dm-mpath-rules.patch | 22 +- SOURCES/0075-RHBZ-1056976-reload-flag.patch | 198 +++--- .../0076-RHBZ-1056686-add-hw_str_match.patch | 62 +- ...RHBZ-1054806-mpathconf-always-reload.patch | 8 +- .../0079-RHBZ-1070581-add-wwid-option.patch | 70 +-- SOURCES/0080-RHBZ-1075796-cmdline-wwid.patch | 68 +- ...-RHBZ-1066264-check-prefix-on-rename.patch | 36 +- ...09995-no-sync-turs-on-pthread_cancel.patch | 26 +- ...-RHBZ-1080055-orphan-paths-on-reload.patch | 58 +- SOURCES/0084-RHBZ-1110000-multipath-man.patch | 24 +- .../0085-UPBZ-1110006-datacore-config.patch | 12 +- ...BZ-1110007-orphan-path-on-failed-add.patch | 10 +- ...7-RHBZ-1110013-config-error-checking.patch | 40 +- ...BZ-1069811-configurable-prio-timeout.patch | 108 ++-- ...0089-RHBZ-1110016-add-noasync-option.patch | 58 +- ...080038-reorder-paths-for-round-robin.patch | 41 +- ...pty-values-fast-io-fail-and-dev-loss.patch | 36 +- .../0092-UPBZ-1104605-reload-on-rename.patch | 47 +- ...PBZ-1086825-user-friendly-name-remap.patch | 80 +-- SOURCES/0094-RHBZ-1086825-cleanup-remap.patch | 106 ++-- .../0095-RHBZ-1127944-xtremIO-config.patch | 12 +- SOURCES/0096-RHBZ-979474-new-wildcards.patch | 17 +- SOURCES/0097-RH-fix-coverity-errors.patch | 148 ++--- SOURCES/0098-UPBZ-1067171-mutipath-i.patch | 324 +++++----- SOURCES/0099-RH-add-all-devs.patch | 62 +- ...0100-RHBZ-1067171-multipath-i-update.patch | 36 +- SOURCES/0101-RH-cleanup-partmaps-code.patch | 44 +- .../0102-RHBZ-631009-deferred-remove.patch | 359 +++++------ .../0104-RHBZ-1159337-fix-double-free.patch | 12 +- SOURCES/0106-RHBZ-1169935-no-new-devs.patch | 104 ++-- SOURCES/0107-RH-adapter-name-wildcard.patch | 13 +- SOURCES/0109-RH-read-only-bindings.patch | 24 +- SOURCES/0110-RHBZ-blacklist-vd-devs.patch | 12 +- SOURCES/0111-RH-dont-show-pg-timeout.patch | 23 +- ...2-RHBZ-1194917-add-config_dir-option.patch | 410 ++++++------- SOURCES/0113-RHBZ-1194917-cleanup.patch | 66 +- ...4-RHBZ-1196394-delayed-reintegration.patch | 280 ++++----- .../0115-RHBZ-1198418-fix-double-free.patch | 11 +- SOURCES/0116-UPBZ-1188179-dell-36xxi.patch | 12 +- ...HBZ-1198424-autodetect-clariion-alua.patch | 12 +- ...8-UPBZ-1200738-update-eternus-config.patch | 12 +- .../0119-RHBZ-1081397-save-alua-info.patch | 256 ++++---- SOURCES/0120-RHBZ-1043093-realloc-fix.patch | 137 +++-- SOURCES/0122-RHBZ-1212590-dont-use-var.patch | 4 +- .../0123-UPBZ-1166072-fix-path-offline.patch | 12 +- .../0124-RHBZ-1209275-retrigger-uevents.patch | 132 ++-- SOURCES/0125-RHBZ-1153832-kpartx-delete.patch | 24 +- .../0126-RHBZ-1211383-alias-collision.patch | 66 +- .../0128-RHBZ-1222123-mpathconf-allow.patch | 111 ++-- .../0129-UPBZ-1254292-iscsi-targetname.patch | 12 +- SOURCES/0130-RHBZ-1259523-host_name_len.patch | 2 +- SOURCES/0131-UPBZ-1259831-lock-retry.patch | 24 +- SOURCES/0132-RHBZ-1296979-fix-define.patch | 8 +- ...RHBZ-1241774-sun-partition-numbering.patch | 12 +- ...0134-RHBZ-1241528-check-mpath-prefix.patch | 100 +-- .../0135-RHBZ-1299600-path-dev-uevents.patch | 61 +- .../0136-RHBZ-1304687-wait-for-map-add.patch | 270 ++++---- .../0137-RHBZ-1280524-clear-chkr-msg.patch | 12 +- ...138-RHBZ-1288660-fix-mpathconf-allow.patch | 50 +- SOURCES/0140-RHBZ-1299647-fix-help.patch | 12 +- .../0141-RHBZ-1303953-mpathpersist-typo.patch | 11 +- SOURCES/0142-RHBZ-1283750-kpartx-fix.patch | 142 ++--- SOURCES/0143-RHBZ-1299648-kpartx-sync.patch | 34 +- SOURCES/0144-RHBZ-1299652-alua-pref-arg.patch | 66 +- SOURCES/0145-UP-resize-help-msg.patch | 52 +- SOURCES/0146-UPBZ-1299651-raw-output.patch | 316 +++++----- SOURCES/0147-RHBZ-1272620-fail-rm-msg.patch | 60 +- ...48-RHBZ-1292599-verify-before-remove.patch | 70 +-- ...9-RHBZ-1292599-restore-removed-parts.patch | 93 +-- .../0150-RHBZ-1253913-fix-startup-msg.patch | 122 ++-- SOURCES/0151-RHBZ-1297456-weighted-fix.patch | 44 +- SOURCES/0153-RH-fix-i686-size-bug.patch | 102 +-- .../0154-UPBZ-1291406-disable-reinstate.patch | 122 ++-- SOURCES/0155-UPBZ-1300415-PURE-config.patch | 12 +- ...156-UPBZ-1313324-dont-fail-discovery.patch | 220 +++---- ...7-RHBZ-1319853-multipath-c-error-msg.patch | 29 +- SOURCES/0159-UPBZ-1255885-udev-waits.patch | 255 ++++---- SOURCES/0160-RH-udev-flags.patch | 7 +- SOURCES/0161-RHBZ-1311659-no-kpartx.patch | 394 ++++++------ SOURCES/0162-RHBZ-1333331-huawei-config.patch | 12 +- SOURCES/0163-UPBZ-1333492-resize-map.patch | 22 +- .../0164-RHBZ-1311463-dos-part-rollover.patch | 12 +- SOURCES/0165-UPBZ-1341748-MSA-2040-conf.patch | 12 +- ...166-RHBZ-1323429-dont-allow-new-wwid.patch | 11 +- SOURCES/0167-RHBZ-1335176-fix-show-cmds.patch | 96 +-- SOURCES/0168-RHBZ-1347769-shared-lock.patch | 12 +- SOURCES/0169-UPBZ-1353357-json-output.patch | 92 +-- SOURCES/0170-UPBZ-1352925-fix-typo.patch | 24 +- .../0171-UPBZ-1356651-allow-zero-size.patch | 46 +- SOURCES/0172-RHBZ-1350931-no-active-add.patch | 23 +- SOURCES/0174-RHBZ-1362396-modprobe.patch | 10 +- SOURCES/0176-RHBZ-1363830-fix-rename.patch | 10 +- ...tipath-correctly-initialize-pp-sg_id.patch | 15 +- .../0178-libmultipath-add-rbd-discovery.patch | 71 +-- ...s-add-checker-callout-to-repair-path.patch | 93 +-- ...0180-multipath-tools-Add-rbd-checker.patch | 20 +- ...ltipath-tools-Add-rbd-to-the-hwtable.patch | 15 +- ...check-for-initialized-checker-before.patch | 11 +- ...on-t-call-repair-on-blacklisted-path.patch | 47 +- .../0184-rbd-fix-sync-repair-support.patch | 15 +- ...0185-rbd-check-for-nonshared-clients.patch | 15 +- ...rbd-check-for-exclusive-lock-enabled.patch | 37 +- SOURCES/0187-rbd-fixup-log-messages.patch | 269 ++++---- SOURCES/0188-RHBZ-1368501-dont-exit.patch | 212 +++---- .../0189-RHBZ-1368211-remove-retries.patch | 68 +- .../0190-RHBZ-1380602-rbd-lock-on-read.patch | 36 +- ...1-RHBZ-1169168-disable-changed-paths.patch | 138 ++--- .../0192-RHBZ-1362409-infinibox-config.patch | 12 +- .../0194-RHBZ-1351964-kpartx-recurse.patch | 12 +- SOURCES/0195-RHBZ-1359510-no-daemon-msg.patch | 59 +- SOURCES/0196-RHBZ-1239173-dont-set-flag.patch | 36 +- .../0197-RHBZ-1394059-max-sectors-kb.patch | 202 +++--- ...198-RHBZ-1372032-detect-path-checker.patch | 184 +++--- .../0199-RHBZ-1279355-3pardata-config.patch | 12 +- SOURCES/0200-RHBZ-1402092-orphan-status.patch | 12 +- .../0201-RHBZ-1403552-silence-warning.patch | 36 +- SOURCES/0202-RHBZ-1362120-skip-prio.patch | 12 +- SOURCES/0203-RHBZ-1363718-add-msgs.patch | 24 +- SOURCES/0204-RHBZ-1406226-nimble-config.patch | 12 +- SOURCES/0205-RHBZ-1416569-reset-stats.patch | 34 +- SOURCES/0206-RHBZ-1239173-pt2-no-paths.patch | 30 +- SOURCES/0207-UP-add-libmpathcmd.patch | 242 ++++---- ...-UPBZ-1430097-multipathd-IPC-changes.patch | 150 ++--- .../0209-UPBZ-1430097-multipath-C-API.patch | 36 +- SOURCES/0210-RH-fix-uninstall.patch | 20 +- SOURCES/0211-RH-strlen-fix.patch | 32 +- SOURCES/0212-RHBZ-1431562-for-read-only.patch | 32 +- ...0213-RHBZ-1430908-merge-dell-configs.patch | 26 +- ...214-RHBZ-1392115-set-paths-not-ready.patch | 8 +- ...15-RHBZ-1444194-fix-check-partitions.patch | 58 +- SOURCES/0216-RHBZ-1448562-fix-reserve.patch | 98 +-- SOURCES/0217-RHBZ-1448576-3PAR-config.patch | 16 +- .../0218-RHBZ-1459370-add-feature-fix.patch | 12 +- SOURCES/0219-RHBZ-1448970-fix-resize.patch | 54 +- SOURCES/0220-RHBZ-1448223-fix-kpartx.patch | 33 +- SOURCES/0221-RH-harden-files.patch | 50 +- ...0222-RHBZ-1457288-fix-show-maps-json.patch | 16 +- SOURCES/0223-RHBZ-1452210-unpriv-sgio.patch | 196 +++--- SOURCES/0224-RHBZ-1452210-prkey.patch | 580 +++++++++--------- SOURCES/0225-RH-udevdir.patch | 24 +- SOURCES/0226-RH-allow-overrides-section.patch | 16 +- ...0227-RHBZ-1465773-fix-path-delay-msg.patch | 12 +- ...28-RHBZ-1464634-hauwei-config-update.patch | 16 +- ...29-RHBZ-1467987-poll-on-udev-monitor.patch | 12 +- SOURCES/0230-UP-allow-invalid-creates.patch | 64 +- .../0231-RHBZ-1458852-delay-readying.patch | 244 ++++---- ...0232-RHBZ-1456955-property-blacklist.patch | 280 ++++----- ...3-RHBZ-1451852-1482629-nimble-config.patch | 16 +- SOURCES/0235-RHBZ-1480638-NVMe-support.patch | 259 ++++---- SOURCES/0236-RHBZ-1525348-fix-msg.patch | 12 +- 220 files changed, 7315 insertions(+), 7270 deletions(-) diff --git a/SOURCES/0001-RH-dont_start_with_no_config.patch b/SOURCES/0001-RH-dont_start_with_no_config.patch index bbd57936..e894632e 100644 --- a/SOURCES/0001-RH-dont_start_with_no_config.patch +++ b/SOURCES/0001-RH-dont_start_with_no_config.patch @@ -13,3 +13,4 @@ Index: multipath-tools-130222/multipathd/multipathd.service +ConditionPathExists=/etc/multipath.conf DefaultDependencies=no Conflicts=shutdown.target + diff --git a/SOURCES/0002-RH-multipath.rules.patch b/SOURCES/0002-RH-multipath.rules.patch index 40d9b18d..a910dc1c 100644 --- a/SOURCES/0002-RH-multipath.rules.patch +++ b/SOURCES/0002-RH-multipath.rules.patch @@ -38,17 +38,17 @@ Index: multipath-tools-130222/multipath/Makefile +++ multipath-tools-130222/multipath/Makefile @@ -21,12 +21,15 @@ $(EXEC): $(OBJS) install: - $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) -d $(DESTDIR)/lib/udev/rules.d + $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/62-multipath.rules - $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir) - + $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) + $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir) + uninstall: + rm $(DESTDIR)/lib/udev/rules.d/62-multipath.rules - rm $(DESTDIR)$(bindir)/$(EXEC) - rm $(DESTDIR)$(mandir)/$(EXEC).8.gz - rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz + rm $(DESTDIR)$(bindir)/$(EXEC) + rm $(DESTDIR)$(mandir)/$(EXEC).8.gz + rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz diff --git a/SOURCES/0003-RH-Make-build-system-RH-Fedora-friendly.patch b/SOURCES/0003-RH-Make-build-system-RH-Fedora-friendly.patch index 09678fcb..f293c800 100644 --- a/SOURCES/0003-RH-Make-build-system-RH-Fedora-friendly.patch +++ b/SOURCES/0003-RH-Make-build-system-RH-Fedora-friendly.patch @@ -34,8 +34,8 @@ Index: multipath-tools-130222/kpartx/Makefile +++ multipath-tools-130222/kpartx/Makefile @@ -26,17 +26,17 @@ $(EXEC): $(OBJS) install: $(EXEC) $(EXEC).8 - $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir) - $(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir) - $(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d @@ -44,65 +44,66 @@ Index: multipath-tools-130222/kpartx/Makefile +# $(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir) +# $(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d +# $(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)/etc/udev/rules.d/ - $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) - + $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) + uninstall: - rm -f $(DESTDIR)$(bindir)/$(EXEC) - rm -f $(DESTDIR)$(mandir)/$(EXEC).8.gz + rm -f $(DESTDIR)$(bindir)/$(EXEC) + rm -f $(DESTDIR)$(mandir)/$(EXEC).8.gz - rm -f $(DESTDIR)$(libudevdir)/kpartx_id +# rm -f $(DESTDIR)$(libudevdir)/kpartx_id - + clean: - rm -f core *.o $(EXEC) *.gz + rm -f core *.o $(EXEC) *.gz Index: multipath-tools-130222/multipathd/Makefile =================================================================== --- multipath-tools-130222.orig/multipathd/Makefile +++ multipath-tools-130222/multipathd/Makefile @@ -35,6 +35,7 @@ install: - $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(rcdir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(rcdir) + $(INSTALL_PROGRAM) -m 755 multipathd.init.redhat $(DESTDIR)$(rcdir)/$(EXEC) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(unitdir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).service $(DESTDIR)$(unitdir) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(unitdir) + $(INSTALL_PROGRAM) -m 644 $(EXEC).service $(DESTDIR)$(unitdir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) Index: multipath-tools-130222/libmultipath/Makefile =================================================================== --- multipath-tools-130222.orig/libmultipath/Makefile +++ multipath-tools-130222/libmultipath/Makefile @@ -46,9 +46,11 @@ install: - $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir) - $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS) - $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir) + $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS) + $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir) + ln -sf $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB) - + uninstall: - rm -f $(DESTDIR)$(syslibdir)/$(LIBS) + rm -f $(DESTDIR)$(syslibdir)/$(LIBS) + rm -f $(DESTDIR)$(syslibdir)/$(DEVLIB) - + clean: - rm -f core *.a *.o *.gz *.so *.so.* + rm -f core *.a *.o *.gz *.so *.so.* Index: multipath-tools-130222/libmpathpersist/Makefile =================================================================== --- multipath-tools-130222.orig/libmpathpersist/Makefile +++ multipath-tools-130222/libmpathpersist/Makefile @@ -28,17 +28,14 @@ $(LIBS): install: $(LIBS) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir) - $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir) + $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS) - $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir) - $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(man3dir) + $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(man3dir) - $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)/usr/include/ - $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)/usr/share/doc/mpathpersist/ - ln -sf $(DESTDIR)$(syslibdir)/$(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB) + ln -sf $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB) - install -m 644 mpath_persistent_reserve_in.3.gz $(DESTDIR)$(man3dir) - install -m 644 mpath_persistent_reserve_out.3.gz $(DESTDIR)$(man3dir) + install -m 644 mpath_persistent_reserve_in.3.gz $(DESTDIR)$(man3dir) + install -m 644 mpath_persistent_reserve_out.3.gz $(DESTDIR)$(man3dir) - install -m 644 mpath_persist.h $(DESTDIR)/usr/include/ - + uninstall: - rm -f $(DESTDIR)$(syslibdir)/$(LIBS) + rm -f $(DESTDIR)$(syslibdir)/$(LIBS) + rm -f $(DESTDIR)$(syslibdir)/$(DEVLIB) - rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_in.3.gz - rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_out.3.gz + rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_in.3.gz + rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_out.3.gz + diff --git a/SOURCES/0004-RH-multipathd-blacklist-all-by-default.patch b/SOURCES/0004-RH-multipathd-blacklist-all-by-default.patch index e02055ff..2dda63c7 100644 --- a/SOURCES/0004-RH-multipathd-blacklist-all-by-default.patch +++ b/SOURCES/0004-RH-multipathd-blacklist-all-by-default.patch @@ -25,13 +25,13 @@ Index: multipath-tools-130222/libmultipath/config.c #include "prio.h" #include "devmapper.h" +#include "version.h" - + static int hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2) @@ -585,6 +586,21 @@ load_config (char * file) - - } else { - init_keywords(); + + } else { + init_keywords(); + condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices."); + condlog(0, "A default multipath.conf file is located at"); + condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE)); @@ -47,18 +47,18 @@ Index: multipath-tools-130222/libmultipath/config.c + condlog(0, "cannot store default no-config blacklist\n"); + goto out; + } - } - - /* + } + + /* Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -6,6 +6,7 @@ - + #define ORIGIN_DEFAULT 0 #define ORIGIN_CONFIG 1 +#define ORIGIN_NO_CONFIG 2 - + /* * In kernel, fast_io_fail == 0 means immediate failure on rport delete. diff --git a/SOURCES/0005-RH-add-mpathconf.patch b/SOURCES/0005-RH-add-mpathconf.patch index 58d26ca0..ce1b2c76 100644 --- a/SOURCES/0005-RH-add-mpathconf.patch +++ b/SOURCES/0005-RH-add-mpathconf.patch @@ -1,7 +1,7 @@ --- - libmultipath/config.c | 1 - multipath/Makefile | 5 - multipath/main.c | 4 + libmultipath/config.c | 1 + multipath/Makefile | 5 + multipath/main.c | 4 multipath/mpathconf | 312 ++++++++++++++++++++++++++++++++++++++++++++++++++ multipath/mpathconf.8 | 103 ++++++++++++++++ 5 files changed, 423 insertions(+), 2 deletions(-) @@ -11,62 +11,62 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -589,6 +589,7 @@ load_config (char * file) - condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices."); - condlog(0, "A default multipath.conf file is located at"); - condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE)); + condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices."); + condlog(0, "A default multipath.conf file is located at"); + condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE)); + condlog(0, "You can run /sbin/mpathconf to create or modify /etc/multipath.conf"); - if (conf->blist_devnode == NULL) { - conf->blist_devnode = vector_alloc(); - if (!conf->blist_devnode) { + if (conf->blist_devnode == NULL) { + conf->blist_devnode = vector_alloc(); + if (!conf->blist_devnode) { Index: multipath-tools-130222/multipath/Makefile =================================================================== --- multipath-tools-130222.orig/multipath/Makefile +++ multipath-tools-130222/multipath/Makefile @@ -17,22 +17,27 @@ $(EXEC): $(OBJS) - $(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) - $(GZIP) $(EXEC).8 > $(EXEC).8.gz - $(GZIP) $(EXEC).conf.5 > $(EXEC).conf.5.gz + $(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) + $(GZIP) $(EXEC).8 > $(EXEC).8.gz + $(GZIP) $(EXEC).conf.5 > $(EXEC).conf.5.gz + $(GZIP) mpathconf.8 > mpathconf.8.gz - + install: - $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ - $(INSTALL_PROGRAM) -d $(DESTDIR)/lib/udev/rules.d - $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/62-multipath.rules - $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir) + $(INSTALL_PROGRAM) -d $(DESTDIR)/lib/udev/rules.d + $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/62-multipath.rules + $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) + $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir) + $(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(mandir) - + uninstall: - rm $(DESTDIR)/lib/udev/rules.d/62-multipath.rules - rm $(DESTDIR)$(bindir)/$(EXEC) + rm $(DESTDIR)/lib/udev/rules.d/62-multipath.rules + rm $(DESTDIR)$(bindir)/$(EXEC) + rm $(DESTDIR)$(bindir)/mpathconf - rm $(DESTDIR)$(mandir)/$(EXEC).8.gz - rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz + rm $(DESTDIR)$(mandir)/$(EXEC).8.gz + rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz + rm $(DESTDIR)$(mandir)/mpathconf.8.gz - + clean: - rm -f core *.o $(EXEC) *.gz + rm -f core *.o $(EXEC) *.gz Index: multipath-tools-130222/multipath/main.c =================================================================== --- multipath-tools-130222.orig/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -433,10 +433,10 @@ main (int argc, char *argv[]) - exit(1); - } - + exit(1); + } + - if (dm_prereq()) + if (load_config(DEFAULT_CONFIGFILE)) - exit(1); - + exit(1); + - if (load_config(DEFAULT_CONFIGFILE)) + if (dm_prereq()) - exit(1); - - while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtq")) != EOF ) { + exit(1); + + while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtq")) != EOF ) { Index: multipath-tools-130222/multipath/mpathconf =================================================================== --- /dev/null diff --git a/SOURCES/0006-RH-add-find-multipaths.patch b/SOURCES/0006-RH-add-find-multipaths.patch index 40a11704..4a0c3647 100644 --- a/SOURCES/0006-RH-add-find-multipaths.patch +++ b/SOURCES/0006-RH-add-find-multipaths.patch @@ -15,32 +15,32 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -547,6 +547,7 @@ load_config (char * file) - conf->reassign_maps = DEFAULT_REASSIGN_MAPS; - conf->checkint = DEFAULT_CHECKINT; - conf->max_checkint = MAX_CHECKINT(conf->checkint); + conf->reassign_maps = DEFAULT_REASSIGN_MAPS; + conf->checkint = DEFAULT_CHECKINT; + conf->max_checkint = MAX_CHECKINT(conf->checkint); + conf->find_multipaths = DEFAULT_FIND_MULTIPATHS; - conf->fast_io_fail = DEFAULT_FAST_IO_FAIL; - conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER; - conf->detect_prio = DEFAULT_DETECT_PRIO; + conf->fast_io_fail = DEFAULT_FAST_IO_FAIL; + conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER; + conf->detect_prio = DEFAULT_DETECT_PRIO; Index: multipath-tools-130222/libmultipath/configure.c =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -508,6 +508,10 @@ coalesce_paths (struct vectors * vecs, v - - memset(empty_buff, 0, WWID_SIZE); - + + memset(empty_buff, 0, WWID_SIZE); + + /* ignore refwwid if it's empty */ + if (refwwid && !strlen(refwwid)) + refwwid = NULL; + - if (force_reload) { - vector_foreach_slot (pathvec, pp1, k) { - pp1->mpp = NULL; + if (force_reload) { + vector_foreach_slot (pathvec, pp1, k) { + pp1->mpp = NULL; @@ -537,6 +541,13 @@ coalesce_paths (struct vectors * vecs, v - if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE)) - continue; - + if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE)) + continue; + + /* If find_multipaths was selected check if the path is valid */ + if (conf->find_multipaths && !refwwid && + !should_multipath(pp1, pathvec)) { @@ -48,9 +48,9 @@ Index: multipath-tools-130222/libmultipath/configure.c + continue; + } + - /* - * at this point, we know we really got a new mp - */ + /* + * at this point, we know we really got a new mp + */ Index: multipath-tools-130222/libmultipath/defaults.h =================================================================== --- multipath-tools-130222.orig/libmultipath/defaults.h @@ -69,7 +69,7 @@ Index: multipath-tools-130222/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -585,6 +585,27 @@ def_reservation_key_handler(vector strve } - + static int +def_find_multipaths_handler(vector strvec) +{ @@ -94,10 +94,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int def_names_handler(vector strvec) { - char * buff; + char * buff; @@ -2700,6 +2721,18 @@ snprint_def_log_checker_err (char * buff } - + static int +snprint_def_find_multipaths (char * buff, int len, void * data) +{ @@ -113,22 +113,22 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_def_user_friendly_names (char * buff, int len, void * data) { - if (conf->user_friendly_names == USER_FRIENDLY_NAMES_ON) + if (conf->user_friendly_names == USER_FRIENDLY_NAMES_ON) @@ -2833,6 +2866,7 @@ init_keywords(void) - install_keyword("wwids_file", &wwids_file_handler, &snprint_def_wwids_file); - install_keyword("log_checker_err", &def_log_checker_err_handler, &snprint_def_log_checker_err); - install_keyword("reservation_key", &def_reservation_key_handler, &snprint_def_reservation_key); + install_keyword("wwids_file", &wwids_file_handler, &snprint_def_wwids_file); + install_keyword("log_checker_err", &def_log_checker_err_handler, &snprint_def_log_checker_err); + install_keyword("reservation_key", &def_reservation_key_handler, &snprint_def_reservation_key); + install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths); - install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler); - install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio); - __deprecated install_keyword("default_selector", &def_selector_handler, NULL); + install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler); + install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio); + __deprecated install_keyword("default_selector", &def_selector_handler, NULL); Index: multipath-tools-130222/libmultipath/wwids.c =================================================================== --- multipath-tools-130222.orig/libmultipath/wwids.c +++ multipath-tools-130222/libmultipath/wwids.c @@ -125,6 +125,32 @@ out: } - + int +should_multipath(struct path *pp1, vector pathvec) +{ @@ -158,7 +158,7 @@ Index: multipath-tools-130222/libmultipath/wwids.c +int remember_wwid(char *wwid) { - int ret = check_wwids_file(wwid, 1); + int ret = check_wwids_file(wwid, 1); Index: multipath-tools-130222/libmultipath/wwids.h =================================================================== --- multipath-tools-130222.orig/libmultipath/wwids.h @@ -166,24 +166,24 @@ Index: multipath-tools-130222/libmultipath/wwids.h @@ -12,6 +12,7 @@ "#\n" \ "# Valid WWIDs:\n" - + +int should_multipath(struct path *pp, vector pathvec); int remember_wwid(char *wwid); int check_wwids_file(char *wwid, int write_wwid); - + Index: multipath-tools-130222/multipath/main.c =================================================================== --- multipath-tools-130222.orig/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -333,7 +333,7 @@ configure (void) - /* - * core logic entry point - */ + /* + * core logic entry point + */ - r = coalesce_paths(&vecs, NULL, NULL, conf->force_reload); + r = coalesce_paths(&vecs, NULL, refwwid, conf->force_reload); - + out: - if (refwwid) + if (refwwid) Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c @@ -195,28 +195,28 @@ Index: multipath-tools-130222/multipathd/main.c +#include #include #include - + @@ -471,6 +472,11 @@ rescan: - return 1; - } - + return 1; + } + + if (conf->find_multipaths && + !should_multipath(pp, vecs->pathvec)) { + orphan_path(pp); + return 0; + } - condlog(4,"%s: creating new map", pp->dev); - if ((mpp = add_map_with_path(vecs, pp, 1))) { - mpp->action = ACT_CREATE; + condlog(4,"%s: creating new map", pp->dev); + if ((mpp = add_map_with_path(vecs, pp, 1))) { + mpp->action = ACT_CREATE; Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -106,6 +106,7 @@ struct config { - unsigned int dev_loss; - int log_checker_err; - int allow_queueing; + unsigned int dev_loss; + int log_checker_err; + int allow_queueing; + int find_multipaths; - uid_t uid; - gid_t gid; - mode_t mode; + uid_t uid; + gid_t gid; + mode_t mode; diff --git a/SOURCES/0007-RH-add-hp_tur-checker.patch b/SOURCES/0007-RH-add-hp_tur-checker.patch index 560ce76b..bc8d73bb 100644 --- a/SOURCES/0007-RH-add-hp_tur-checker.patch +++ b/SOURCES/0007-RH-add-hp_tur-checker.patch @@ -10,7 +10,7 @@ Index: multipath-tools-120613/libmultipath/checkers.h --- multipath-tools-120613.orig/libmultipath/checkers.h +++ multipath-tools-120613/libmultipath/checkers.h @@ -60,6 +60,7 @@ enum path_check_state { - + #define DIRECTIO "directio" #define TUR "tur" +#define HP_TUR "hp_tur" @@ -22,39 +22,39 @@ Index: multipath-tools-120613/libmultipath/checkers.h #define CHECKER_DEV_LEN 256 #define LIB_CHECKER_NAMELEN 256 +#define WWID_SIZE 128 - + struct checker { - struct list_head node; + struct list_head node; @@ -88,6 +90,7 @@ struct checker { - int disable; - char name[CHECKER_NAME_LEN]; - char message[CHECKER_MSG_LEN]; /* comm with callers */ + int disable; + char name[CHECKER_NAME_LEN]; + char message[CHECKER_MSG_LEN]; /* comm with callers */ + char wwid[WWID_SIZE]; /* LUN wwid */ - void * context; /* store for persistent data */ - void ** mpcontext; /* store for persistent data shared - multipath-wide. Use MALLOC if + void * context; /* store for persistent data */ + void ** mpcontext; /* store for persistent data shared + multipath-wide. Use MALLOC if Index: multipath-tools-120613/libmultipath/checkers/Makefile =================================================================== --- multipath-tools-120613.orig/libmultipath/checkers/Makefile +++ multipath-tools-120613/libmultipath/checkers/Makefile @@ -8,6 +8,7 @@ LIBS= \ - libcheckcciss_tur.so \ - libcheckreadsector0.so \ - libchecktur.so \ + libcheckcciss_tur.so \ + libcheckreadsector0.so \ + libchecktur.so \ + libcheckhp_tur.so \ - libcheckdirectio.so \ - libcheckemc_clariion.so \ - libcheckhp_sw.so \ + libcheckdirectio.so \ + libcheckemc_clariion.so \ + libcheckhp_sw.so \ @@ -23,6 +24,9 @@ libcheckdirectio.so: libsg.o directio.o libcheck%.so: libsg.o %.o - $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ - + $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ + +hp_tur.o: tur.c + $(CC) $(CFLAGS) -DCHECK_WWID -c -o $@ $< + install: - $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(libdir) - + $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(libdir) + Index: multipath-tools-120613/libmultipath/checkers/tur.c =================================================================== --- multipath-tools-120613.orig/libmultipath/checkers/tur.c @@ -62,7 +62,7 @@ Index: multipath-tools-120613/libmultipath/checkers/tur.c @@ -24,12 +24,101 @@ #define TUR_CMD_LEN 6 #define HEAVY_CHECK_COUNT 10 - + +#ifdef CHECK_WWID +#define MSG_TUR_UP "HP tur checker reports path is up" +#define MSG_TUR_DOWN "HP tur checker reports path is down" @@ -158,38 +158,38 @@ Index: multipath-tools-120613/libmultipath/checkers/tur.c + return (ret = 0); +} +#endif - + struct tur_checker_context { - dev_t devt; + dev_t devt; @@ -43,6 +132,7 @@ struct tur_checker_context { - pthread_cond_t active; - pthread_spinlock_t hldr_lock; - int holders; + pthread_cond_t active; + pthread_spinlock_t hldr_lock; + int holders; + char wwid[WWID_SIZE]; - char message[CHECKER_MSG_LEN]; + char message[CHECKER_MSG_LEN]; }; - + @@ -100,12 +190,15 @@ void libcheck_free (struct checker * c) #define TUR_MSG(msg, fmt, args...) snprintf(msg, CHECKER_MSG_LEN, fmt, ##args); - + int -tur_check(int fd, unsigned int timeout, char *msg) +tur_check (int fd, unsigned int timeout, char *msg, char *wwid) { - struct sg_io_hdr io_hdr; - unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; - unsigned char sense_buffer[32]; - int retry_tur = 5; + struct sg_io_hdr io_hdr; + unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; + unsigned char sense_buffer[32]; + int retry_tur = 5; +#ifdef CHECK_WWID + char new_wwid[WWID_SIZE]; +#endif - + retry: - memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); @@ -179,6 +272,24 @@ tur_check(int fd, unsigned int timeout, - TUR_MSG(msg, MSG_TUR_DOWN); - return PATH_DOWN; - } + TUR_MSG(msg, MSG_TUR_DOWN); + return PATH_DOWN; + } +#ifdef CHECK_WWID + if (!do_inq(fd, timeout, new_wwid)) { + @@ -208,47 +208,47 @@ Index: multipath-tools-120613/libmultipath/checkers/tur.c + } +up: +#endif - TUR_MSG(msg, MSG_TUR_UP); - return PATH_UP; + TUR_MSG(msg, MSG_TUR_UP); + return PATH_UP; } @@ -215,7 +326,7 @@ void *tur_thread(void *ctx) - ct->state = PATH_PENDING; - pthread_mutex_unlock(&ct->lock); - + ct->state = PATH_PENDING; + pthread_mutex_unlock(&ct->lock); + - state = tur_check(ct->fd, ct->timeout, ct->message); + state = tur_check(ct->fd, ct->timeout, ct->message, ct->wwid); - - /* TUR checker done */ - pthread_mutex_lock(&ct->lock); + + /* TUR checker done */ + pthread_mutex_lock(&ct->lock); @@ -275,7 +386,7 @@ libcheck_check (struct checker * c) - ct->devt = sb.st_rdev; - - if (c->sync) + ct->devt = sb.st_rdev; + + if (c->sync) - return tur_check(c->fd, c->timeout, c->message); + return tur_check(c->fd, c->timeout, c->message, ct->wwid); - - /* - * Async mode + + /* + * Async mode @@ -319,7 +430,8 @@ libcheck_check (struct checker * c) - pthread_mutex_unlock(&ct->lock); - condlog(3, "%d:%d: tur thread not responding, " - "using sync mode", TUR_DEVT(ct)); + pthread_mutex_unlock(&ct->lock); + condlog(3, "%d:%d: tur thread not responding, " + "using sync mode", TUR_DEVT(ct)); - return tur_check(c->fd, c->timeout, c->message); + return tur_check(c->fd, c->timeout, c->message, + ct->wwid); - } - /* Start new TUR checker */ - ct->state = PATH_UNCHECKED; + } + /* Start new TUR checker */ + ct->state = PATH_UNCHECKED; @@ -337,7 +449,8 @@ libcheck_check (struct checker * c) - ct->holders--; - condlog(3, "%d:%d: failed to start tur thread, using" - " sync mode", TUR_DEVT(ct)); + ct->holders--; + condlog(3, "%d:%d: failed to start tur thread, using" + " sync mode", TUR_DEVT(ct)); - return tur_check(c->fd, c->timeout, c->message); + return tur_check(c->fd, c->timeout, c->message, + ct->wwid); - } - pthread_attr_destroy(&attr); - tur_timeout(&tsp); + } + pthread_attr_destroy(&attr); + tur_timeout(&tsp); Index: multipath-tools-120613/multipath.conf.annotated =================================================================== --- multipath-tools-120613.orig/multipath.conf.annotated diff --git a/SOURCES/0008-RH-revert-partition-changes.patch b/SOURCES/0008-RH-revert-partition-changes.patch index dfb45337..c563b0e2 100644 --- a/SOURCES/0008-RH-revert-partition-changes.patch +++ b/SOURCES/0008-RH-revert-partition-changes.patch @@ -8,30 +8,30 @@ Index: multipath-tools-130222/kpartx/dos.c --- multipath-tools-130222.orig/kpartx/dos.c +++ multipath-tools-130222/kpartx/dos.c @@ -98,8 +98,6 @@ read_dos_pt(int fd, struct slice all, st - break; - } - if (is_extended(p.sys_type)) { + break; + } + if (is_extended(p.sys_type)) { - sp[i].size = 2; /* extended partitions only get two - sectors mapped for LILO to install */ - n += read_extended_partition(fd, &p, i, sp+n, ns-n); - } - } + n += read_extended_partition(fd, &p, i, sp+n, ns-n); + } + } Index: multipath-tools-130222/kpartx/kpartx.c =================================================================== --- multipath-tools-130222.orig/kpartx/kpartx.c +++ multipath-tools-130222/kpartx/kpartx.c @@ -516,6 +516,7 @@ main(int argc, char **argv){ - d = c; - while (c) { - for (j = 0; j < n; j++) { + d = c; + while (c) { + for (j = 0; j < n; j++) { + uint64_t start; - int k = slices[j].container - 1; - - if (slices[j].size == 0) + int k = slices[j].container - 1; + + if (slices[j].size == 0) @@ -541,9 +542,11 @@ main(int argc, char **argv){ - } - strip_slash(partname); - + } + strip_slash(partname); + - if (safe_sprintf(params, "%s %" PRIu64, - device, - slices[j].start)) { @@ -40,6 +40,6 @@ Index: multipath-tools-130222/kpartx/kpartx.c + slices[k].major, + slices[k].minor, + start)) { - fprintf(stderr, "params too small\n"); - exit(1); - } + fprintf(stderr, "params too small\n"); + exit(1); + } diff --git a/SOURCES/0009-RH-RHEL5-style-partitions.patch b/SOURCES/0009-RH-RHEL5-style-partitions.patch index 68e7478f..a2691bb0 100644 --- a/SOURCES/0009-RH-RHEL5-style-partitions.patch +++ b/SOURCES/0009-RH-RHEL5-style-partitions.patch @@ -2,7 +2,7 @@ kpartx/bsd.c | 35 --------------- kpartx/dos.c | 7 +-- kpartx/kpartx.c | 123 +++++++------------------------------------------------- - kpartx/kpartx.h | 1 + kpartx/kpartx.h | 1 kpartx/sun.c | 35 --------------- 5 files changed, 24 insertions(+), 177 deletions(-) @@ -12,21 +12,21 @@ Index: multipath-tools-130222/kpartx/bsd.c +++ multipath-tools-130222/kpartx/bsd.c @@ -50,10 +50,10 @@ int read_bsd_pt(int fd, struct slice all, struct slice *sp, int ns) { - struct bsd_disklabel *l; - struct bsd_partition *p; + struct bsd_disklabel *l; + struct bsd_partition *p; - unsigned int offset = all.start, end; + unsigned int offset = all.start; - int max_partitions; - char *bp; + int max_partitions; + char *bp; - int n = 0, i, j; + int n = 0; - - bp = getblock(fd, offset+1); /* 1 sector suffices */ - if (bp == NULL) + + bp = getblock(fd, offset+1); /* 1 sector suffices */ + if (bp == NULL) @@ -79,36 +79,5 @@ read_bsd_pt(int fd, struct slice all, st - break; - } - } + break; + } + } - /* - * Convention has it that the bsd disklabel will always have - * the 'c' partition spanning the entire disk. @@ -58,7 +58,7 @@ Index: multipath-tools-130222/kpartx/bsd.c - } - } - } - return n; + return n; } Index: multipath-tools-130222/kpartx/dos.c =================================================================== @@ -66,49 +66,49 @@ Index: multipath-tools-130222/kpartx/dos.c +++ multipath-tools-130222/kpartx/dos.c @@ -16,7 +16,7 @@ is_extended(int type) { } - + static int -read_extended_partition(int fd, struct partition *ep, int en, +read_extended_partition(int fd, struct partition *ep, - struct slice *sp, int ns) + struct slice *sp, int ns) { - struct partition p; + struct partition p; @@ -53,7 +53,6 @@ read_extended_partition(int fd, struct p - if (n < ns) { - sp[n].start = here + le32_to_cpu(p.start_sect); - sp[n].size = le32_to_cpu(p.nr_sects); + if (n < ns) { + sp[n].start = here + le32_to_cpu(p.start_sect); + sp[n].size = le32_to_cpu(p.nr_sects); - sp[n].container = en + 1; - n++; - } else { - fprintf(stderr, + n++; + } else { + fprintf(stderr, @@ -98,7 +97,9 @@ read_dos_pt(int fd, struct slice all, st - break; - } - if (is_extended(p.sys_type)) { + break; + } + if (is_extended(p.sys_type)) { - n += read_extended_partition(fd, &p, i, sp+n, ns-n); + n += read_extended_partition(fd, &p, sp+n, ns-n); + /* hide the extended partition itself */ + sp[i].size = 2; - } - } - return n; + } + } + return n; Index: multipath-tools-130222/kpartx/kpartx.c =================================================================== --- multipath-tools-130222.orig/kpartx/kpartx.c +++ multipath-tools-130222/kpartx/kpartx.c @@ -192,7 +192,7 @@ get_hotplug_device(void) - + int main(int argc, char **argv){ - int i, j, m, n, op, off, arg, c, d, ro=0; + int i, j, m, n, op, off, arg, ro=0; - int fd = -1; - struct slice all; - struct pt *ptp; + int fd = -1; + struct slice all; + struct pt *ptp; @@ -381,49 +381,30 @@ main(int argc, char **argv){ - else - continue; - + else + continue; + + /* + * test for overlap, as in the case of an extended partition + * zero their size to avoid mapping @@ -122,24 +122,24 @@ Index: multipath-tools-130222/kpartx/kpartx.c + } + } + - switch(what) { - case LIST: + switch(what) { + case LIST: - for (j = 0, c = 0, m = 0; j < n; j++) { + for (j = 0; j < n; j++) { - if (slices[j].size == 0) - continue; + if (slices[j].size == 0) + continue; - if (slices[j].container > 0) { - c++; - continue; - } - - slices[j].minor = m++; - - printf("%s%s%d : 0 %" PRIu64 " %s %" PRIu64"\n", - mapname, delim, j+1, - slices[j].size, device, - slices[j].start); - } + + printf("%s%s%d : 0 %" PRIu64 " %s %" PRIu64"\n", + mapname, delim, j+1, + slices[j].size, device, + slices[j].start); + } - /* Loop to resolve contained slices */ - d = c; - while (c) { @@ -166,31 +166,31 @@ Index: multipath-tools-130222/kpartx/kpartx.c - if (d == c) - break; - } - - break; - + + break; + @@ -462,16 +443,10 @@ main(int argc, char **argv){ - case ADD: - case UPDATE: - /* ADD and UPDATE share the same code that adds new partitions. */ + case ADD: + case UPDATE: + /* ADD and UPDATE share the same code that adds new partitions. */ - for (j = 0, c = 0; j < n; j++) { + for (j = 0; j < n; j++) { - if (slices[j].size == 0) - continue; - + if (slices[j].size == 0) + continue; + - /* Skip all contained slices */ - if (slices[j].container > 0) { - c++; - continue; - } - - if (safe_sprintf(partname, "%s%s%d", - mapname, delim, j+1)) { - fprintf(stderr, "partname too small\n"); + if (safe_sprintf(partname, "%s%s%d", + mapname, delim, j+1)) { + fprintf(stderr, "partname too small\n"); @@ -512,72 +487,6 @@ main(int argc, char **argv){ - slices[j].minor, slices[j].size, - DM_TARGET, params); - } + slices[j].minor, slices[j].size, + DM_TARGET, params); + } - /* Loop to resolve contained slices */ - d = c; - while (c) { @@ -257,20 +257,20 @@ Index: multipath-tools-130222/kpartx/kpartx.c - if (d == c) - break; - } - - if (what == ADD) { - /* Skip code that removes devmappings for deleted partitions */ + + if (what == ADD) { + /* Skip code that removes devmappings for deleted partitions */ Index: multipath-tools-130222/kpartx/kpartx.h =================================================================== --- multipath-tools-130222.orig/kpartx/kpartx.h +++ multipath-tools-130222/kpartx/kpartx.h @@ -24,7 +24,6 @@ struct slice { - uint64_t start; - uint64_t size; + uint64_t start; + uint64_t size; - int container; - int major; - int minor; + int major; + int minor; }; Index: multipath-tools-130222/kpartx/sun.c =================================================================== @@ -278,19 +278,19 @@ Index: multipath-tools-130222/kpartx/sun.c +++ multipath-tools-130222/kpartx/sun.c @@ -62,8 +62,8 @@ int read_sun_pt(int fd, struct slice all, struct slice *sp, int ns) { - struct sun_disk_label *l; - struct sun_raw_part *s; + struct sun_disk_label *l; + struct sun_raw_part *s; - unsigned int offset = all.start, end; - int i, j, n; + unsigned int offset = all.start; + int i, n; - char *bp; - - bp = getblock(fd, offset); + char *bp; + + bp = getblock(fd, offset); @@ -95,37 +95,6 @@ read_sun_pt(int fd, struct slice all, st - break; - } - } + break; + } + } - /* - * Convention has it that the SUN disklabel will always have - * the 'c' partition spanning the entire disk. @@ -322,5 +322,6 @@ Index: multipath-tools-130222/kpartx/sun.c - } - } - } - return n; + return n; } + diff --git a/SOURCES/0010-RH-dont-remove-map-on-enomem.patch b/SOURCES/0010-RH-dont-remove-map-on-enomem.patch index 346c6abb..1740c107 100644 --- a/SOURCES/0010-RH-dont-remove-map-on-enomem.patch +++ b/SOURCES/0010-RH-dont-remove-map-on-enomem.patch @@ -7,12 +7,12 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -990,7 +990,8 @@ mpvec_garbage_collector (struct vectors - return; - - vector_foreach_slot (vecs->mpvec, mpp, i) { + return; + + vector_foreach_slot (vecs->mpvec, mpp, i) { - if (mpp && mpp->alias && !dm_map_present(mpp->alias)) { + if (mpp && mpp->alias && !dm_map_present(mpp->alias) && + errno != ENOMEM) { - condlog(2, "%s: remove dead map", mpp->alias); - remove_map_and_stop_waiter(mpp, vecs, 1); - i--; + condlog(2, "%s: remove dead map", mpp->alias); + remove_map_and_stop_waiter(mpp, vecs, 1); + i--; diff --git a/SOURCES/0012-RH-kpartx-msg.patch b/SOURCES/0012-RH-kpartx-msg.patch index 1bd8a6b5..7584c840 100644 --- a/SOURCES/0012-RH-kpartx-msg.patch +++ b/SOURCES/0012-RH-kpartx-msg.patch @@ -7,18 +7,18 @@ Index: multipath-tools-130222/kpartx/lopart.c --- multipath-tools-130222.orig/kpartx/lopart.c +++ multipath-tools-130222/kpartx/lopart.c @@ -205,13 +205,13 @@ find_unused_loop_device (void) - fprintf(stderr, - "mount: Could not find any loop device, and, according to %s,\n" - " this kernel does not know about the loop device.\n" + fprintf(stderr, + "mount: Could not find any loop device, and, according to %s,\n" + " this kernel does not know about the loop device.\n" - " (If so, then recompile or `insmod loop.o'.)", + " (If so, then recompile or `modprobe loop'.)", - PROC_DEVICES); - - else - fprintf(stderr, - "mount: Could not find any loop device. Maybe this kernel does not know\n" + PROC_DEVICES); + + else + fprintf(stderr, + "mount: Could not find any loop device. Maybe this kernel does not know\n" - " about the loop device (then recompile or `insmod loop.o'), or\n" + " about the loop device (then recompile or `modprobe loop'), or\n" - " maybe /dev/loop# has the wrong major number?"); - - } else + " maybe /dev/loop# has the wrong major number?"); + + } else diff --git a/SOURCES/0013-RHBZ-883981-cleanup-rpmdiff-issues.patch b/SOURCES/0013-RHBZ-883981-cleanup-rpmdiff-issues.patch index d4d89afa..03bce174 100644 --- a/SOURCES/0013-RHBZ-883981-cleanup-rpmdiff-issues.patch +++ b/SOURCES/0013-RHBZ-883981-cleanup-rpmdiff-issues.patch @@ -14,8 +14,8 @@ Index: multipath-tools-130222/Makefile.inc --- multipath-tools-130222.orig/Makefile.inc +++ multipath-tools-130222/Makefile.inc @@ -23,15 +23,15 @@ endif - - prefix = + + prefix = exec_prefix = $(prefix) -bindir = $(exec_prefix)/sbin +bindir = $(exec_prefix)/usr/sbin @@ -31,17 +31,17 @@ Index: multipath-tools-130222/Makefile.inc +libdir = $(prefix)/usr/$(LIB)/multipath unitdir = $(prefix)/lib/systemd/system mpathpersistdir = $(TOPDIR)/libmpathpersist - + @@ -42,8 +42,9 @@ ifndef RPM_OPT_FLAGS - RPM_OPT_FLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 + RPM_OPT_FLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 endif - + +LDFLAGS += -Wl,-z,relro OPTFLAGS = $(RPM_OPT_FLAGS) -Wunused -Wstrict-prototypes -CFLAGS = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\" +CFLAGS = $(OPTFLAGS) -DLIB_STRING=\"${LIB}\" SHARED_FLAGS = -shared - + %.o: %.c Index: multipath-tools-130222/multipathd/Makefile =================================================================== @@ -57,7 +57,7 @@ Index: multipath-tools-130222/multipathd/Makefile - -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist + -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \ + -Wl,-z,now -pie - + # # debuging stuff Index: multipath-tools-130222/kpartx/Makefile @@ -67,34 +67,34 @@ Index: multipath-tools-130222/kpartx/Makefile @@ -4,7 +4,7 @@ # include ../Makefile.inc - + -CFLAGS += -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +CFLAGS += -fPIC -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 - + LIBDM_API_COOKIE = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_set_cookie' /usr/include/libdevmapper.h) - + Index: multipath-tools-130222/libmpathpersist/Makefile =================================================================== --- multipath-tools-130222.orig/libmpathpersist/Makefile +++ multipath-tools-130222/libmpathpersist/Makefile @@ -10,7 +10,7 @@ DEVLIB = libmpathpersist.so LIBS = $(DEVLIB).$(SONAME) - - --CFLAGS += -I$(multipathdir) -I$(mpathpersistdir) + + +-CFLAGS += -I$(multipathdir) -I$(mpathpersistdir) +CFLAGS += -fPIC -I$(multipathdir) -I$(mpathpersistdir) LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath - - OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o + + OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o @@ -19,7 +19,7 @@ all: $(LIBS) - - - $(LIBS): -- $(CC) -Wall -fPIC -c $(CFLAGS) *.c + + + $(LIBS): +- $(CC) -Wall -fPIC -c $(CFLAGS) *.c + $(CC) -Wall -c $(CFLAGS) *.c - $(CC) -shared $(LIBDEPS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) - ln -s $(LIBS) $(DEVLIB) - $(GZIP) mpath_persistent_reserve_in.3 > mpath_persistent_reserve_in.3.gz + $(CC) -shared $(LIBDEPS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) + ln -s $(LIBS) $(DEVLIB) + $(GZIP) mpath_persistent_reserve_in.3 > mpath_persistent_reserve_in.3.gz Index: multipath-tools-130222/libmultipath/Makefile =================================================================== --- multipath-tools-130222.orig/libmultipath/Makefile @@ -104,7 +104,7 @@ Index: multipath-tools-130222/libmultipath/Makefile LIBS = $(DEVLIB).$(SONAME) LIBDEPS = -lpthread -ldl -ldevmapper -ludev +CFLAGS += -fPIC - + OBJS = memory.o parser.o vector.o devmapper.o \ hwtable.o blacklist.o util.o dmparser.o config.o \ Index: multipath-tools-130222/libmultipath/checkers/Makefile @@ -112,37 +112,37 @@ Index: multipath-tools-130222/libmultipath/checkers/Makefile --- multipath-tools-130222.orig/libmultipath/checkers/Makefile +++ multipath-tools-130222/libmultipath/checkers/Makefile @@ -14,7 +14,7 @@ LIBS= \ - libcheckhp_sw.so \ - libcheckrdac.so - + libcheckhp_sw.so \ + libcheckrdac.so + -CFLAGS += -I.. +CFLAGS += -fPIC -I.. - + all: $(LIBS) - + Index: multipath-tools-130222/libmultipath/prioritizers/Makefile =================================================================== --- multipath-tools-130222.orig/libmultipath/prioritizers/Makefile +++ multipath-tools-130222/libmultipath/prioritizers/Makefile @@ -17,7 +17,7 @@ LIBS = \ - libprioweightedpath.so \ - libprioiet.so - + libprioweightedpath.so \ + libprioiet.so + -CFLAGS += -I.. +CFLAGS += -fPIC -I.. - + all: $(LIBS) - + Index: multipath-tools-130222/multipath/Makefile =================================================================== --- multipath-tools-130222.orig/multipath/Makefile +++ multipath-tools-130222/multipath/Makefile @@ -6,7 +6,7 @@ include ../Makefile.inc - + OBJS = main.o - + -CFLAGS += -I$(multipathdir) +CFLAGS += -fPIC -I$(multipathdir) LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath - + EXEC = multipath diff --git a/SOURCES/0014-RH-handle-other-sector-sizes.patch b/SOURCES/0014-RH-handle-other-sector-sizes.patch index 0dfa129b..d07e0d84 100644 --- a/SOURCES/0014-RH-handle-other-sector-sizes.patch +++ b/SOURCES/0014-RH-handle-other-sector-sizes.patch @@ -7,17 +7,17 @@ Index: multipath-tools-120821/kpartx/gpt.c --- multipath-tools-120821.orig/kpartx/gpt.c +++ multipath-tools-120821/kpartx/gpt.c @@ -637,6 +637,7 @@ read_gpt_pt (int fd, struct slice all, s - uint32_t i; - int n = 0; + uint32_t i; + int n = 0; int last_used_index=-1; + int sector_size_mul = get_sector_size(fd)/512; - - if (!find_valid_gpt (fd, &gpt, &ptes) || !gpt || !ptes) { - if (gpt) + + if (!find_valid_gpt (fd, &gpt, &ptes) || !gpt || !ptes) { + if (gpt) @@ -652,9 +653,11 @@ read_gpt_pt (int fd, struct slice all, s - sp[n].size = 0; - n++; - } else { + sp[n].size = 0; + n++; + } else { - sp[n].start = __le64_to_cpu(ptes[i].starting_lba); - sp[n].size = __le64_to_cpu(ptes[i].ending_lba) - - __le64_to_cpu(ptes[i].starting_lba) + 1; @@ -27,5 +27,5 @@ Index: multipath-tools-120821/kpartx/gpt.c + (__le64_to_cpu(ptes[i].ending_lba) - + __le64_to_cpu(ptes[i].starting_lba) + 1); last_used_index=n; - n++; - } + n++; + } diff --git a/SOURCES/0015-RH-fix-output-buffer.patch b/SOURCES/0015-RH-fix-output-buffer.patch index 48af5c10..ffbbaadd 100644 --- a/SOURCES/0015-RH-fix-output-buffer.patch +++ b/SOURCES/0015-RH-fix-output-buffer.patch @@ -12,7 +12,7 @@ Index: multipath-tools-130222/libmultipath/print.c #include +#include +#include - + #include "checkers.h" #include "vector.h" @@ -24,6 +26,7 @@ @@ -20,7 +20,7 @@ Index: multipath-tools-130222/libmultipath/print.c #include "devmapper.h" #include "uevent.h" +#include "debug.h" - + #define MAX(x,y) (x > y) ? x : y #define TAIL (line + len - 1 - c) @@ -754,12 +757,32 @@ snprint_pathgroup (char * line, int len, @@ -32,7 +32,7 @@ Index: multipath-tools-130222/libmultipath/print.c + char *buff = NULL; + char *old = NULL; + int len, maxlen = MAX_LINE_LEN * MAX_LINES; - + - memset(&buff[0], 0, MAX_LINE_LEN * MAX_LINES); - snprint_multipath_topology(&buff[0], MAX_LINE_LEN * MAX_LINES, - mpp, verbosity); @@ -55,8 +55,8 @@ Index: multipath-tools-130222/libmultipath/print.c + buff = REALLOC(buff, maxlen); + } + } while (resize); - printf("%s", buff); + printf("%s", buff); + FREE(buff); } - + extern int diff --git a/SOURCES/0016-RH-dont-print-ghost-messages.patch b/SOURCES/0016-RH-dont-print-ghost-messages.patch index ddbbbc47..3387424d 100644 --- a/SOURCES/0016-RH-dont-print-ghost-messages.patch +++ b/SOURCES/0016-RH-dont-print-ghost-messages.patch @@ -7,12 +7,12 @@ Index: multipath-tools-130222/libmultipath/discovery.c --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -898,7 +898,8 @@ get_state (struct path * pp, int daemon) - c->timeout = DEF_TIMEOUT; - state = checker_check(c); - condlog(3, "%s: state = %s", pp->dev, checker_state_name(state)); + c->timeout = DEF_TIMEOUT; + state = checker_check(c); + condlog(3, "%s: state = %s", pp->dev, checker_state_name(state)); - if (state != PATH_UP && strlen(checker_message(c))) + if (state != PATH_UP && state != PATH_GHOST && + strlen(checker_message(c))) - condlog(3, "%s: checker msg is \"%s\"", - pp->dev, checker_message(c)); - return state; + condlog(3, "%s: checker msg is \"%s\"", + pp->dev, checker_message(c)); + return state; diff --git a/SOURCES/0018-RH-fix-factorize.patch b/SOURCES/0018-RH-fix-factorize.patch index 16f887f6..1dfcab54 100644 --- a/SOURCES/0018-RH-fix-factorize.patch +++ b/SOURCES/0018-RH-fix-factorize.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -437,6 +437,8 @@ restart: - merge_hwe(hwe2, hwe1); - if (hwe_strmatch(hwe2, hwe1) == 0) { - vector_del_slot(hw, i); + merge_hwe(hwe2, hwe1); + if (hwe_strmatch(hwe2, hwe1) == 0) { + vector_del_slot(hw, i); + free_hwe(hwe1); + n -= 1; - /* - * Play safe here; we have modified - * the original vector so the outer + /* + * Play safe here; we have modified + * the original vector so the outer diff --git a/SOURCES/0019-RH-fix-sockets.patch b/SOURCES/0019-RH-fix-sockets.patch index b3aa916c..8639e204 100644 --- a/SOURCES/0019-RH-fix-sockets.patch +++ b/SOURCES/0019-RH-fix-sockets.patch @@ -12,37 +12,37 @@ Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c #include "memory.h" #include "../libmultipath/uxsock.h" +#include "../libmultipath/defaults.h" - + unsigned long mem_allocated; /* Total memory used in Bytes */ - + @@ -25,7 +26,7 @@ int update_prflag(char * arg1, char * ar - size_t len; - int ret = 0; - + size_t len; + int ret = 0; + - fd = ux_socket_connect("/var/run/multipathd.sock"); + fd = ux_socket_connect(DEFAULT_SOCKET); - if (fd == -1) { - condlog (0, "ux socket connect error"); - return 1 ; + if (fd == -1) { + condlog (0, "ux socket connect error"); + return 1 ; Index: multipath-tools-130222/libmultipath/uxsock.c =================================================================== --- multipath-tools-130222.orig/libmultipath/uxsock.c +++ multipath-tools-130222/libmultipath/uxsock.c @@ -31,7 +31,7 @@ int ux_socket_connect(const char *name) - memset(&addr, 0, sizeof(addr)); - addr.sun_family = AF_LOCAL; - addr.sun_path[0] = '\0'; + memset(&addr, 0, sizeof(addr)); + addr.sun_family = AF_LOCAL; + addr.sun_path[0] = '\0'; - len = strlen(name) + 1; + len = strlen(name) + 1 + sizeof(sa_family_t); - strncpy(&addr.sun_path[1], name, len); - - fd = socket(AF_LOCAL, SOCK_STREAM, 0); + strncpy(&addr.sun_path[1], name, len); + + fd = socket(AF_LOCAL, SOCK_STREAM, 0); @@ -62,7 +62,7 @@ int ux_socket_listen(const char *name) - memset(&addr, 0, sizeof(addr)); - addr.sun_family = AF_LOCAL; - addr.sun_path[0] = '\0'; + memset(&addr, 0, sizeof(addr)); + addr.sun_family = AF_LOCAL; + addr.sun_path[0] = '\0'; - len = strlen(name) + 1; + len = strlen(name) + 1 + sizeof(sa_family_t); - strncpy(&addr.sun_path[1], name, len); - - if (bind(fd, (struct sockaddr *)&addr, len) == -1) { + strncpy(&addr.sun_path[1], name, len); + + if (bind(fd, (struct sockaddr *)&addr, len) == -1) { diff --git a/SOURCES/0020-RHBZ-907360-static-pthread-init.patch b/SOURCES/0020-RHBZ-907360-static-pthread-init.patch index 2298f848..bafa5ce4 100644 --- a/SOURCES/0020-RHBZ-907360-static-pthread-init.patch +++ b/SOURCES/0020-RHBZ-907360-static-pthread-init.patch @@ -7,7 +7,7 @@ Index: multipath-tools-130222/libmultipath/uevent.c --- multipath-tools-130222.orig/libmultipath/uevent.c +++ multipath-tools-130222/libmultipath/uevent.c @@ -53,8 +53,10 @@ typedef int (uev_trigger)(struct uevent - + pthread_t uevq_thr; LIST_HEAD(uevq); -pthread_mutex_t uevq_lock, *uevq_lockp = &uevq_lock; @@ -20,21 +20,22 @@ Index: multipath-tools-130222/libmultipath/uevent.c void * my_trigger_data; int servicing_uev; @@ -409,10 +411,6 @@ int uevent_listen(void) - * thereby not getting to empty the socket's receive buffer queue - * often enough. - */ + * thereby not getting to empty the socket's receive buffer queue + * often enough. + */ - INIT_LIST_HEAD(&uevq); - - pthread_mutex_init(uevq_lockp, NULL); - pthread_cond_init(uev_condp, NULL); - pthread_cleanup_push(uevq_stop, NULL); - - monitor = udev_monitor_new_from_netlink(conf->udev, "udev"); + pthread_cleanup_push(uevq_stop, NULL); + + monitor = udev_monitor_new_from_netlink(conf->udev, "udev"); @@ -525,8 +523,6 @@ out: - if (need_failback) - err = failback_listen(); - pthread_cleanup_pop(1); + if (need_failback) + err = failback_listen(); + pthread_cleanup_pop(1); - pthread_mutex_destroy(uevq_lockp); - pthread_cond_destroy(uev_condp); - return err; + return err; } + diff --git a/SOURCES/0021-RHBZ-919119-respect-kernel-cmdline.patch b/SOURCES/0021-RHBZ-919119-respect-kernel-cmdline.patch index f144cf02..cea1e484 100644 --- a/SOURCES/0021-RHBZ-919119-respect-kernel-cmdline.patch +++ b/SOURCES/0021-RHBZ-919119-respect-kernel-cmdline.patch @@ -10,12 +10,12 @@ Index: multipath-tools-130222/multipath/multipath.rules @@ -2,6 +2,8 @@ # so name them after their devmap name SUBSYSTEM!="block", GOTO="end_mpath" - + +IMPORT{cmdline}="nompath" +ENV{nompath}=="?*", GOTO="end_mpath" ENV{MPATH_SBIN_PATH}="/sbin" TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin" - + Index: multipath-tools-130222/multipathd/multipathd.service =================================================================== --- multipath-tools-130222.orig/multipathd/multipathd.service @@ -27,3 +27,4 @@ Index: multipath-tools-130222/multipathd/multipathd.service +ConditionKernelCommandLine=!nompath DefaultDependencies=no Conflicts=shutdown.target + diff --git a/SOURCES/0022-RH-multipathd-check-wwids.patch b/SOURCES/0022-RH-multipathd-check-wwids.patch index 24a9fbc5..b6e8f42c 100644 --- a/SOURCES/0022-RH-multipathd-check-wwids.patch +++ b/SOURCES/0022-RH-multipathd-check-wwids.patch @@ -7,9 +7,10 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -1363,6 +1363,7 @@ configure (struct vectors * vecs, int st - - sync_maps_state(mpvec); - vector_foreach_slot(mpvec, mpp, i){ + + sync_maps_state(mpvec); + vector_foreach_slot(mpvec, mpp, i){ + remember_wwid(mpp->wwid); - update_map_pr(mpp); - } + update_map_pr(mpp); + } + diff --git a/SOURCES/0023-RH-multipath-wipe-wwid.patch b/SOURCES/0023-RH-multipath-wipe-wwid.patch index 7a284f39..6de04bf4 100644 --- a/SOURCES/0023-RH-multipath-wipe-wwid.patch +++ b/SOURCES/0023-RH-multipath-wipe-wwid.patch @@ -1,7 +1,7 @@ --- libmultipath/discovery.c | 3 + libmultipath/wwids.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++ - libmultipath/wwids.h | 1 + libmultipath/wwids.h | 1 multipath/main.c | 26 ++++++++++++-- multipath/multipath.8 | 5 ++ 5 files changed, 115 insertions(+), 6 deletions(-) @@ -11,22 +11,22 @@ Index: multipath-tools-130222/libmultipath/discovery.c --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -53,7 +53,8 @@ store_pathinfo (vector pathvec, vector h - goto out; - } - pp->udev = udev_device_ref(udevice); + goto out; + } + pp->udev = udev_device_ref(udevice); - err = pathinfo(pp, hwtable, flag | DI_BLACKLIST); + err = pathinfo(pp, hwtable, + (conf->dry_run == 3)? flag : (flag | DI_BLACKLIST)); - if (err) - goto out; - + if (err) + goto out; + Index: multipath-tools-130222/libmultipath/wwids.c =================================================================== --- multipath-tools-130222.orig/libmultipath/wwids.c +++ multipath-tools-130222/libmultipath/wwids.c @@ -82,6 +82,92 @@ write_out_wwid(int fd, char *wwid) { } - + int +do_remove_wwid(int fd, char *str) { + char buf[4097]; @@ -116,7 +116,7 @@ Index: multipath-tools-130222/libmultipath/wwids.c +int check_wwids_file(char *wwid, int write_wwid) { - int fd, can_write, found, ret; + int fd, can_write, found, ret; Index: multipath-tools-130222/libmultipath/wwids.h =================================================================== --- multipath-tools-130222.orig/libmultipath/wwids.h @@ -126,7 +126,7 @@ Index: multipath-tools-130222/libmultipath/wwids.h int remember_wwid(char *wwid); int check_wwids_file(char *wwid, int write_wwid); +int remove_wwid(char *wwid); - + #endif /* _WWIDS_H */ Index: multipath-tools-130222/multipath/main.c =================================================================== @@ -134,42 +134,42 @@ Index: multipath-tools-130222/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -83,7 +83,7 @@ usage (char * progname) { - fprintf (stderr, VERSION_STRING); - fprintf (stderr, "Usage:\n"); + fprintf (stderr, VERSION_STRING); + fprintf (stderr, "Usage:\n"); - fprintf (stderr, " %s [-c] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); + fprintf (stderr, " %s [-c|-w] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); - fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); - fprintf (stderr, " %s -F [-v lvl]\n", progname); - fprintf (stderr, " %s -t\n", progname); + fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); + fprintf (stderr, " %s -F [-v lvl]\n", progname); + fprintf (stderr, " %s -t\n", progname); @@ -104,6 +104,7 @@ usage (char * progname) - " -B treat the bindings file as read only\n" \ - " -p policy failover|multibus|group_by_serial|group_by_prio\n" \ - " -b fil bindings file location\n" \ + " -B treat the bindings file as read only\n" \ + " -p policy failover|multibus|group_by_serial|group_by_prio\n" \ + " -b fil bindings file location\n" \ + " -w remove a device from the wwids file\n" \ - " -p pol force all maps to specified path grouping policy :\n" \ - " . failover one path per priority group\n" \ - " . multibus all paths in one priority group\n" \ + " -p pol force all maps to specified path grouping policy :\n" \ + " . failover one path per priority group\n" \ + " . multibus all paths in one priority group\n" \ @@ -212,7 +213,6 @@ get_dm_mpvec (vector curmp, vector pathv - - if (!conf->dry_run) - reinstate_paths(mpp); + + if (!conf->dry_run) + reinstate_paths(mpp); - remember_wwid(mpp->wwid); - } - return 0; + } + return 0; } @@ -262,7 +262,7 @@ configure (void) - /* - * if we have a blacklisted device parameter, exit early - */ + /* + * if we have a blacklisted device parameter, exit early + */ - if (dev && conf->dev_type == DEV_DEVNODE && + if (dev && conf->dev_type == DEV_DEVNODE && conf->dry_run != 3 && - (filter_devnode(conf->blist_devnode, - conf->elist_devnode, dev) > 0)) { - if (conf->dry_run == 2) + (filter_devnode(conf->blist_devnode, + conf->elist_devnode, dev) > 0)) { + if (conf->dry_run == 2) @@ -284,6 +284,17 @@ configure (void) - condlog(3, "scope is nul"); - goto out; - } + condlog(3, "scope is nul"); + goto out; + } + if (conf->dry_run == 3) { + r = remove_wwid(refwwid); + if (r == 0) @@ -181,39 +181,39 @@ Index: multipath-tools-130222/multipath/main.c + } + goto out; + } - condlog(3, "scope limited to %s", refwwid); - if (conf->dry_run == 2) { - if (check_wwids_file(refwwid, 0) == 0){ + condlog(3, "scope limited to %s", refwwid); + if (conf->dry_run == 2) { + if (check_wwids_file(refwwid, 0) == 0){ @@ -439,7 +450,7 @@ main (int argc, char *argv[]) - if (dm_prereq()) - exit(1); - + if (dm_prereq()) + exit(1); + - while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtq")) != EOF ) { + while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtqw")) != EOF ) { - switch(arg) { - case 1: printf("optarg : %s\n",optarg); - break; + switch(arg) { + case 1: printf("optarg : %s\n",optarg); + break; @@ -504,6 +515,9 @@ main (int argc, char *argv[]) - case 'h': - usage(argv[0]); - exit(0); + case 'h': + usage(argv[0]); + exit(0); + case 'w': + conf->dry_run = 3; + break; - case ':': - fprintf(stderr, "Missing option argument\n"); - usage(argv[0]); + case ':': + fprintf(stderr, "Missing option argument\n"); + usage(argv[0]); @@ -555,6 +569,10 @@ main (int argc, char *argv[]) - condlog(0, "the -c option requires a path to check"); - goto out; - } + condlog(0, "the -c option requires a path to check"); + goto out; + } + if (conf->dry_run == 3 && !conf->dev) { + condlog(0, "the -w option requires a device"); + goto out; + } - if (conf->remove == FLUSH_ONE) { - if (conf->dev_type == DEV_DEVMAP) { - r = dm_suspend_and_flush_map(conf->dev); + if (conf->remove == FLUSH_ONE) { + if (conf->dev_type == DEV_DEVMAP) { + r = dm_suspend_and_flush_map(conf->dev); Index: multipath-tools-130222/multipath/multipath.8 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.8 diff --git a/SOURCES/0024-RH-multipath-wipe-wwids.patch b/SOURCES/0024-RH-multipath-wipe-wwids.patch index 6c7431b1..b91836c6 100644 --- a/SOURCES/0024-RH-multipath-wipe-wwids.patch +++ b/SOURCES/0024-RH-multipath-wipe-wwids.patch @@ -11,7 +11,7 @@ Index: multipath-tools-130222/libmultipath/wwids.c +++ multipath-tools-130222/libmultipath/wwids.c @@ -82,6 +82,50 @@ write_out_wwid(int fd, char *wwid) { } - + int +replace_wwids(vector mp) +{ @@ -58,8 +58,8 @@ Index: multipath-tools-130222/libmultipath/wwids.c + +int do_remove_wwid(int fd, char *str) { - char buf[4097]; - char *ptr; + char buf[4097]; + char *ptr; Index: multipath-tools-130222/libmultipath/wwids.h =================================================================== --- multipath-tools-130222.orig/libmultipath/wwids.h @@ -69,7 +69,7 @@ Index: multipath-tools-130222/libmultipath/wwids.h int check_wwids_file(char *wwid, int write_wwid); int remove_wwid(char *wwid); +int replace_wwids(vector mp); - + #endif /* _WWIDS_H */ Index: multipath-tools-130222/multipath/main.c =================================================================== @@ -77,44 +77,44 @@ Index: multipath-tools-130222/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -83,7 +83,7 @@ usage (char * progname) { - fprintf (stderr, VERSION_STRING); - fprintf (stderr, "Usage:\n"); + fprintf (stderr, VERSION_STRING); + fprintf (stderr, "Usage:\n"); - fprintf (stderr, " %s [-c|-w] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); + fprintf (stderr, " %s [-c|-w|-W] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); - fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); - fprintf (stderr, " %s -F [-v lvl]\n", progname); - fprintf (stderr, " %s -t\n", progname); + fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); + fprintf (stderr, " %s -F [-v lvl]\n", progname); + fprintf (stderr, " %s -t\n", progname); @@ -105,6 +105,7 @@ usage (char * progname) - " -p policy failover|multibus|group_by_serial|group_by_prio\n" \ - " -b fil bindings file location\n" \ - " -w remove a device from the wwids file\n" \ + " -p policy failover|multibus|group_by_serial|group_by_prio\n" \ + " -b fil bindings file location\n" \ + " -w remove a device from the wwids file\n" \ + " -W reset the wwids file include only the current devices\n" \ - " -p pol force all maps to specified path grouping policy :\n" \ - " . failover one path per priority group\n" \ - " . multibus all paths in one priority group\n" \ + " -p pol force all maps to specified path grouping policy :\n" \ + " . failover one path per priority group\n" \ + " . multibus all paths in one priority group\n" \ @@ -450,7 +451,7 @@ main (int argc, char *argv[]) - if (dm_prereq()) - exit(1); - + if (dm_prereq()) + exit(1); + - while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtqw")) != EOF ) { + while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtqwW")) != EOF ) { - switch(arg) { - case 1: printf("optarg : %s\n",optarg); - break; + switch(arg) { + case 1: printf("optarg : %s\n",optarg); + break; @@ -518,6 +519,9 @@ main (int argc, char *argv[]) - case 'w': - conf->dry_run = 3; - break; + case 'w': + conf->dry_run = 3; + break; + case 'W': + conf->dry_run = 4; + break; - case ':': - fprintf(stderr, "Missing option argument\n"); - usage(argv[0]); + case ':': + fprintf(stderr, "Missing option argument\n"); + usage(argv[0]); @@ -573,6 +577,27 @@ main (int argc, char *argv[]) - condlog(0, "the -w option requires a device"); - goto out; - } + condlog(0, "the -w option requires a device"); + goto out; + } + if (conf->dry_run == 4) { + struct multipath * mpp; + int i; @@ -136,9 +136,9 @@ Index: multipath-tools-130222/multipath/main.c + vector_free(curmp); + goto out; + } - if (conf->remove == FLUSH_ONE) { - if (conf->dev_type == DEV_DEVMAP) { - r = dm_suspend_and_flush_map(conf->dev); + if (conf->remove == FLUSH_ONE) { + if (conf->dev_type == DEV_DEVMAP) { + r = dm_suspend_and_flush_map(conf->dev); Index: multipath-tools-130222/multipath/multipath.8 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.8 diff --git a/SOURCES/0025-UPBZ-916668_add_maj_min.patch b/SOURCES/0025-UPBZ-916668_add_maj_min.patch index 2cda8454..615533de 100644 --- a/SOURCES/0025-UPBZ-916668_add_maj_min.patch +++ b/SOURCES/0025-UPBZ-916668_add_maj_min.patch @@ -7,22 +7,23 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -537,7 +537,8 @@ rescan: - goto fail_map; - - if (retries >= 0) { + goto fail_map; + + if (retries >= 0) { - condlog(2, "%s path added to devmap %s", pp->dev, mpp->alias); + condlog(2, "%s [%s]: path added to devmap %s", + pp->dev, pp->dev_t, mpp->alias); - return 0; - } - else + return 0; + } + else @@ -642,8 +643,8 @@ ev_remove_path (struct path *pp, struct - } - sync_map_state(mpp); - + } + sync_map_state(mpp); + - condlog(2, "%s: path removed from map %s", - pp->dev, mpp->alias); + condlog(2, "%s [%s]: path removed from map %s", + pp->dev, pp->dev_t, mpp->alias); - } - } + } + } + diff --git a/SOURCES/0026-fix-checker-time.patch b/SOURCES/0026-fix-checker-time.patch index f1590b18..e05ef581 100644 --- a/SOURCES/0026-fix-checker-time.patch +++ b/SOURCES/0026-fix-checker-time.patch @@ -7,17 +7,17 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -1226,11 +1226,10 @@ check_path (struct vectors * vecs, struc - pp->checkint = 2 * pp->checkint; - else - pp->checkint = conf->max_checkint; + pp->checkint = 2 * pp->checkint; + else + pp->checkint = conf->max_checkint; - - pp->tick = pp->checkint; - condlog(4, "%s: delay next check %is", - pp->dev_t, pp->tick); - } + } + pp->tick = pp->checkint; + condlog(4, "%s: delay next check %is", + pp->dev_t, pp->tick); - } - } - else if (newstate == PATH_DOWN) { + } + } + else if (newstate == PATH_DOWN) { diff --git a/SOURCES/0027-RH-get-wwid.patch b/SOURCES/0027-RH-get-wwid.patch index 974f6679..04217b46 100644 --- a/SOURCES/0027-RH-get-wwid.patch +++ b/SOURCES/0027-RH-get-wwid.patch @@ -12,6 +12,6 @@ Index: multipath-tools-130222/libmultipath/structs_vec.c { - if (mpp->wwid) + if (strlen(mpp->wwid)) - return; - - dm_get_uuid(mpp->alias, mpp->wwid); + return; + + dm_get_uuid(mpp->alias, mpp->wwid); diff --git a/SOURCES/0028-RHBZ-929078-refresh-udev-dev.patch b/SOURCES/0028-RHBZ-929078-refresh-udev-dev.patch index 614b50ac..c14ddb55 100644 --- a/SOURCES/0028-RHBZ-929078-refresh-udev-dev.patch +++ b/SOURCES/0028-RHBZ-929078-refresh-udev-dev.patch @@ -8,14 +8,14 @@ Index: multipath-tools-130222/libmultipath/discovery.c --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -1034,7 +1034,7 @@ pathinfo (struct path *pp, vector hwtabl - } - } - + } + } + - if (path_state == PATH_UP && (mask & DI_WWID) && !strlen(pp->wwid)) + if ((mask & DI_WWID) && !strlen(pp->wwid)) - get_uid(pp); - if (mask & DI_BLACKLIST && mask & DI_WWID) { - if (filter_wwid(conf->blist_wwid, conf->elist_wwid, + get_uid(pp); + if (mask & DI_BLACKLIST && mask & DI_WWID) { + if (filter_wwid(conf->blist_wwid, conf->elist_wwid, Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c @@ -23,16 +23,16 @@ Index: multipath-tools-130222/multipathd/main.c @@ -376,7 +376,7 @@ static int uev_add_path (struct uevent *uev, struct vectors * vecs) { - struct path *pp; + struct path *pp; - int ret; + int ret, i; - - condlog(2, "%s: add path (uevent)", uev->kernel); - if (strstr(uev->kernel, "..") != NULL) { + + condlog(2, "%s: add path (uevent)", uev->kernel); + if (strstr(uev->kernel, "..") != NULL) { @@ -393,6 +393,23 @@ uev_add_path (struct uevent *uev, struct - uev->kernel); - if (pp->mpp) - return 0; + uev->kernel); + if (pp->mpp) + return 0; + if (!strlen(pp->wwid)) { + udev_device_unref(pp->udev); + pp->udev = udev_device_ref(uev->udev); @@ -50,6 +50,6 @@ Index: multipath-tools-130222/multipathd/main.c + return 1; + } + } - } else { - /* - * get path vital state + } else { + /* + * get path vital state diff --git a/SOURCES/0029-RH-no-prio-put-msg.patch b/SOURCES/0029-RH-no-prio-put-msg.patch index 32a76386..6ebdae0a 100644 --- a/SOURCES/0029-RH-no-prio-put-msg.patch +++ b/SOURCES/0029-RH-no-prio-put-msg.patch @@ -7,14 +7,14 @@ Index: multipath-tools-130222/libmultipath/prio.c --- multipath-tools-130222.orig/libmultipath/prio.c +++ multipath-tools-130222/libmultipath/prio.c @@ -162,7 +162,10 @@ void prio_put (struct prio * dst) - if (!dst) - return; - + if (!dst) + return; + - src = prio_lookup(dst->name); + if (!strlen(dst->name)) + src = NULL; + else + src = prio_lookup(dst->name); - memset(dst, 0x0, sizeof(struct prio)); - free_prio(src); + memset(dst, 0x0, sizeof(struct prio)); + free_prio(src); } diff --git a/SOURCES/0030-RHBZ-916528-override-queue-no-daemon.patch b/SOURCES/0030-RHBZ-916528-override-queue-no-daemon.patch index 8613bddc..e663dedc 100644 --- a/SOURCES/0030-RHBZ-916528-override-queue-no-daemon.patch +++ b/SOURCES/0030-RHBZ-916528-override-queue-no-daemon.patch @@ -14,32 +14,32 @@ Index: multipath-tools-130222/libmultipath/dict.c --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -438,14 +438,11 @@ def_queue_without_daemon(vector strvec) - if (!buff) - return 1; - + if (!buff) + return 1; + - if (!strncmp(buff, "off", 3) || !strncmp(buff, "no", 2) || - !strncmp(buff, "0", 1)) - conf->queue_without_daemon = QUE_NO_DAEMON_OFF; - else if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) || + if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) || - !strncmp(buff, "1", 1)) - conf->queue_without_daemon = QUE_NO_DAEMON_ON; - else + !strncmp(buff, "1", 1)) + conf->queue_without_daemon = QUE_NO_DAEMON_ON; + else - conf->queue_without_daemon = QUE_NO_DAEMON_UNDEF; + conf->queue_without_daemon = QUE_NO_DAEMON_OFF; - - free(buff); - return 0; + + free(buff); + return 0; @@ -2670,8 +2667,9 @@ snprint_def_queue_without_daemon (char * - case QUE_NO_DAEMON_OFF: - return snprintf(buff, len, "\"no\""); - case QUE_NO_DAEMON_ON: + case QUE_NO_DAEMON_OFF: + return snprintf(buff, len, "\"no\""); + case QUE_NO_DAEMON_ON: - case QUE_NO_DAEMON_UNDEF: - return snprintf(buff, len, "\"yes\""); + return snprintf(buff, len, "\"yes\""); + case QUE_NO_DAEMON_FORCE: + return snprintf(buff, len, "\"forced\""); - } - return 0; + } + return 0; } Index: multipath-tools-130222/libmultipath/structs.h =================================================================== @@ -47,48 +47,48 @@ Index: multipath-tools-130222/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -67,9 +67,9 @@ enum pgstates { }; - + enum queue_without_daemon_states { - QUE_NO_DAEMON_UNDEF, - QUE_NO_DAEMON_OFF, - QUE_NO_DAEMON_ON, + QUE_NO_DAEMON_OFF, + QUE_NO_DAEMON_ON, + QUE_NO_DAEMON_FORCE, }; - + enum pgtimeouts { Index: multipath-tools-130222/multipathd/cli.c =================================================================== --- multipath-tools-130222.orig/multipathd/cli.c +++ multipath-tools-130222/multipathd/cli.c @@ -162,6 +162,7 @@ load_keys (void) - r += add_key(keys, "resize", RESIZE, 0); - r += add_key(keys, "reset", RESET, 0); - r += add_key(keys, "reload", RELOAD, 0); + r += add_key(keys, "resize", RESIZE, 0); + r += add_key(keys, "reset", RESET, 0); + r += add_key(keys, "reload", RELOAD, 0); + r += add_key(keys, "forcequeueing", FORCEQ, 0); - r += add_key(keys, "disablequeueing", DISABLEQ, 0); - r += add_key(keys, "restorequeueing", RESTOREQ, 0); - r += add_key(keys, "paths", PATHS, 0); + r += add_key(keys, "disablequeueing", DISABLEQ, 0); + r += add_key(keys, "restorequeueing", RESTOREQ, 0); + r += add_key(keys, "paths", PATHS, 0); @@ -459,6 +460,8 @@ cli_init (void) { - add_handler(GETPRSTATUS+MAP, NULL); - add_handler(SETPRSTATUS+MAP, NULL); - add_handler(UNSETPRSTATUS+MAP, NULL); + add_handler(GETPRSTATUS+MAP, NULL); + add_handler(SETPRSTATUS+MAP, NULL); + add_handler(UNSETPRSTATUS+MAP, NULL); + add_handler(FORCEQ+DAEMON, NULL); + add_handler(RESTOREQ+DAEMON, NULL); - - return 0; + + return 0; } Index: multipath-tools-130222/multipathd/cli.h =================================================================== --- multipath-tools-130222.orig/multipathd/cli.h +++ multipath-tools-130222/multipathd/cli.h @@ -10,6 +10,7 @@ enum { - __RESIZE, - __RESET, - __RELOAD, + __RESIZE, + __RESET, + __RELOAD, + __FORCEQ, - __DISABLEQ, - __RESTOREQ, - __PATHS, + __DISABLEQ, + __RESTOREQ, + __PATHS, @@ -45,6 +46,7 @@ enum { #define RESIZE (1 << __RESIZE) #define RESET (1 << __RESET) @@ -103,7 +103,7 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -628,6 +628,24 @@ cli_resize(void *v, char **reply, int *l } - + int +cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data) +{ @@ -125,7 +125,7 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c +int cli_restore_queueing(void *v, char **reply, int *len, void *data) { - struct vectors * vecs = (struct vectors *)data; + struct vectors * vecs = (struct vectors *)data; Index: multipath-tools-130222/multipathd/cli_handlers.h =================================================================== --- multipath-tools-130222.orig/multipathd/cli_handlers.h @@ -144,57 +144,57 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -904,6 +904,8 @@ uxlsnrloop (void * ap) - set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus); - set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus); - set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus); + set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus); + set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus); + set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus); + set_handler_callback(FORCEQ+DAEMON, cli_force_no_daemon_q); + set_handler_callback(RESTOREQ+DAEMON, cli_restore_no_daemon_q); - - umask(077); - uxsock_listen(&uxsock_trigger, ap); + + umask(077); + uxsock_listen(&uxsock_trigger, ap); Index: multipath-tools-130222/multipathd/multipathd.init.redhat =================================================================== --- multipath-tools-130222.orig/multipathd/multipathd.init.redhat +++ multipath-tools-130222/multipathd/multipathd.init.redhat @@ -81,23 +81,28 @@ force_stop() { - echo + echo } - + -stop() { +check_root() { root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/mtab) - dm_num=`dmsetup info -c --noheadings -o minor $root_dev 2> /dev/null` - if [ $? -eq 0 ]; then - root_dm_device="dm-$dm_num" - [ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device - fi + dm_num=`dmsetup info -c --noheadings -o minor $root_dev 2> /dev/null` + if [ $? -eq 0 ]; then + root_dm_device="dm-$dm_num" + [ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device + fi +} - + - force_stop +force_queue_without_daemon() { + $DAEMON forcequeueing daemon } - + restart() { - stop + force_queue_without_daemon + check_root + force_stop - start + start } - + force_restart() { + force_queue_without_daemon - force_stop - start + force_stop + start } @@ -115,7 +120,8 @@ start) - start - ;; + start + ;; stop) - stop + check_root + force_stop - ;; + ;; force-stop) - force_stop + force_stop diff --git a/SOURCES/0031-RHBZ-957188-kpartx-use-dm-name.patch b/SOURCES/0031-RHBZ-957188-kpartx-use-dm-name.patch index 08829967..282c517c 100644 --- a/SOURCES/0031-RHBZ-957188-kpartx-use-dm-name.patch +++ b/SOURCES/0031-RHBZ-957188-kpartx-use-dm-name.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/kpartx/kpartx.c --- multipath-tools-130222.orig/kpartx/kpartx.c +++ multipath-tools-130222/kpartx/kpartx.c @@ -348,7 +348,7 @@ main(int argc, char **argv){ - if (delim == NULL) { - delim = malloc(DELIM_SIZE); - memset(delim, 0, DELIM_SIZE); + if (delim == NULL) { + delim = malloc(DELIM_SIZE); + memset(delim, 0, DELIM_SIZE); - set_delimiter(device, delim); + set_delimiter(mapname, delim); - } - - fd = open(device, O_RDONLY); + } + + fd = open(device, O_RDONLY); diff --git a/SOURCES/0032-RHBZ-956464-mpathconf-defaults.patch b/SOURCES/0032-RHBZ-956464-mpathconf-defaults.patch index f33efe2c..d63c32e2 100644 --- a/SOURCES/0032-RHBZ-956464-mpathconf-defaults.patch +++ b/SOURCES/0032-RHBZ-956464-mpathconf-defaults.patch @@ -7,13 +7,13 @@ Index: multipath-tools-130222/multipath/mpathconf --- multipath-tools-130222.orig/multipath/mpathconf +++ multipath-tools-130222/multipath/mpathconf @@ -31,8 +31,8 @@ function usage - echo "Commands:" - echo "Enable: --enable " - echo "Disable: --disable" + echo "Commands:" + echo "Enable: --enable " + echo "Disable: --disable" - echo "Set user_friendly_names (Default n): --user_friendly_names " - echo "Set find_multipaths (Default n): --find_multipaths " + echo "Set user_friendly_names (Default y): --user_friendly_names " + echo "Set find_multipaths (Default y): --find_multipaths " - echo "Load the dm-multipath modules on enable (Default y): --with_module " - echo "start/stop/reload multipathd (Default n): --with_multipathd " - echo "" + echo "Load the dm-multipath modules on enable (Default y): --with_module " + echo "start/stop/reload multipathd (Default n): --with_multipathd " + echo "" diff --git a/SOURCES/0033-RHBZ-829963-e-series-conf.patch b/SOURCES/0033-RHBZ-829963-e-series-conf.patch index 4674d125..d8fc1192 100644 --- a/SOURCES/0033-RHBZ-829963-e-series-conf.patch +++ b/SOURCES/0033-RHBZ-829963-e-series-conf.patch @@ -13,32 +13,32 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -1046,9 +1046,13 @@ static struct hwentry default_hw[] = { - .checker_name = RDAC, - .prio_name = PRIO_RDAC, - }, + .checker_name = RDAC, + .prio_name = PRIO_RDAC, + }, - /* LSI/Engenio/NetApp E-Series RDAC storage */ + /* LSI/Engenio/NetApp E-Series RDAC storage + * + * Maintainer : Sean Stewart + * Mail : sean.stewart@netapp.com + */ - { + { - .vendor = "(LSI|ENGENIO)", + .vendor = "(NETAPP|LSI|ENGENIO)", - .product = "INF-01-00", - .bl_product = "Universal Xport", - .features = "2 pg_init_retries 50", + .product = "INF-01-00", + .bl_product = "Universal Xport", + .features = "2 pg_init_retries 50", @@ -1056,10 +1060,12 @@ static struct hwentry default_hw[] = { - .pgpolicy = GROUP_BY_PRIO, - .pgfailback = -FAILBACK_IMMEDIATE, - .rr_weight = RR_WEIGHT_NONE, + .pgpolicy = GROUP_BY_PRIO, + .pgfailback = -FAILBACK_IMMEDIATE, + .rr_weight = RR_WEIGHT_NONE, - .no_path_retry = 15, + .no_path_retry = 30, - .checker_name = RDAC, - .prio_name = PRIO_RDAC, - .prio_args = NULL, + .checker_name = RDAC, + .prio_name = PRIO_RDAC, + .prio_args = NULL, + .detect_prio = DETECT_PRIO_ON, + .retain_hwhandler = RETAIN_HWHANDLER_ON, - }, - { - .vendor = "STK", + }, + { + .vendor = "STK", diff --git a/SOURCES/0034-RHBZ-851416-mpathconf-display.patch b/SOURCES/0034-RHBZ-851416-mpathconf-display.patch index 1a78f89c..e9e00ceb 100644 --- a/SOURCES/0034-RHBZ-851416-mpathconf-display.patch +++ b/SOURCES/0034-RHBZ-851416-mpathconf-display.patch @@ -8,17 +8,17 @@ Index: multipath-tools-130222/multipath/mpathconf +++ multipath-tools-130222/multipath/mpathconf @@ -159,7 +159,7 @@ if [ -z "$MODULE" -o "$MODULE" = "y" ]; fi - + if [ "$MULTIPATHD" = "y" ]; then - if service multipathd status > /dev/null ; then + if /bin/systemctl status multipathd.service > /dev/null 2>&1 ; then - HAVE_MULTIPATHD=1 - else - HAVE_MULTIPATHD=0 + HAVE_MULTIPATHD=1 + else + HAVE_MULTIPATHD=0 @@ -210,8 +210,17 @@ if [ -n "$SHOW_STATUS" ]; then - echo "dm_multipath module is not loaded" - fi - fi + echo "dm_multipath module is not loaded" + fi + fi - if [ -n "$HAVE_MULTIPATHD" ]; then - service multipathd status + if [ -z "$HAVE_MULTIPATHD" ]; then @@ -32,21 +32,21 @@ Index: multipath-tools-130222/multipath/mpathconf + echo "multipathd is running" + else + echo "multipathd is not running" - fi - exit 0 + fi + exit 0 fi @@ -301,12 +310,12 @@ if [ "$ENABLE" = 1 ]; then - modprobe dm_multipath - fi - if [ "$HAVE_MULTIPATHD" = 0 ]; then + modprobe dm_multipath + fi + if [ "$HAVE_MULTIPATHD" = 0 ]; then - service multipathd start + systemctl start multipathd.service - fi + fi elif [ "$ENABLE" = 0 ]; then - if [ "$HAVE_MULTIPATHD" = 1 ]; then + if [ "$HAVE_MULTIPATHD" = 1 ]; then - service multipathd stop + systemctl stop multipathd.service - fi + fi elif [ -n "$CHANGED_CONFIG" -a "$HAVE_MULTIPATHD" = 1 ]; then - service multipathd reload + systemctl reload multipathd.service diff --git a/SOURCES/0035-RHBZ-891921-list-mpp.patch b/SOURCES/0035-RHBZ-891921-list-mpp.patch index f6eb0e3e..b0bb7a25 100644 --- a/SOURCES/0035-RHBZ-891921-list-mpp.patch +++ b/SOURCES/0035-RHBZ-891921-list-mpp.patch @@ -8,7 +8,7 @@ Index: multipath-tools-130222/libmultipath/print.c +++ multipath-tools-130222/libmultipath/print.c @@ -422,6 +422,16 @@ snprint_path_serial (char * buff, size_t } - + static int +snprint_path_mpp (char * buff, size_t len, struct path * pp) +{ @@ -22,11 +22,12 @@ Index: multipath-tools-130222/libmultipath/print.c +static int snprint_path_checker (char * buff, size_t len, struct path * pp) { - struct checker * c = &pp->checker; + struct checker * c = &pp->checker; @@ -464,6 +474,7 @@ struct path_data pd[] = { - {'p', "pri", 0, snprint_pri}, - {'S', "size", 0, snprint_path_size}, - {'z', "serial", 0, snprint_path_serial}, + {'p', "pri", 0, snprint_pri}, + {'S', "size", 0, snprint_path_size}, + {'z', "serial", 0, snprint_path_serial}, + {'m', "multipath", 0, snprint_path_mpp}, - {0, NULL, 0 , NULL} + {0, NULL, 0 , NULL} }; + diff --git a/SOURCES/0037-RHBZ-768873-fix-rename.patch b/SOURCES/0037-RHBZ-768873-fix-rename.patch index a2ba162b..7e05bd07 100644 --- a/SOURCES/0037-RHBZ-768873-fix-rename.patch +++ b/SOURCES/0037-RHBZ-768873-fix-rename.patch @@ -9,9 +9,9 @@ Index: multipath-tools-130222/libmultipath/devmapper.c --- multipath-tools-130222.orig/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -917,51 +917,6 @@ out: - return r; + return r; } - + -extern char * -dm_get_name(char *uuid) -{ @@ -77,10 +77,11 @@ Index: multipath-tools-130222/libmultipath/propsel.c --- multipath-tools-130222.orig/libmultipath/propsel.c +++ multipath-tools-130222/libmultipath/propsel.c @@ -263,8 +263,6 @@ select_alias (struct multipath * mp) - conf->bindings_file, mp->alias_prefix, conf->bindings_read_only); - } - if (mp->alias == NULL) + conf->bindings_file, mp->alias_prefix, conf->bindings_read_only); + } + if (mp->alias == NULL) - mp->alias = dm_get_name(mp->wwid); - if (mp->alias == NULL) - mp->alias = STRDUP(mp->wwid); - } + mp->alias = STRDUP(mp->wwid); + } + diff --git a/SOURCES/0038-RHBZ-799860-netapp-config.patch b/SOURCES/0038-RHBZ-799860-netapp-config.patch index 80430766..3b91f9ba 100644 --- a/SOURCES/0038-RHBZ-799860-netapp-config.patch +++ b/SOURCES/0038-RHBZ-799860-netapp-config.patch @@ -7,10 +7,10 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -794,6 +794,7 @@ static struct hwentry default_hw[] = { - .prio_name = PRIO_ONTAP, - .prio_args = NULL, - .retain_hwhandler = RETAIN_HWHANDLER_ON, + .prio_name = PRIO_ONTAP, + .prio_args = NULL, + .retain_hwhandler = RETAIN_HWHANDLER_ON, + .user_friendly_names = USER_FRIENDLY_NAMES_OFF, - .detect_prio = DETECT_PRIO_ON, - }, - /* + .detect_prio = DETECT_PRIO_ON, + }, + /* diff --git a/SOURCES/0039-RH-detect-prio-fix.patch b/SOURCES/0039-RH-detect-prio-fix.patch index 32e12f29..941a5708 100644 --- a/SOURCES/0039-RH-detect-prio-fix.patch +++ b/SOURCES/0039-RH-detect-prio-fix.patch @@ -11,8 +11,8 @@ Index: multipath-tools-130222/libmultipath/propsel.c detect_prio(struct path * pp) { + int ret; - struct prio *p = &pp->prio; - + struct prio *p = &pp->prio; + - if (get_target_port_group_support(pp->fd) > 0) - prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS); + if (get_target_port_group_support(pp->fd) <= 0) @@ -24,5 +24,5 @@ Index: multipath-tools-130222/libmultipath/propsel.c + return; + prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS); } - + extern int diff --git a/SOURCES/0040-RH-bindings-fix.patch b/SOURCES/0040-RH-bindings-fix.patch index ff87cf26..c56f352a 100644 --- a/SOURCES/0040-RH-bindings-fix.patch +++ b/SOURCES/0040-RH-bindings-fix.patch @@ -7,58 +7,58 @@ Index: multipath-tools-130222/libmultipath/alias.c --- multipath-tools-130222.orig/libmultipath/alias.c +++ multipath-tools-130222/libmultipath/alias.c @@ -46,11 +46,11 @@ format_devname(char *name, int id, int l - memset(name,0, len); - strcpy(name, prefix); - for (pos = len - 1; pos >= prefix_len; pos--) { + memset(name,0, len); + strcpy(name, prefix); + for (pos = len - 1; pos >= prefix_len; pos--) { + id--; - name[pos] = 'a' + id % 26; - if (id < 26) - break; - id /= 26; + name[pos] = 'a' + id % 26; + if (id < 26) + break; + id /= 26; - id--; - } - memmove(name + prefix_len, name + pos, len - pos); - name[prefix_len + len - pos] = '\0'; + } + memmove(name + prefix_len, name + pos, len - pos); + name[prefix_len + len - pos] = '\0'; @@ -66,13 +66,22 @@ scan_devname(char *alias, char *prefix) - if (!prefix || strncmp(alias, prefix, strlen(prefix))) - return -1; - + if (!prefix || strncmp(alias, prefix, strlen(prefix))) + return -1; + + if (strlen(alias) == strlen(prefix)) -+ return -1; ++ return -1; + + if (strlen(alias) > strlen(prefix) + 7) + /* id of 'aaaaaaaa' overflows int */ + return -1; + - c = alias + strlen(prefix); - while (*c != '\0' && *c != ' ' && *c != '\t') { + c = alias + strlen(prefix); + while (*c != '\0' && *c != ' ' && *c != '\t') { + if (*c < 'a' || *c > 'z') + return -1; - i = *c - 'a'; - n = ( n * 26 ) + i; + i = *c - 'a'; + n = ( n * 26 ) + i; + if (n < 0) + return -1; - c++; + c++; - if (*c < 'a' || *c > 'z') - break; - n++; - } - + n++; + } + @@ -84,7 +93,9 @@ lookup_binding(FILE *f, char *map_wwid, { - char buf[LINE_MAX]; - unsigned int line_nr = 0; + char buf[LINE_MAX]; + unsigned int line_nr = 0; - int id = 0; + int id = 1; + int biggest_id = 1; + int smallest_bigger_id = INT_MAX; - - *map_alias = NULL; - + + *map_alias = NULL; + @@ -100,8 +111,12 @@ lookup_binding(FILE *f, char *map_wwid, - if (!alias) /* blank line */ - continue; - curr_id = scan_devname(alias, prefix); + if (!alias) /* blank line */ + continue; + curr_id = scan_devname(alias, prefix); - if (curr_id >= id) - id = curr_id + 1; + if (curr_id == id) @@ -67,18 +67,18 @@ Index: multipath-tools-130222/libmultipath/alias.c + biggest_id = curr_id; + if (curr_id > id && curr_id < smallest_bigger_id) + smallest_bigger_id = curr_id; - wwid = strtok(NULL, " \t"); - if (!wwid){ - condlog(3, + wwid = strtok(NULL, " \t"); + if (!wwid){ + condlog(3, @@ -116,11 +131,17 @@ lookup_binding(FILE *f, char *map_wwid, - if (*map_alias == NULL) - condlog(0, "Cannot copy alias from bindings " - "file : %s", strerror(errno)); + if (*map_alias == NULL) + condlog(0, "Cannot copy alias from bindings " + "file : %s", strerror(errno)); - return id; + return 0; - } - } - condlog(3, "No matching wwid [%s] in bindings file.", map_wwid); + } + } + condlog(3, "No matching wwid [%s] in bindings file.", map_wwid); - return id; + if (id < 0) { + condlog(0, "no more available user_friendly_names"); @@ -88,14 +88,14 @@ Index: multipath-tools-130222/libmultipath/alias.c + return id; + return biggest_id + 1; } - + static int @@ -254,7 +275,7 @@ get_user_friendly_alias(char *wwid, char - return NULL; - } - + return NULL; + } + - if (!alias && can_write && !bindings_read_only) + if (!alias && can_write && !bindings_read_only && id) - alias = allocate_binding(fd, wwid, id, prefix); - - fclose(f); + alias = allocate_binding(fd, wwid, id, prefix); + + fclose(f); diff --git a/SOURCES/0041-RH-check-for-erofs.patch b/SOURCES/0041-RH-check-for-erofs.patch index b707f98a..d29d78d6 100644 --- a/SOURCES/0041-RH-check-for-erofs.patch +++ b/SOURCES/0041-RH-check-for-erofs.patch @@ -9,38 +9,38 @@ Index: multipath-tools-130222/libmultipath/configure.c --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -384,24 +384,17 @@ domap (struct multipath * mpp, char * pa - - r = dm_addmap_create(mpp, params); - + + r = dm_addmap_create(mpp, params); + - if (!r) - r = dm_addmap_create_ro(mpp, params); - - lock_multipath(mpp, 0); - break; - - case ACT_RELOAD: - r = dm_addmap_reload(mpp, params); + lock_multipath(mpp, 0); + break; + + case ACT_RELOAD: + r = dm_addmap_reload(mpp, params); - if (!r) - r = dm_addmap_reload_ro(mpp, params); - if (r) - r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias); - break; - - case ACT_RESIZE: - r = dm_addmap_reload(mpp, params); + if (r) + r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias); + break; + + case ACT_RESIZE: + r = dm_addmap_reload(mpp, params); - if (!r) - r = dm_addmap_reload_ro(mpp, params); - if (r) - r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1); - break; + if (r) + r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1); + break; Index: multipath-tools-130222/libmultipath/devmapper.c =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -298,42 +298,39 @@ dm_addmap (int task, const char *target, - return r; + return r; } - + -static int -_dm_addmap_create (struct multipath *mpp, char * params, int ro) { - int r; @@ -73,14 +73,14 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + } + if (err != EROFS) + break; - } + } - return r; + return 0; } - + #define ADDMAP_RW 0 #define ADDMAP_RO 1 - + extern int -dm_addmap_create (struct multipath *mpp, char *params) { - return _dm_addmap_create(mpp, params, ADDMAP_RW); @@ -102,9 +102,9 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + return 1; + if (errno != EROFS) + return 0; - return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RO); + return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RO); } - + Index: multipath-tools-130222/libmultipath/devmapper.h =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.h diff --git a/SOURCES/0042-UP-fix-signal-handling.patch b/SOURCES/0042-UP-fix-signal-handling.patch index b365f05b..4b4b40bf 100644 --- a/SOURCES/0042-UP-fix-signal-handling.patch +++ b/SOURCES/0042-UP-fix-signal-handling.patch @@ -1,7 +1,7 @@ --- libmultipath/file.c | 4 +- libmultipath/lock.c | 9 ---- - libmultipath/lock.h | 1 + libmultipath/lock.h | 1 libmultipath/log_pthread.c | 22 ----------- libmultipath/waiter.c | 2 - multipathd/cli_handlers.c | 4 +- @@ -16,22 +16,22 @@ Index: multipath-tools-130222/libmultipath/file.c --- multipath-tools-130222.orig/libmultipath/file.c +++ multipath-tools-130222/libmultipath/file.c @@ -98,7 +98,7 @@ lock_file(int fd, char *file_name) - sigaddset(&set, SIGALRM); - - sigaction(SIGALRM, &act, &oldact); + sigaddset(&set, SIGALRM); + + sigaction(SIGALRM, &act, &oldact); - sigprocmask(SIG_UNBLOCK, &set, &oldset); + pthread_sigmask(SIG_UNBLOCK, &set, &oldset); - - alarm(FILE_TIMEOUT); - err = fcntl(fd, F_SETLKW, &lock); + + alarm(FILE_TIMEOUT); + err = fcntl(fd, F_SETLKW, &lock); @@ -112,7 +112,7 @@ lock_file(int fd, char *file_name) - condlog(0, "%s is locked. Giving up.", file_name); - } - + condlog(0, "%s is locked. Giving up.", file_name); + } + - sigprocmask(SIG_SETMASK, &oldset, NULL); + pthread_sigmask(SIG_SETMASK, &oldset, NULL); - sigaction(SIGALRM, &oldact, NULL); - return err; + sigaction(SIGALRM, &oldact, NULL); + return err; } Index: multipath-tools-130222/libmultipath/lock.c =================================================================== @@ -42,7 +42,7 @@ Index: multipath-tools-130222/libmultipath/lock.c -#include #include "lock.h" #include - + -void block_signal (int signum, sigset_t *old) -{ - sigset_t set; @@ -53,26 +53,26 @@ Index: multipath-tools-130222/libmultipath/lock.c - void cleanup_lock (void * data) { - unlock ((*(struct mutex_lock *)data)); + unlock ((*(struct mutex_lock *)data)); Index: multipath-tools-130222/libmultipath/lock.h =================================================================== --- multipath-tools-130222.orig/libmultipath/lock.h +++ multipath-tools-130222/libmultipath/lock.h @@ -29,6 +29,5 @@ struct mutex_lock { #endif - + void cleanup_lock (void * data); -void block_signal(int signum, sigset_t *old); - + #endif /* _LOCK_H */ Index: multipath-tools-130222/libmultipath/log_pthread.c =================================================================== --- multipath-tools-130222.orig/libmultipath/log_pthread.c +++ multipath-tools-130222/libmultipath/log_pthread.c @@ -22,26 +22,13 @@ pthread_cond_t logev_cond; - + int logq_running; - + -static void -sigusr1 (int sig) -{ @@ -85,55 +85,55 @@ Index: multipath-tools-130222/libmultipath/log_pthread.c { - sigset_t old; - - if (log_thr == (pthread_t)0) { - syslog(prio, fmt, ap); - return; - } - + if (log_thr == (pthread_t)0) { + syslog(prio, fmt, ap); + return; + } + - block_signal(SIGUSR1, &old); - block_signal(SIGHUP, NULL); - - pthread_mutex_lock(&logq_lock); - log_enqueue(prio, fmt, ap); - pthread_mutex_unlock(&logq_lock); + pthread_mutex_lock(&logq_lock); + log_enqueue(prio, fmt, ap); + pthread_mutex_unlock(&logq_lock); @@ -49,8 +36,6 @@ void log_safe (int prio, const char * fm - pthread_mutex_lock(&logev_lock); - pthread_cond_signal(&logev_cond); - pthread_mutex_unlock(&logev_lock); + pthread_mutex_lock(&logev_lock); + pthread_cond_signal(&logev_cond); + pthread_mutex_unlock(&logev_lock); - - pthread_sigmask(SIG_SETMASK, &old, NULL); } - + void log_thread_flush (void) @@ -81,15 +66,8 @@ static void flush_logqueue (void) - + static void * log_thread (void * et) { - struct sigaction sig; - int running; - + int running; + - sig.sa_handler = sigusr1; - sigemptyset(&sig.sa_mask); - sig.sa_flags = 0; - if (sigaction(SIGUSR1, &sig, NULL) < 0) - logdbg(stderr, "Cannot set signal handler"); - - pthread_mutex_lock(&logev_lock); - logq_running = 1; - pthread_mutex_unlock(&logev_lock); + pthread_mutex_lock(&logev_lock); + logq_running = 1; + pthread_mutex_unlock(&logev_lock); Index: multipath-tools-130222/libmultipath/waiter.c =================================================================== --- multipath-tools-130222.orig/libmultipath/waiter.c +++ multipath-tools-130222/libmultipath/waiter.c @@ -157,8 +157,6 @@ void *waitevent (void *et) - waiter = (struct event_thread *)et; - pthread_cleanup_push(free_waiter, et); - + waiter = (struct event_thread *)et; + pthread_cleanup_push(free_waiter, et); + - block_signal(SIGUSR1, NULL); - block_signal(SIGHUP, NULL); - while (1) { - r = waiteventloop(waiter); - + while (1) { + r = waiteventloop(waiter); + Index: multipath-tools-130222/multipathd/cli_handlers.c =================================================================== --- multipath-tools-130222.orig/multipathd/cli_handlers.c @@ -141,13 +141,13 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c @@ -939,8 +939,8 @@ int cli_shutdown (void * v, char ** reply, int * len, void * data) { - condlog(3, "shutdown (operator)"); + condlog(3, "shutdown (operator)"); - - return exit_daemon(0); + exit_daemon(); + return 0; } - + int Index: multipath-tools-130222/multipathd/main.c =================================================================== @@ -159,27 +159,27 @@ Index: multipath-tools-130222/multipathd/main.c #include +#include #include - + /* @@ -52,6 +53,7 @@ #include #include #include +#include - + #include "main.h" #include "pidfile.h" @@ -81,13 +83,11 @@ struct mpath_event_param - + unsigned int mpath_mx_alloc_len; - + -pthread_cond_t exit_cond = PTHREAD_COND_INITIALIZER; -pthread_mutex_t exit_mutex = PTHREAD_MUTEX_INITIALIZER; - int logsink; enum daemon_status running_state; pid_t daemon_pid; - + +static sem_t exit_sem; /* * global copy of vecs for use in sig handlers @@ -191,9 +191,9 @@ Index: multipath-tools-130222/multipathd/main.c - block_signal(SIGUSR1, NULL); - block_signal(SIGHUP, NULL); - - if (uevent_listen()) - condlog(0, "error starting uevent listener"); - + if (uevent_listen()) + condlog(0, "error starting uevent listener"); + @@ -850,9 +847,6 @@ ueventloop (void * ap) static void * uevqloop (void * ap) @@ -201,9 +201,9 @@ Index: multipath-tools-130222/multipathd/main.c - block_signal(SIGUSR1, NULL); - block_signal(SIGHUP, NULL); - - if (uevent_dispatch(&uev_trigger, ap)) - condlog(0, "error starting uevent dispatcher"); - + if (uevent_dispatch(&uev_trigger, ap)) + condlog(0, "error starting uevent dispatcher"); + @@ -861,9 +855,6 @@ uevqloop (void * ap) static void * uxlsnrloop (void * ap) @@ -211,13 +211,13 @@ Index: multipath-tools-130222/multipathd/main.c - block_signal(SIGUSR1, NULL); - block_signal(SIGHUP, NULL); - - if (cli_init()) - return NULL; - + if (cli_init()) + return NULL; + @@ -913,18 +904,10 @@ uxlsnrloop (void * ap) - return NULL; + return NULL; } - + -int -exit_daemon (int status) +void @@ -234,36 +234,36 @@ Index: multipath-tools-130222/multipathd/main.c - return status; + sem_post(&exit_sem); } - + const char * @@ -1287,7 +1270,6 @@ checkerloop (void *ap) - struct path *pp; - int count = 0; - unsigned int i; + struct path *pp; + int count = 0; + unsigned int i; - sigset_t old; - - mlockall(MCL_CURRENT | MCL_FUTURE); - vecs = (struct vectors *)ap; + + mlockall(MCL_CURRENT | MCL_FUTURE); + vecs = (struct vectors *)ap; @@ -1301,7 +1283,6 @@ checkerloop (void *ap) - } - - while (1) { + } + + while (1) { - block_signal(SIGHUP, &old); - pthread_cleanup_push(cleanup_lock, &vecs->lock); - lock(vecs->lock); - pthread_testcancel(); + pthread_cleanup_push(cleanup_lock, &vecs->lock); + lock(vecs->lock); + pthread_testcancel(); @@ -1325,7 +1306,6 @@ checkerloop (void *ap) - } - - lock_cleanup_pop(vecs->lock); + } + + lock_cleanup_pop(vecs->lock); - pthread_sigmask(SIG_SETMASK, &old, NULL); - sleep(1); - } - return NULL; + sleep(1); + } + return NULL; @@ -1485,36 +1465,56 @@ signal_set(int signo, void (*func) (int) - return (osig.sa_handler); + return (osig.sa_handler); } - + +void +handle_signals(void) +{ @@ -301,21 +301,21 @@ Index: multipath-tools-130222/multipathd/main.c -#endif + reconfig_sig = 1; } - + static void sigend (int sig) { - exit_daemon(0); + exit_daemon(); } - + static void sigusr1 (int sig) { - condlog(3, "SIGUSR1 received"); + log_reset_sig = 1; } - + static void signal_init(void) { @@ -326,65 +326,65 @@ Index: multipath-tools-130222/multipathd/main.c + sigaddset(&set, SIGUSR1); + pthread_sigmask(SIG_BLOCK, &set, NULL); + - signal_set(SIGHUP, sighup); - signal_set(SIGUSR1, sigusr1); - signal_set(SIGINT, sigend); + signal_set(SIGHUP, sighup); + signal_set(SIGUSR1, sigusr1); + signal_set(SIGINT, sigend); @@ -1587,10 +1587,11 @@ child (void * param) - struct vectors * vecs; - struct multipath * mpp; - int i; + struct vectors * vecs; + struct multipath * mpp; + int i; - sigset_t set; - int rc, pid_rc; - - mlockall(MCL_CURRENT | MCL_FUTURE); + int rc, pid_rc; + + mlockall(MCL_CURRENT | MCL_FUTURE); + sem_init(&exit_sem, 0, 0); + signal_init(); - - setup_thread_attr(&misc_attr, 64 * 1024, 1); - setup_thread_attr(&waiter_attr, 32 * 1024, 1); + + setup_thread_attr(&misc_attr, 64 * 1024, 1); + setup_thread_attr(&waiter_attr, 32 * 1024, 1); @@ -1650,7 +1651,6 @@ child (void * param) - if (!vecs) - exit(1); - + if (!vecs) + exit(1); + - signal_init(); - setscheduler(); - set_oom_adj(); - + setscheduler(); + set_oom_adj(); + @@ -1693,25 +1693,17 @@ child (void * param) - } - pthread_attr_destroy(&misc_attr); - + } + pthread_attr_destroy(&misc_attr); + - pthread_mutex_lock(&exit_mutex); - /* Startup complete, create logfile */ - pid_rc = pidfile_create(DEFAULT_PIDFILE, daemon_pid); - /* Ignore errors, we can live without */ - - running_state = DAEMON_RUNNING; + /* Startup complete, create logfile */ + pid_rc = pidfile_create(DEFAULT_PIDFILE, daemon_pid); + /* Ignore errors, we can live without */ + + running_state = DAEMON_RUNNING; - pthread_cond_wait(&exit_cond, &exit_mutex); - /* Need to block these to avoid deadlocking */ - sigemptyset(&set); - sigaddset(&set, SIGTERM); - sigaddset(&set, SIGINT); - pthread_sigmask(SIG_BLOCK, &set, NULL); - - /* - * exit path - */ + + /* + * exit path + */ + while(sem_wait(&exit_sem) != 0); /* Do nothing */ - running_state = DAEMON_SHUTDOWN; + running_state = DAEMON_SHUTDOWN; - pthread_sigmask(SIG_UNBLOCK, &set, NULL); - block_signal(SIGHUP, NULL); - lock(vecs->lock); - if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF) - vector_foreach_slot(vecs->mpvec, mpp, i) + lock(vecs->lock); + if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF) + vector_foreach_slot(vecs->mpvec, mpp, i) Index: multipath-tools-130222/multipathd/main.h =================================================================== --- multipath-tools-130222.orig/multipathd/main.h +++ multipath-tools-130222/multipathd/main.h @@ -16,7 +16,7 @@ struct prin_resp; - + extern pid_t daemon_pid; - + -int exit_daemon(int); +void exit_daemon(void); const char * daemon_status(void); @@ -395,7 +395,7 @@ Index: multipath-tools-130222/multipathd/main.h int update_map_pr(struct multipath *mpp); void * mpath_pr_event_handler_fn (void * pathp ); +void handle_signals(void); - + #endif /* MAIN_H */ Index: multipath-tools-130222/multipathd/uxlsnr.c =================================================================== @@ -424,69 +424,70 @@ Index: multipath-tools-130222/multipathd/uxlsnr.c +#include #include #include - + +#include "main.h" #include "cli.h" #include "uxlsnr.h" - + -#define SLEEP_TIME 5000 +struct timespec sleep_time = {5, 0}; - + struct client { - int fd; + int fd; @@ -42,6 +44,8 @@ struct client { static struct client *clients; static unsigned num_clients; struct pollfd *polls; +volatile sig_atomic_t reconfig_sig = 0; +volatile sig_atomic_t log_reset_sig = 0; - + /* * handle a new client joining @@ -104,6 +108,7 @@ void * uxsock_listen(int (*uxsock_trigge - int rlen; - char *inbuf; - char *reply; + int rlen; + char *inbuf; + char *reply; + sigset_t mask; - - ux_sock = ux_socket_listen(DEFAULT_SOCKET); - + + ux_sock = ux_socket_listen(DEFAULT_SOCKET); + @@ -115,7 +120,9 @@ void * uxsock_listen(int (*uxsock_trigge - pthread_cleanup_push(uxsock_cleanup, NULL); - - polls = (struct pollfd *)MALLOC(0); + pthread_cleanup_push(uxsock_cleanup, NULL); + + polls = (struct pollfd *)MALLOC(0); - + pthread_sigmask(SIG_SETMASK, NULL, &mask); + sigdelset(&mask, SIGHUP); + sigdelset(&mask, SIGUSR1); - while (1) { - struct client *c; - int i, poll_count; + while (1) { + struct client *c; + int i, poll_count; @@ -132,11 +139,13 @@ void * uxsock_listen(int (*uxsock_trigge - } - - /* most of our life is spent in this call */ + } + + /* most of our life is spent in this call */ - poll_count = poll(polls, i, SLEEP_TIME); + poll_count = ppoll(polls, i, &sleep_time, &mask); - - if (poll_count == -1) { + + if (poll_count == -1) { - if (errno == EINTR) + if (errno == EINTR) { + handle_signals(); - continue; + continue; + } - - /* something went badly wrong! */ - condlog(0, "poll"); + + /* something went badly wrong! */ + condlog(0, "poll"); Index: multipath-tools-130222/multipathd/uxlsnr.h =================================================================== --- multipath-tools-130222.orig/multipathd/uxlsnr.h +++ multipath-tools-130222/multipathd/uxlsnr.h @@ -4,5 +4,8 @@ void * uxsock_listen(int (*uxsock_trigger) - (char *, char **, int *, void *), - void * trigger_data); + (char *, char **, int *, void *), + void * trigger_data); + +extern volatile sig_atomic_t reconfig_sig; +extern volatile sig_atomic_t log_reset_sig; #endif + diff --git a/SOURCES/0043-RH-signal-waiter.patch b/SOURCES/0043-RH-signal-waiter.patch index bb096038..a1a63ea0 100644 --- a/SOURCES/0043-RH-signal-waiter.patch +++ b/SOURCES/0043-RH-signal-waiter.patch @@ -8,44 +8,44 @@ Index: multipath-tools-130222/libmultipath/waiter.c --- multipath-tools-130222.orig/libmultipath/waiter.c +++ multipath-tools-130222/libmultipath/waiter.c @@ -57,6 +57,7 @@ void stop_waiter_thread (struct multipat - thread = mpp->waiter; - mpp->waiter = (pthread_t)0; - pthread_cancel(thread); + thread = mpp->waiter; + mpp->waiter = (pthread_t)0; + pthread_cancel(thread); + pthread_kill(thread, SIGUSR2); } - + /* @@ -65,6 +66,7 @@ void stop_waiter_thread (struct multipat */ int waiteventloop (struct event_thread *waiter) { + sigset_t set, oldset; - int event_nr; - int r; - + int event_nr; + int r; + @@ -97,8 +99,15 @@ int waiteventloop (struct event_thread * - dm_task_no_open_count(waiter->dmt); - - /* wait */ + dm_task_no_open_count(waiter->dmt); + + /* wait */ + sigemptyset(&set); + sigaddset(&set, SIGUSR2); + pthread_sigmask(SIG_UNBLOCK, &set, &oldset); + + pthread_testcancel(); - r = dm_task_run(waiter->dmt); + r = dm_task_run(waiter->dmt); + pthread_testcancel(); - + + pthread_sigmask(SIG_SETMASK, &oldset, NULL); - dm_task_destroy(waiter->dmt); - waiter->dmt = NULL; - + dm_task_destroy(waiter->dmt); + waiter->dmt = NULL; + Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -1506,6 +1506,12 @@ sigusr1 (int sig) } - + static void +sigusr2 (int sig) +{ @@ -55,17 +55,17 @@ Index: multipath-tools-130222/multipathd/main.c +static void signal_init(void) { - sigset_t set; + sigset_t set; @@ -1513,10 +1519,12 @@ signal_init(void) - sigemptyset(&set); - sigaddset(&set, SIGHUP); - sigaddset(&set, SIGUSR1); + sigemptyset(&set); + sigaddset(&set, SIGHUP); + sigaddset(&set, SIGUSR1); + sigaddset(&set, SIGUSR2); - pthread_sigmask(SIG_BLOCK, &set, NULL); - - signal_set(SIGHUP, sighup); - signal_set(SIGUSR1, sigusr1); + pthread_sigmask(SIG_BLOCK, &set, NULL); + + signal_set(SIGHUP, sighup); + signal_set(SIGUSR1, sigusr1); + signal_set(SIGUSR2, sigusr2); - signal_set(SIGINT, sigend); - signal_set(SIGTERM, sigend); - signal(SIGPIPE, SIG_IGN); + signal_set(SIGINT, sigend); + signal_set(SIGTERM, sigend); + signal(SIGPIPE, SIG_IGN); diff --git a/SOURCES/0044-RHBZ-976688-fix-wipe-wwids.patch b/SOURCES/0044-RHBZ-976688-fix-wipe-wwids.patch index ab6f97c5..6f705746 100644 --- a/SOURCES/0044-RHBZ-976688-fix-wipe-wwids.patch +++ b/SOURCES/0044-RHBZ-976688-fix-wipe-wwids.patch @@ -11,18 +11,18 @@ Index: multipath-tools-130222/libmultipath/wwids.c #include #include +#include - + #include "checkers.h" #include "vector.h" @@ -100,6 +101,11 @@ replace_wwids(vector mp) - condlog(0, "cannot truncate wwids file : %s", strerror(errno)); - goto out_file; - } + condlog(0, "cannot truncate wwids file : %s", strerror(errno)); + goto out_file; + } + if (lseek(fd, 0, SEEK_SET) < 0) { + condlog(0, "cannot seek to the start of the file : %s", + strerror(errno)); + goto out_file; + } - len = strlen(WWIDS_FILE_HEADER); - if (write_all(fd, WWIDS_FILE_HEADER, len) != len) { - condlog(0, "Can't write wwid file header : %s", + len = strlen(WWIDS_FILE_HEADER); + if (write_all(fd, WWIDS_FILE_HEADER, len) != len) { + condlog(0, "Can't write wwid file header : %s", diff --git a/SOURCES/0045-RHBZ-977297-man-page-fix.patch b/SOURCES/0045-RHBZ-977297-man-page-fix.patch index b0b78ab2..3ede0ce0 100644 --- a/SOURCES/0045-RHBZ-977297-man-page-fix.patch +++ b/SOURCES/0045-RHBZ-977297-man-page-fix.patch @@ -16,7 +16,7 @@ Index: multipath-tools-130222/multipath/multipath.conf.5 .TP .B uid_attribute @@ -182,7 +182,7 @@ Generate a random priority between 1 and - Generate the path priority based on the regular expression and the + Generate the path priority based on the regular expression and the priority provided as argument. requires prio_args keyword. .TP -Default value is \fBnone\fR. diff --git a/SOURCES/0046-RHBZ-883981-move-udev-rules.patch b/SOURCES/0046-RHBZ-883981-move-udev-rules.patch index a4eabf45..4e5bc853 100644 --- a/SOURCES/0046-RHBZ-883981-move-udev-rules.patch +++ b/SOURCES/0046-RHBZ-883981-move-udev-rules.patch @@ -7,22 +7,22 @@ Index: multipath-tools-130222/multipath/Makefile --- multipath-tools-130222.orig/multipath/Makefile +++ multipath-tools-130222/multipath/Makefile @@ -23,8 +23,8 @@ install: - $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ - $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ - $(INSTALL_PROGRAM) -d $(DESTDIR)/lib/udev/rules.d - $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/62-multipath.rules + $(INSTALL_PROGRAM) -d $(DESTDIR)/usr/lib/udev/rules.d + $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules - $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) @@ -32,7 +32,7 @@ install: - $(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(mandir) - + $(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(mandir) + uninstall: - rm $(DESTDIR)/lib/udev/rules.d/62-multipath.rules + rm $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules - rm $(DESTDIR)$(bindir)/$(EXEC) - rm $(DESTDIR)$(bindir)/mpathconf - rm $(DESTDIR)$(mandir)/$(EXEC).8.gz + rm $(DESTDIR)$(bindir)/$(EXEC) + rm $(DESTDIR)$(bindir)/mpathconf + rm $(DESTDIR)$(mandir)/$(EXEC).8.gz diff --git a/SOURCES/0047-RHBZ-kpartx-read-only-loop-devs.patch b/SOURCES/0047-RHBZ-kpartx-read-only-loop-devs.patch index b3f8e225..ed79e229 100644 --- a/SOURCES/0047-RHBZ-kpartx-read-only-loop-devs.patch +++ b/SOURCES/0047-RHBZ-kpartx-read-only-loop-devs.patch @@ -8,32 +8,32 @@ Index: multipath-tools-130222/kpartx/kpartx.c --- multipath-tools-130222.orig/kpartx/kpartx.c +++ multipath-tools-130222/kpartx/kpartx.c @@ -204,7 +204,6 @@ main(int argc, char **argv){ - char * delim = NULL; - char *uuid = NULL; - char *mapname = NULL; + char * delim = NULL; + char *uuid = NULL; + char *mapname = NULL; - int loopro = 0; - int hotplug = 0; - int loopcreated = 0; - struct stat buf; + int hotplug = 0; + int loopcreated = 0; + struct stat buf; @@ -315,7 +314,7 @@ main(int argc, char **argv){ - if (!loopdev) { - loopdev = find_unused_loop_device(); - + if (!loopdev) { + loopdev = find_unused_loop_device(); + - if (set_loop(loopdev, device, 0, &loopro)) { + if (set_loop(loopdev, device, 0, &ro)) { - fprintf(stderr, "can't set up loop\n"); - exit (1); - } + fprintf(stderr, "can't set up loop\n"); + exit (1); + } Index: multipath-tools-130222/kpartx/lopart.c =================================================================== --- multipath-tools-130222.orig/kpartx/lopart.c +++ multipath-tools-130222/kpartx/lopart.c @@ -230,7 +230,7 @@ set_loop (const char *device, const char - - if ((ffd = open (file, mode)) < 0) { - + + if ((ffd = open (file, mode)) < 0) { + - if (!*loopro && errno == EROFS) + if (!*loopro && (errno == EROFS || errno == EACCES)) - ffd = open (file, mode = O_RDONLY); - - if (ffd < 0) { + ffd = open (file, mode = O_RDONLY); + + if (ffd < 0) { diff --git a/SOURCES/0048-RH-print-defaults.patch b/SOURCES/0048-RH-print-defaults.patch index 74d07ecd..be1ce572 100644 --- a/SOURCES/0048-RH-print-defaults.patch +++ b/SOURCES/0048-RH-print-defaults.patch @@ -12,14 +12,14 @@ Index: multipath-tools-130222/libmultipath/dict.c { - if (conf->max_checkint == MAX_CHECKINT(conf->checkint)) - return 0; - return snprintf(buff, len, "%i", conf->max_checkint); + return snprintf(buff, len, "%i", conf->max_checkint); } - + static int snprint_reassign_maps (char * buff, int len, void * data) { - if (conf->reassign_maps == DEFAULT_REASSIGN_MAPS) - return 0; - return snprintf(buff, len, "\"%s\"", - conf->reassign_maps?"yes":"no"); + return snprintf(buff, len, "\"%s\"", + conf->reassign_maps?"yes":"no"); } diff --git a/SOURCES/0049-RH-remove-ID_FS_TYPE.patch b/SOURCES/0049-RH-remove-ID_FS_TYPE.patch index 7273075b..732f50f7 100644 --- a/SOURCES/0049-RH-remove-ID_FS_TYPE.patch +++ b/SOURCES/0049-RH-remove-ID_FS_TYPE.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/multipath/multipath.rules --- multipath-tools-130222.orig/multipath/multipath.rules +++ multipath-tools-130222/multipath/multipath.rules @@ -11,7 +11,7 @@ ACTION=="add", ENV{DEVTYPE}!="partition" - ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \ - TEST=="/etc/multipath.conf", \ - PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \ + ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \ + TEST=="/etc/multipath.conf", \ + PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \ - ENV{DM_MULTIPATH_DEVICE_PATH}="1" + ENV{DM_MULTIPATH_DEVICE_PATH}="1" ENV{ID_FS_TYPE}="mpath_member" - + ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DEVTYPE}!="partition", \ - RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}" + RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}" diff --git a/SOURCES/0050-RH-listing-speedup.patch b/SOURCES/0050-RH-listing-speedup.patch index d0eb19d6..4742634e 100644 --- a/SOURCES/0050-RH-listing-speedup.patch +++ b/SOURCES/0050-RH-listing-speedup.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/multipath/main.c --- multipath-tools-130222.orig/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -311,7 +311,7 @@ configure (void) - /* - * get a path list - */ + /* + * get a path list + */ - if (conf->dev) + if (conf->dev && !conf->list) - di_flag = DI_WWID; - - if (conf->list > 1) + di_flag = DI_WWID; + + if (conf->list > 1) diff --git a/SOURCES/0051-UP-fix-cli-resize.patch b/SOURCES/0051-UP-fix-cli-resize.patch index 6641b9c8..f278607c 100644 --- a/SOURCES/0051-UP-fix-cli-resize.patch +++ b/SOURCES/0051-UP-fix-cli-resize.patch @@ -3,21 +3,21 @@ index 7b1cb62..4b860bb 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -603,7 +603,18 @@ cli_resize(void *v, char **reply, int *len, void *data) - } - - pgp = VECTOR_SLOT(mpp->pg, 0); + } + + pgp = VECTOR_SLOT(mpp->pg, 0); + + if (!pgp){ + condlog(0, "%s: couldn't get path group. cannot resize", + mapname); + return 1; + } - pp = VECTOR_SLOT(pgp->paths, 0); + pp = VECTOR_SLOT(pgp->paths, 0); + + if (!pp){ + condlog(0, "%s: couldn't get path. cannot resize", mapname); + return 1; + } - if (!pp->udev || sysfs_get_size(pp, &size)) { - condlog(0, "%s: couldn't get size for sysfs. cannot resize", - mapname); + if (!pp->udev || sysfs_get_size(pp, &size)) { + condlog(0, "%s: couldn't get size for sysfs. cannot resize", + mapname); diff --git a/SOURCES/0052-RH-fix-bad-derefs.patch b/SOURCES/0052-RH-fix-bad-derefs.patch index e1f34b6b..db5f1dbe 100644 --- a/SOURCES/0052-RH-fix-bad-derefs.patch +++ b/SOURCES/0052-RH-fix-bad-derefs.patch @@ -8,47 +8,47 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c --- multipath-tools-130222.orig/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -632,7 +632,8 @@ cli_resize(void *v, char **reply, int *l - return 1; - - dm_lib_release(); + return 1; + + dm_lib_release(); - setup_multipath(vecs, mpp); + if (setup_multipath(vecs, mpp) != 0) + return 1; - sync_map_state(mpp); - - return 0; + sync_map_state(mpp); + + return 0; Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -134,7 +134,6 @@ coalesce_maps(struct vectors *vecs, vect - struct multipath * ompp; - vector ompv = vecs->mpvec; - unsigned int i; + struct multipath * ompp; + vector ompv = vecs->mpvec; + unsigned int i; - int j; - - vector_foreach_slot (ompv, ompp, i) { - if (!find_mp_by_wwid(nmpv, ompp->wwid)) { + + vector_foreach_slot (ompv, ompp, i) { + if (!find_mp_by_wwid(nmpv, ompp->wwid)) { @@ -148,16 +147,17 @@ coalesce_maps(struct vectors *vecs, vect - /* - * may be just because the device is open - */ + /* + * may be just because the device is open + */ + if (setup_multipath(vecs, ompp) != 0) { + i--; + continue; + } - if (!vector_alloc_slot(nmpv)) - return 1; - - vector_set_slot(nmpv, ompp); + if (!vector_alloc_slot(nmpv)) + return 1; + + vector_set_slot(nmpv, ompp); - setup_multipath(vecs, ompp); - + - if ((j = find_slot(ompv, (void *)ompp)) != -1) - vector_del_slot(ompv, j); - - continue; + vector_del_slot(ompv, i); + i--; - } - else { - dm_lib_release(); + } + else { + dm_lib_release(); diff --git a/SOURCES/0053-UP-fix-failback.patch b/SOURCES/0053-UP-fix-failback.patch index 0d35c571..936655d5 100644 --- a/SOURCES/0053-UP-fix-failback.patch +++ b/SOURCES/0053-UP-fix-failback.patch @@ -7,17 +7,17 @@ Index: multipath-tools-130222/libmultipath/dict.c --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -1126,11 +1126,11 @@ hw_failback_handler(vector strvec) - - buff = set_value(strvec); - + + buff = set_value(strvec); + - if (strlen(buff) == 6 && !strcmp(buff, "\"manual\"")) + if (strlen(buff) == 6 && !strcmp(buff, "manual")) - hwe->pgfailback = -FAILBACK_MANUAL; + hwe->pgfailback = -FAILBACK_MANUAL; - else if (strlen(buff) == 9 && !strcmp(buff, "\"immediate\"")) + else if (strlen(buff) == 9 && !strcmp(buff, "immediate")) - hwe->pgfailback = -FAILBACK_IMMEDIATE; + hwe->pgfailback = -FAILBACK_IMMEDIATE; - else if (strlen(buff) == 10 && !strcmp(buff, "\"followover\"")) + else if (strlen(buff) == 10 && !strcmp(buff, "followover")) - hwe->pgfailback = -FAILBACK_FOLLOWOVER; - else - hwe->pgfailback = atoi(buff); + hwe->pgfailback = -FAILBACK_FOLLOWOVER; + else + hwe->pgfailback = atoi(buff); diff --git a/SOURCES/0054-UP-keep-udev-ref.patch b/SOURCES/0054-UP-keep-udev-ref.patch index 26b7b07a..e42d716f 100644 --- a/SOURCES/0054-UP-keep-udev-ref.patch +++ b/SOURCES/0054-UP-keep-udev-ref.patch @@ -25,29 +25,29 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c #include #include +#include - + #include #include @@ -20,6 +20,7 @@ #include #include - + +#include "mpath_persist.h" #include "mpathpr.h" #include "mpath_pr_ioctl.h" - + @@ -32,9 +33,9 @@ - - + + int -mpath_lib_init (void) +mpath_lib_init (struct udev *udev) { - if (load_config(DEFAULT_CONFIGFILE)){ + if (load_config(DEFAULT_CONFIGFILE, udev)){ - condlog(0, "Failed to initialize multipath config."); - return 1; - } + condlog(0, "Failed to initialize multipath config."); + return 1; + } Index: multipath-tools-130222/libmpathpersist/mpath_persist.h =================================================================== --- multipath-tools-130222.orig/libmpathpersist/mpath_persist.h @@ -58,8 +58,8 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.h */ -extern int mpath_lib_init (void ); +extern int mpath_lib_init (struct udev *udev); - - + + /* Index: multipath-tools-130222/libmpathpersist/mpath_pr_ioctl.c =================================================================== @@ -69,65 +69,65 @@ Index: multipath-tools-130222/libmpathpersist/mpath_pr_ioctl.c #include #include #include --#include "mpath_pr_ioctl.h" --#include +-#include "mpath_pr_ioctl.h" +-#include +#include +#include "mpath_pr_ioctl.h" +#include - + #include - + Index: multipath-tools-130222/libmultipath/config.c =================================================================== --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -467,9 +467,6 @@ free_config (struct config * conf) - if (conf->dev) - FREE(conf->dev); - + if (conf->dev) + FREE(conf->dev); + - if (conf->udev) - udev_unref(conf->udev); - - if (conf->multipath_dir) - FREE(conf->multipath_dir); - + if (conf->multipath_dir) + FREE(conf->multipath_dir); + @@ -519,12 +516,12 @@ free_config (struct config * conf) } - + int -load_config (char * file) +load_config (char * file, struct udev *udev) { - if (!conf) - conf = alloc_config(); - + if (!conf) + conf = alloc_config(); + - if (!conf) + if (!conf || !udev) - return 1; - - /* + return 1; + + /* @@ -533,7 +530,7 @@ load_config (char * file) - if (!conf->verbosity) - conf->verbosity = DEFAULT_VERBOSITY; - + if (!conf->verbosity) + conf->verbosity = DEFAULT_VERBOSITY; + - conf->udev = udev_new(); + conf->udev = udev; - dm_drv_version(conf->version, TGT_MPATH); - conf->dev_type = DEV_NONE; - conf->minio = DEFAULT_MINIO; + dm_drv_version(conf->version, TGT_MPATH); + conf->dev_type = DEV_NONE; + conf->minio = DEFAULT_MINIO; Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -159,7 +159,7 @@ void free_mptable (vector mptable); - + int store_hwe (vector hwtable, struct hwentry *); - + -int load_config (char * file); +int load_config (char * file, struct udev * udev); struct config * alloc_config (void); void free_config (struct config * conf); - + Index: multipath-tools-130222/mpathpersist/main.c =================================================================== --- multipath-tools-130222.orig/mpathpersist/main.c @@ -141,41 +141,41 @@ Index: multipath-tools-130222/mpathpersist/main.c #include "main.h" #include @@ -68,7 +69,8 @@ int main (int argc, char * argv[]) - int noisy = 0; - int num_transport =0; - void *resp = NULL; -- struct transportid * tmp; + int noisy = 0; + int num_transport =0; + void *resp = NULL; +- struct transportid * tmp; + struct transportid * tmp; + struct udev *udev = NULL; - - if (optind == argc) - { + + if (optind == argc) + { @@ -84,8 +86,8 @@ int main (int argc, char * argv[]) - exit (1); - } - + exit (1); + } + - - mpath_lib_init(); + udev = udev_new(); + mpath_lib_init(udev); - memset(transportids,0,MPATH_MX_TIDS); - - while (1) + memset(transportids,0,MPATH_MX_TIDS); + + while (1) @@ -461,12 +463,13 @@ int main (int argc, char * argv[]) - if (res < 0) - { - mpath_lib_exit(); + if (res < 0) + { + mpath_lib_exit(); + udev_unref(udev); - return MPATH_PR_FILE_ERROR; - } - + return MPATH_PR_FILE_ERROR; + } + out : - mpath_lib_exit(); + mpath_lib_exit(); - + udev_unref(udev); - return (ret >= 0) ? ret : MPATH_PR_OTHER; + return (ret >= 0) ? ret : MPATH_PR_OTHER; } - + Index: multipath-tools-130222/multipath/main.c =================================================================== --- multipath-tools-130222.orig/multipath/main.c @@ -185,7 +185,7 @@ Index: multipath-tools-130222/multipath/main.c #include #include +#include - + #include #include @@ -435,6 +436,7 @@ convert_dev(char *dev) @@ -193,42 +193,42 @@ Index: multipath-tools-130222/multipath/main.c main (int argc, char *argv[]) { + struct udev *udev; - int arg; - extern char *optarg; - extern int optind; + int arg; + extern char *optarg; + extern int optind; @@ -445,7 +447,9 @@ main (int argc, char *argv[]) - exit(1); - } - + exit(1); + } + - if (load_config(DEFAULT_CONFIGFILE)) + udev = udev_new(); + + if (load_config(DEFAULT_CONFIGFILE, udev)) - exit(1); - - if (dm_prereq()) + exit(1); + + if (dm_prereq()) @@ -560,11 +564,11 @@ main (int argc, char *argv[]) - - if (init_checkers()) { - condlog(0, "failed to initialize checkers"); + + if (init_checkers()) { + condlog(0, "failed to initialize checkers"); - exit(1); + goto out; - } - if (init_prio()) { - condlog(0, "failed to initialize prioritizers"); + } + if (init_prio()) { + condlog(0, "failed to initialize prioritizers"); - exit(1); + goto out; - } - dm_init(); - + } + dm_init(); + @@ -628,7 +632,7 @@ out: - */ - free_config(conf); - conf = NULL; + */ + free_config(conf); + conf = NULL; - + udev_unref(udev); #ifdef _DEBUG_ - dbg_free_final(NULL); + dbg_free_final(NULL); #endif Index: multipath-tools-130222/multipathd/main.c =================================================================== @@ -237,71 +237,72 @@ Index: multipath-tools-130222/multipathd/main.c @@ -93,6 +93,8 @@ static sem_t exit_sem; */ struct vectors * gvecs; - + +struct udev * udev; + static int need_switch_pathgroup (struct multipath * mpp, int refresh) { @@ -1408,7 +1410,7 @@ reconfigure (struct vectors * vecs) - vecs->pathvec = NULL; - conf = NULL; - + vecs->pathvec = NULL; + conf = NULL; + - if (!load_config(DEFAULT_CONFIGFILE)) { + if (!load_config(DEFAULT_CONFIGFILE, udev)) { - conf->verbosity = old->verbosity; - conf->daemon = 1; - configure(vecs, 1); + conf->verbosity = old->verbosity; + conf->daemon = 1; + configure(vecs, 1); @@ -1601,6 +1603,8 @@ child (void * param) - sem_init(&exit_sem, 0, 0); - signal_init(); - + sem_init(&exit_sem, 0, 0); + signal_init(); + + udev = udev_new(); + - setup_thread_attr(&misc_attr, 64 * 1024, 1); - setup_thread_attr(&waiter_attr, 32 * 1024, 1); - + setup_thread_attr(&misc_attr, 64 * 1024, 1); + setup_thread_attr(&waiter_attr, 32 * 1024, 1); + @@ -1615,7 +1619,7 @@ child (void * param) - condlog(2, "--------start up--------"); - condlog(2, "read " DEFAULT_CONFIGFILE); - + condlog(2, "--------start up--------"); + condlog(2, "read " DEFAULT_CONFIGFILE); + - if (load_config(DEFAULT_CONFIGFILE)) + if (load_config(DEFAULT_CONFIGFILE, udev)) - exit(1); - - if (init_checkers()) { + exit(1); + + if (init_checkers()) { @@ -1765,7 +1769,8 @@ child (void * param) - */ - free_config(conf); - conf = NULL; + */ + free_config(conf); + conf = NULL; - + udev_unref(udev); + udev = NULL; #ifdef _DEBUG_ - dbg_free_final(NULL); + dbg_free_final(NULL); #endif Index: multipath-tools-130222/mpathpersist/Makefile =================================================================== --- multipath-tools-130222.orig/mpathpersist/Makefile +++ multipath-tools-130222/mpathpersist/Makefile @@ -5,7 +5,7 @@ include ../Makefile.inc - OBJS = main.o - - CFLAGS += -I$(multipathdir) -I$(mpathpersistdir) --LDFLAGS += -lpthread -ldevmapper -L$(mpathpersistdir) -lmpathpersist -L$(multipathdir) -lmultipath + OBJS = main.o + + CFLAGS += -I$(multipathdir) -I$(mpathpersistdir) +-LDFLAGS += -lpthread -ldevmapper -L$(mpathpersistdir) -lmpathpersist -L$(multipathdir) -lmultipath +LDFLAGS += -lpthread -ldevmapper -L$(mpathpersistdir) -lmpathpersist -L$(multipathdir) -lmultipath -ludev - + EXEC = mpathpersist - + Index: multipath-tools-130222/multipath/Makefile =================================================================== --- multipath-tools-130222.orig/multipath/Makefile +++ multipath-tools-130222/multipath/Makefile @@ -7,7 +7,7 @@ include ../Makefile.inc OBJS = main.o - + CFLAGS += -fPIC -I$(multipathdir) -LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath +LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath -ludev - + EXEC = multipath + diff --git a/SOURCES/0055-UP-handle-quiesced-paths.patch b/SOURCES/0055-UP-handle-quiesced-paths.patch index a31d80dd..0556a612 100644 --- a/SOURCES/0055-UP-handle-quiesced-paths.patch +++ b/SOURCES/0055-UP-handle-quiesced-paths.patch @@ -7,10 +7,10 @@ Index: multipath-tools-130222/libmultipath/discovery.c --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -799,6 +799,7 @@ path_offline (struct path * pp) - condlog(3, "%s: path state = %s", pp->dev, buff); - - if (!strncmp(buff, "offline", 7) || + condlog(3, "%s: path state = %s", pp->dev, buff); + + if (!strncmp(buff, "offline", 7) || + !strncmp(buff, "quiesce", 7) || - !strncmp(buff, "transport-offline", 17)) { - pp->offline = 1; - return PATH_DOWN; + !strncmp(buff, "transport-offline", 17)) { + pp->offline = 1; + return PATH_DOWN; diff --git a/SOURCES/0056-UP-alua-prio-fix.patch b/SOURCES/0056-UP-alua-prio-fix.patch index ff234604..0ac41aba 100644 --- a/SOURCES/0056-UP-alua-prio-fix.patch +++ b/SOURCES/0056-UP-alua-prio-fix.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/libmultipath/prioritizers/alua.c --- multipath-tools-130222.orig/libmultipath/prioritizers/alua.c +++ multipath-tools-130222/libmultipath/prioritizers/alua.c @@ -108,7 +108,7 @@ int getprio (struct path * pp, char * ar - default: - rc = 0; - } + default: + rc = 0; + } - if (priopath) + if (priopath && aas != AAS_OPTIMIZED) - rc += 80; - } else { - switch(-rc) { + rc += 80; + } else { + switch(-rc) { diff --git a/SOURCES/0057-UP-fix-tmo.patch b/SOURCES/0057-UP-fix-tmo.patch index 2fb64cc9..0bfc46bc 100644 --- a/SOURCES/0057-UP-fix-tmo.patch +++ b/SOURCES/0057-UP-fix-tmo.patch @@ -1,7 +1,7 @@ --- libmultipath/discovery.c | 109 +++++++++++++++++++++++++++++++++++++---------- libmultipath/sysfs.c | 86 +++++++++++++++++++++++++++++++------ - libmultipath/sysfs.h | 2 + libmultipath/sysfs.h | 2 3 files changed, 161 insertions(+), 36 deletions(-) Index: multipath-tools-130222/libmultipath/discovery.c @@ -14,28 +14,28 @@ Index: multipath-tools-130222/libmultipath/discovery.c declare_sysfs_get_str(rev); -declare_sysfs_get_str(state); declare_sysfs_get_str(dev); - + int @@ -315,9 +314,14 @@ static void sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp) { - struct udev_device *rport_dev = NULL; + struct udev_device *rport_dev = NULL; - char value[11]; + char value[16]; - char rport_id[32]; + char rport_id[32]; + int delay_fast_io_fail = 0; + int current_dev_loss = 0; + int ret; - + + if (!mpp->dev_loss && mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET) + return; - sprintf(rport_id, "rport-%d:%d-%d", - pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.transport_id); - rport_dev = udev_device_new_from_subsystem_sysname(conf->udev, + sprintf(rport_id, "rport-%d:%d-%d", + pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.transport_id); + rport_dev = udev_device_new_from_subsystem_sysname(conf->udev, @@ -330,33 +334,85 @@ sysfs_set_rport_tmo(struct multipath *mp - condlog(4, "target%d:%d:%d -> %s", pp->sg_id.host_no, - pp->sg_id.channel, pp->sg_id.scsi_id, rport_id); - + condlog(4, "target%d:%d:%d -> %s", pp->sg_id.host_no, + pp->sg_id.channel, pp->sg_id.scsi_id, rport_id); + - snprintf(value, 11, "%u", mpp->dev_loss); - if (mpp->dev_loss && - sysfs_attr_set_value(rport_dev, "dev_loss_tmo", value, 11) <= 0) { @@ -56,8 +56,8 @@ Index: multipath-tools-130222/libmultipath/discovery.c + if (ret <= 0) { + condlog(0, "%s: failed to read dev_loss_tmo value, " + "error %d", rport_id, -ret); - goto out; - } + goto out; + } + if (sscanf(value, "%u\n", ¤t_dev_loss) != 1) { + condlog(0, "%s: Cannot parse dev_loss_tmo " + "attribute '%s'", rport_id, value); @@ -84,16 +84,16 @@ Index: multipath-tools-130222/libmultipath/discovery.c + condlog(3, "%s: limiting dev_loss_tmo to 600, since " + "fast_io_fail is unset or off", rport_id); + mpp->dev_loss = 600; - } + } - if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET){ + if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) { - if (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF) - sprintf(value, "off"); - else if (mpp->fast_io_fail == MP_FAST_IO_FAIL_ZERO) - sprintf(value, "0"); + if (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF) + sprintf(value, "off"); + else if (mpp->fast_io_fail == MP_FAST_IO_FAIL_ZERO) + sprintf(value, "0"); + else if (delay_fast_io_fail) + snprintf(value, 16, "%u", current_dev_loss - 1); - else + else - snprintf(value, 11, "%u", mpp->fast_io_fail); - if (sysfs_attr_set_value(rport_dev, "fast_io_fail_tmo", - value, 11) <= 0) { @@ -134,18 +134,18 @@ Index: multipath-tools-130222/libmultipath/discovery.c + else + condlog(0, "%s: failed to set fast_io_fail_tmo to %s, error %d", + rport_id, value, -ret); - } - } + } + } out: @@ -394,7 +450,7 @@ sysfs_set_session_tmo(struct multipath * - } else { - snprintf(value, 11, "%u", mpp->fast_io_fail); - if (sysfs_attr_set_value(session_dev, "recovery_tmo", + } else { + snprintf(value, 11, "%u", mpp->fast_io_fail); + if (sysfs_attr_set_value(session_dev, "recovery_tmo", - value, 11)) { + value, 11) <= 0) { - condlog(3, "%s: Failed to set recovery_tmo, " - " error %d", pp->dev, errno); - } + condlog(3, "%s: Failed to set recovery_tmo, " + " error %d", pp->dev, errno); + } @@ -752,6 +808,9 @@ cciss_sysfs_pathinfo (struct path * pp) static int common_sysfs_pathinfo (struct path * pp) @@ -153,29 +153,29 @@ Index: multipath-tools-130222/libmultipath/discovery.c + if (!pp) + return 1; + - if (!pp->udev) { - condlog(4, "%s: udev not initialised", pp->dev); - return 1; + if (!pp->udev) { + condlog(4, "%s: udev not initialised", pp->dev); + return 1; @@ -793,7 +852,8 @@ path_offline (struct path * pp) - return PATH_DOWN; - } - + return PATH_DOWN; + } + - if (sysfs_get_state(parent, buff, SCSI_STATE_SIZE)) + memset(buff, 0x0, SCSI_STATE_SIZE); + if (sysfs_attr_get_value(parent, "state", buff, SCSI_STATE_SIZE) <= 0) - return PATH_DOWN; - - condlog(3, "%s: path state = %s", pp->dev, buff); + return PATH_DOWN; + + condlog(3, "%s: path state = %s", pp->dev, buff); @@ -983,6 +1043,9 @@ pathinfo (struct path *pp, vector hwtabl { - int path_state; - + int path_state; + + if (!pp) + return 1; + - condlog(3, "%s: mask = 0x%x", pp->dev, mask); - - /* + condlog(3, "%s: mask = 0x%x", pp->dev, mask); + + /* Index: multipath-tools-130222/libmultipath/sysfs.c =================================================================== --- multipath-tools-130222.orig/libmultipath/sysfs.c @@ -183,7 +183,7 @@ Index: multipath-tools-130222/libmultipath/sysfs.c @@ -38,7 +38,12 @@ #include "debug.h" #include "devmapper.h" - + -ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name, +/* + * When we modify an attribute value we cannot rely on libudev for now, @@ -191,26 +191,26 @@ Index: multipath-tools-130222/libmultipath/sysfs.c + * So for modified attributes we need to implement our own function. + */ +ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name, - char * value, size_t value_len) + char * value, size_t value_len) { - char devpath[PATH_SIZE]; + char devpath[PATH_SIZE]; @@ -54,28 +59,83 @@ ssize_t sysfs_attr_set_value(struct udev - condlog(4, "open '%s'", devpath); - if (stat(devpath, &statbuf) != 0) { - condlog(4, "stat '%s' failed: %s", devpath, strerror(errno)); + condlog(4, "open '%s'", devpath); + if (stat(devpath, &statbuf) != 0) { + condlog(4, "stat '%s' failed: %s", devpath, strerror(errno)); - return 0; + return -errno; - } - - /* skip directories */ + } + + /* skip directories */ - if (S_ISDIR(statbuf.st_mode)) - return 0; + if (S_ISDIR(statbuf.st_mode)) { + condlog(4, "%s is a directory", devpath); + return -EISDIR; + } - - /* skip non-writeable files */ + + /* skip non-writeable files */ - if ((statbuf.st_mode & S_IWUSR) == 0) + if ((statbuf.st_mode & S_IRUSR) == 0) { + condlog(4, "%s is not readable", devpath); @@ -246,8 +246,8 @@ Index: multipath-tools-130222/libmultipath/sysfs.c + ssize_t size = -1; + + if (!dev || !attr_name || !value || !value_len) - return 0; - + return 0; + + snprintf(devpath, PATH_SIZE, "%s/%s", udev_device_get_syspath(dev), + attr_name); + condlog(4, "open '%s'", devpath); @@ -268,60 +268,60 @@ Index: multipath-tools-130222/libmultipath/sysfs.c + return -EPERM; + } + - /* write attribute value */ - fd = open(devpath, O_WRONLY); - if (fd < 0) { - condlog(4, "attribute '%s' can not be opened: %s", - devpath, strerror(errno)); + /* write attribute value */ + fd = open(devpath, O_WRONLY); + if (fd < 0) { + condlog(4, "attribute '%s' can not be opened: %s", + devpath, strerror(errno)); - return 0; + return -errno; - } - size = write(fd, value, value_len); - if (size < 0) { - condlog(4, "write to %s failed: %s", devpath, strerror(errno)); + } + size = write(fd, value, value_len); + if (size < 0) { + condlog(4, "write to %s failed: %s", devpath, strerror(errno)); - size = 0; + size = -errno; - } else if (size < value_len) { - condlog(4, "tried to write %ld to %s. Wrote %ld", - (long)value_len, devpath, (long)size); + } else if (size < value_len) { + condlog(4, "tried to write %ld to %s. Wrote %ld", + (long)value_len, devpath, (long)size); @@ -89,14 +149,14 @@ ssize_t sysfs_attr_set_value(struct udev int sysfs_get_size (struct path *pp, unsigned long long * size) { - const char * attr; + char attr[255]; - int r; - + int r; + - if (!pp->udev) + if (!pp->udev || !size) - return 1; - + return 1; + - attr = udev_device_get_sysattr_value(pp->udev, "size"); - if (!attr) { + attr[0] = '\0'; + if (sysfs_attr_get_value(pp->udev, "size", attr, 255) == 0) { - condlog(3, "%s: No size attribute in sysfs", pp->dev); - return 1; - } + condlog(3, "%s: No size attribute in sysfs", pp->dev); + return 1; + } @@ -104,8 +164,8 @@ sysfs_get_size (struct path *pp, unsigne - r = sscanf(attr, "%llu\n", size); - - if (r != 1) { + r = sscanf(attr, "%llu\n", size); + + if (r != 1) { - condlog(3, "%s: Cannot parse size attribute '%s'", - pp->dev, attr); + condlog(3, "%s: Cannot parse size attribute", pp->dev); + *size = 0; - return 1; - } - + return 1; + } + Index: multipath-tools-130222/libmultipath/sysfs.h =================================================================== --- multipath-tools-130222.orig/libmultipath/sysfs.h +++ multipath-tools-130222/libmultipath/sysfs.h @@ -7,6 +7,8 @@ - + ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name, - char * value, size_t value_len); + char * value, size_t value_len); +ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name, + char * value, size_t value_len); int sysfs_get_size (struct path *pp, unsigned long long * size); diff --git a/SOURCES/0058-UP-fix-failback.patch b/SOURCES/0058-UP-fix-failback.patch index 49b6d1de..d1fbaebe 100644 --- a/SOURCES/0058-UP-fix-failback.patch +++ b/SOURCES/0058-UP-fix-failback.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/libmultipath/dict.c --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -2562,7 +2562,7 @@ snprint_def_failback (char * buff, int l - if (!pgfailback) - pgfailback = DEFAULT_FAILBACK; - + if (!pgfailback) + pgfailback = DEFAULT_FAILBACK; + - switch(conf->pgfailback) { + switch(pgfailback) { - case FAILBACK_UNDEF: - break; - case -FAILBACK_MANUAL: + case FAILBACK_UNDEF: + break; + case -FAILBACK_MANUAL: diff --git a/SOURCES/0059-UP-flush-failure-queueing.patch b/SOURCES/0059-UP-flush-failure-queueing.patch index 5907828c..f72f3141 100644 --- a/SOURCES/0059-UP-flush-failure-queueing.patch +++ b/SOURCES/0059-UP-flush-failure-queueing.patch @@ -9,13 +9,13 @@ Index: multipath-tools-130222/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -363,7 +363,7 @@ out: } - + extern int -dm_get_map(char * name, unsigned long long * size, char * outparams) +dm_get_map(const char * name, unsigned long long * size, char * outparams) { - int r = 1; - struct dm_task *dmt; + int r = 1; + struct dm_task *dmt; @@ -682,7 +682,9 @@ _dm_flush_map (const char * mapname, int extern int dm_suspend_and_flush_map (const char * mapname) @@ -24,13 +24,13 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + int s = 0, queue_if_no_path = 0; + unsigned long long mapsize; + char params[PARAMS_SIZE] = {0}; - - if (!dm_map_present(mapname)) - return 0; + + if (!dm_map_present(mapname)) + return 0; @@ -690,8 +692,17 @@ dm_suspend_and_flush_map (const char * m - if (dm_type(mapname, TGT_MPATH) <= 0) - return 0; /* nothing to do */ - + if (dm_type(mapname, TGT_MPATH) <= 0) + return 0; /* nothing to do */ + - s = dm_queue_if_no_path((char *)mapname, 0); - if (!s) + if (!dm_get_map(mapname, &mapsize, params)) { @@ -44,18 +44,18 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + if (s) + queue_if_no_path = 0; + else - s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0); - - if (!dm_flush_map(mapname)) { + s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0); + + if (!dm_flush_map(mapname)) { @@ -700,6 +711,8 @@ dm_suspend_and_flush_map (const char * m - } - condlog(2, "failed to remove multipath map %s", mapname); - dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname); + } + condlog(2, "failed to remove multipath map %s", mapname); + dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname); + if (queue_if_no_path) + s = dm_queue_if_no_path((char *)mapname, 1); - return 1; + return 1; } - + Index: multipath-tools-130222/libmultipath/devmapper.h =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.h diff --git a/SOURCES/0060-UP-uevent-loop-udev.patch b/SOURCES/0060-UP-uevent-loop-udev.patch index a58ab199..88fc0059 100644 --- a/SOURCES/0060-UP-uevent-loop-udev.patch +++ b/SOURCES/0060-UP-uevent-loop-udev.patch @@ -13,40 +13,40 @@ Index: multipath-tools-130222/libmultipath/uevent.c #include "uevent.h" #include "vector.h" -#include "config.h" - + typedef int (uev_trigger)(struct uevent *, void * trigger_data); - + @@ -127,11 +126,14 @@ service_uevq(struct list_head *tmpq) - + static void uevq_stop(void *arg) { + struct udev *udev = arg; + - condlog(3, "Stopping uev queue"); - pthread_mutex_lock(uevq_lockp); - my_uev_trigger = NULL; - pthread_cond_signal(uev_condp); - pthread_mutex_unlock(uevq_lockp); + condlog(3, "Stopping uev queue"); + pthread_mutex_lock(uevq_lockp); + my_uev_trigger = NULL; + pthread_cond_signal(uev_condp); + pthread_mutex_unlock(uevq_lockp); + udev_unref(udev); } - + void @@ -399,9 +401,9 @@ exit: - return 1; + return 1; } - + -int uevent_listen(void) +int uevent_listen(struct udev *udev) { - int err; + int err = 2; - struct udev_monitor *monitor = NULL; - int fd, socket_flags; - int need_failback = 1; + struct udev_monitor *monitor = NULL; + int fd, socket_flags; + int need_failback = 1; @@ -411,9 +413,14 @@ int uevent_listen(void) - * thereby not getting to empty the socket's receive buffer queue - * often enough. - */ + * thereby not getting to empty the socket's receive buffer queue + * often enough. + */ - pthread_cleanup_push(uevq_stop, NULL); + if (!udev) { + condlog(1, "no udev context"); @@ -54,12 +54,12 @@ Index: multipath-tools-130222/libmultipath/uevent.c + } + udev_ref(udev); + pthread_cleanup_push(uevq_stop, udev); - + - monitor = udev_monitor_new_from_netlink(conf->udev, "udev"); + monitor = udev_monitor_new_from_netlink(udev, "udev"); - if (!monitor) { - condlog(2, "failed to create udev monitor"); - goto out; + if (!monitor) { + condlog(2, "failed to create udev monitor"); + goto out; Index: multipath-tools-130222/libmultipath/uevent.h =================================================================== --- multipath-tools-130222.orig/libmultipath/uevent.h @@ -67,20 +67,20 @@ Index: multipath-tools-130222/libmultipath/uevent.h @@ -13,6 +13,8 @@ #define NETLINK_KOBJECT_UEVENT 15 #endif - + +struct udev; + struct uevent { - struct list_head node; - struct udev_device *udev; + struct list_head node; + struct udev_device *udev; @@ -27,7 +29,7 @@ struct uevent { int is_uevent_busy(void); void setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached); - + -int uevent_listen(void); +int uevent_listen(struct udev *udev); int uevent_dispatch(int (*store_uev)(struct uevent *, void * trigger_data), - void * trigger_data); + void * trigger_data); int uevent_get_major(struct uevent *uev); Index: multipath-tools-130222/multipathd/main.c =================================================================== @@ -92,36 +92,36 @@ Index: multipath-tools-130222/multipathd/main.c { - if (uevent_listen()) + if (uevent_listen(udev)) - condlog(0, "error starting uevent listener"); - - return NULL; + condlog(0, "error starting uevent listener"); + + return NULL; @@ -1593,7 +1593,7 @@ static int child (void * param) { - pthread_t check_thr, uevent_thr, uxlsnr_thr, uevq_thr; + pthread_t check_thr, uevent_thr, uxlsnr_thr, uevq_thr; - pthread_attr_t log_attr, misc_attr; + pthread_attr_t log_attr, misc_attr, uevent_attr; - struct vectors * vecs; - struct multipath * mpp; - int i; + struct vectors * vecs; + struct multipath * mpp; + int i; @@ -1606,6 +1606,7 @@ child (void * param) - udev = udev_new(); - - setup_thread_attr(&misc_attr, 64 * 1024, 1); + udev = udev_new(); + + setup_thread_attr(&misc_attr, 64 * 1024, 1); + setup_thread_attr(&uevent_attr, 128 * 1024, 1); - setup_thread_attr(&waiter_attr, 32 * 1024, 1); - - if (logsink) { + setup_thread_attr(&waiter_attr, 32 * 1024, 1); + + if (logsink) { @@ -1671,10 +1672,11 @@ child (void * param) - /* - * Start uevent listener early to catch events - */ + /* + * Start uevent listener early to catch events + */ - if ((rc = pthread_create(&uevent_thr, &misc_attr, ueventloop, vecs))) { + if ((rc = pthread_create(&uevent_thr, &uevent_attr, ueventloop, udev))) { - condlog(0, "failed to create uevent thread: %d", rc); - exit(1); - } + condlog(0, "failed to create uevent thread: %d", rc); + exit(1); + } + pthread_attr_destroy(&uevent_attr); - if ((rc = pthread_create(&uxlsnr_thr, &misc_attr, uxlsnrloop, vecs))) { - condlog(0, "failed to create cli listener: %d", rc); - exit(1); + if ((rc = pthread_create(&uxlsnr_thr, &misc_attr, uxlsnrloop, vecs))) { + condlog(0, "failed to create cli listener: %d", rc); + exit(1); diff --git a/SOURCES/0061-RH-display-find-mpaths.patch b/SOURCES/0061-RH-display-find-mpaths.patch index 9899c252..05c63f08 100644 --- a/SOURCES/0061-RH-display-find-mpaths.patch +++ b/SOURCES/0061-RH-display-find-mpaths.patch @@ -12,5 +12,6 @@ Index: multipath-tools-130222/libmultipath/dict.c { - if (conf->find_multipaths == DEFAULT_FIND_MULTIPATHS) - return 0; - if (!conf->find_multipaths) - return snprintf(buff, len, "no"); + if (!conf->find_multipaths) + return snprintf(buff, len, "no"); + diff --git a/SOURCES/0062-RH-dont-free-vecs.patch b/SOURCES/0062-RH-dont-free-vecs.patch index 41992a70..f1c32174 100644 --- a/SOURCES/0062-RH-dont-free-vecs.patch +++ b/SOURCES/0062-RH-dont-free-vecs.patch @@ -7,21 +7,22 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -1735,8 +1735,9 @@ child (void * param) - vecs->pathvec = NULL; - unlock(vecs->lock); - /* Now all the waitevent threads will start rushing in. */ + vecs->pathvec = NULL; + unlock(vecs->lock); + /* Now all the waitevent threads will start rushing in. */ + /* freeing vecs isn't worth the races - while (vecs->lock.depth > 0) { + while (vecs->lock.depth > 0) { - sleep (1); /* This is weak. */ + sleep (1); - condlog(3, "Have %d wait event checkers threads to de-alloc," - " waiting...", vecs->lock.depth); - } + condlog(3, "Have %d wait event checkers threads to de-alloc," + " waiting...", vecs->lock.depth); + } @@ -1746,7 +1747,7 @@ child (void * param) - vecs->lock.mutex = NULL; - FREE(vecs); - vecs = NULL; + vecs->lock.mutex = NULL; + FREE(vecs); + vecs = NULL; - + */ - cleanup_checkers(); - cleanup_prio(); + cleanup_checkers(); + cleanup_prio(); + diff --git a/SOURCES/0063-RH-fix-warning.patch b/SOURCES/0063-RH-fix-warning.patch index a9e6d8e5..7db80564 100644 --- a/SOURCES/0063-RH-fix-warning.patch +++ b/SOURCES/0063-RH-fix-warning.patch @@ -7,20 +7,20 @@ Index: multipath-tools-130222/kpartx/dasd.c --- multipath-tools-130222.orig/kpartx/dasd.c +++ multipath-tools-130222/kpartx/dasd.c @@ -46,6 +46,8 @@ unsigned long long sectors512(unsigned l - return sectors * (blocksize >> 9); + return sectors * (blocksize >> 9); } - + +typedef unsigned int __attribute__((__may_alias__)) label_ints_t; + /* */ - int + int @@ -169,7 +171,7 @@ read_dasd_pt(int fd, struct slice all, s - /* - * VM style CMS1 labeled disk - */ + /* + * VM style CMS1 labeled disk + */ - unsigned int *label = (unsigned int *) &vlabel; + label_ints_t *label = (label_ints_t *) &vlabel; - - blocksize = label[4]; - if (label[14] != 0) { + + blocksize = label[4]; + if (label[14] != 0) { diff --git a/SOURCES/0064-RHBZ-1010040-fix-ID_FS-attrs.patch b/SOURCES/0064-RHBZ-1010040-fix-ID_FS-attrs.patch index 95ba7c9c..cb59a854 100644 --- a/SOURCES/0064-RHBZ-1010040-fix-ID_FS-attrs.patch +++ b/SOURCES/0064-RHBZ-1010040-fix-ID_FS-attrs.patch @@ -6,7 +6,7 @@ multipath/main.c | 36 +++++++++++++++- multipath/multipath.rules | 26 +++++++++--- multipathd/main.c | 4 + - multipathd/multipathd.service | 2 + multipathd/multipathd.service | 2 multipathd/pidfile.c | 3 + 9 files changed, 160 insertions(+), 13 deletions(-) @@ -16,7 +16,7 @@ Index: multipath-tools-130222/libmultipath/defaults.h +++ multipath-tools-130222/libmultipath/defaults.h @@ -24,7 +24,8 @@ #define MAX_CHECKINT(a) (a << 2) - + #define MAX_DEV_LOSS_TMO 0x7FFFFFFF -#define DEFAULT_PIDFILE "/var/run/multipathd.pid" +#define DEFAULT_PIDFILE "/var/run/multipathd/multipathd.pid" @@ -33,28 +33,28 @@ Index: multipath-tools-130222/libmultipath/file.c #include #include +#include - + #include "file.h" #include "debug.h" #include "uxsock.h" +#include "defaults.h" - - + + /* @@ -36,8 +38,8 @@ * See the file COPYING included with this distribution for more details. */ - + -static int -ensure_directories_exist(char *str, mode_t dir_mode) +int +ensure_directories_exist(const char *str, mode_t dir_mode) { - char *pathname; - char *end; + char *pathname; + char *end; @@ -178,3 +180,86 @@ fail: - close(fd); - return -1; + close(fd); + return -1; } + +/* If you can't get the timestamp, return equal to just keep using the @@ -144,13 +144,13 @@ Index: multipath-tools-130222/libmultipath/file.h --- multipath-tools-130222.orig/libmultipath/file.h +++ multipath-tools-130222/libmultipath/file.h @@ -7,5 +7,8 @@ - + #define FILE_TIMEOUT 30 int open_file(char *file, int *can_write, char *header); +int ensure_directories_exist(const char *str, mode_t dir_mode); +int update_timestamp(int create); +int timestamp_equal(long int chk_timestamp); - + #endif /* _FILE_H */ Index: multipath-tools-130222/multipathd/pidfile.c =================================================================== @@ -158,79 +158,79 @@ Index: multipath-tools-130222/multipathd/pidfile.c +++ multipath-tools-130222/multipathd/pidfile.c @@ -9,6 +9,7 @@ #include /* for fcntl() */ - + #include +#include - + #include "pidfile.h" - + @@ -18,6 +19,8 @@ int pidfile_create(const char *pidFile, - struct flock lock; - int fd, value; - + struct flock lock; + int fd, value; + + if (ensure_directories_exist(pidFile, 0700)) + return 1; - if((fd = open(pidFile, O_WRONLY | O_CREAT, - (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) < 0) { - condlog(0, "Cannot open pidfile [%s], error was [%s]", + if((fd = open(pidFile, O_WRONLY | O_CREAT, + (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) < 0) { + condlog(0, "Cannot open pidfile [%s], error was [%s]", Index: multipath-tools-130222/libmultipath/wwids.c =================================================================== --- multipath-tools-130222.orig/libmultipath/wwids.c +++ multipath-tools-130222/libmultipath/wwids.c @@ -125,6 +125,7 @@ replace_wwids(vector mp) - goto out_file; - } - ret = 0; + goto out_file; + } + ret = 0; + update_timestamp(0); out_file: - close(fd); + close(fd); out: @@ -209,6 +210,8 @@ remove_wwid(char *wwid) { - goto out_file; - } - ret = do_remove_wwid(fd, str); + goto out_file; + } + ret = do_remove_wwid(fd, str); + if (!ret) + update_timestamp(0); - + out_file: - close(fd); + close(fd); @@ -294,8 +297,10 @@ remember_wwid(char *wwid) - condlog(3, "failed writing wwid %s to wwids file", wwid); - return -1; - } + condlog(3, "failed writing wwid %s to wwids file", wwid); + return -1; + } - if (ret == 1) + if (ret == 1) { - condlog(3, "wrote wwid %s to wwids file", wwid); + condlog(3, "wrote wwid %s to wwids file", wwid); + update_timestamp(0); + } - else - condlog(4, "wwid %s already in wwids file", wwid); - return 0; + else + condlog(4, "wwid %s already in wwids file", wwid); + return 0; Index: multipath-tools-130222/multipath/multipath.rules =================================================================== --- multipath-tools-130222.orig/multipath/multipath.rules +++ multipath-tools-130222/multipath/multipath.rules @@ -4,18 +4,34 @@ SUBSYSTEM!="block", GOTO="end_mpath" - + IMPORT{cmdline}="nompath" ENV{nompath}=="?*", GOTO="end_mpath" +ENV{DEVTYPE}=="partition", GOTO="end_mpath" ENV{MPATH_SBIN_PATH}="/sbin" TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin" +TEST!="/etc/multipath.conf", GOTO="check_kpartx" - + -ACTION=="add", ENV{DEVTYPE}!="partition", \ - ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \ - TEST=="/etc/multipath.conf", \ +ACTION=="add", ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \ - PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \ + PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \ - ENV{DM_MULTIPATH_DEVICE_PATH}="1" ENV{ID_FS_TYPE}="mpath_member" + ENV{DM_MULTIPATH_DEVICE_PATH}="1", ENV{ID_FS_TYPE}="mpath_member" - + -ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DEVTYPE}!="partition", \ +ENV{DM_MULTIPATH_DEVICE_PATH}=="1", \ - RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}" - + RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}" + +ACTION!="change", GOTO="update_timestamp" +IMPORT{db}="DM_MULTIPATH_TIMESTAMP" +IMPORT{db}="DM_MULTIPATH_DEVICE_PATH" @@ -259,39 +259,39 @@ Index: multipath-tools-130222/multipathd/main.c #include #include +#include - + #include "main.h" #include "pidfile.h" @@ -1417,6 +1418,7 @@ reconfigure (struct vectors * vecs) - free_config(old); - retval = 0; - } + free_config(old); + retval = 0; + } + update_timestamp(0); - - return retval; + + return retval; } @@ -1709,6 +1711,7 @@ child (void * param) - - /* Startup complete, create logfile */ - pid_rc = pidfile_create(DEFAULT_PIDFILE, daemon_pid); + + /* Startup complete, create logfile */ + pid_rc = pidfile_create(DEFAULT_PIDFILE, daemon_pid); + update_timestamp(1); - /* Ignore errors, we can live without */ - - running_state = DAEMON_RUNNING; + /* Ignore errors, we can live without */ + + running_state = DAEMON_RUNNING; @@ -1758,6 +1761,7 @@ child (void * param) - if (!pid_rc) { - condlog(3, "unlink pidfile"); - unlink(DEFAULT_PIDFILE); + if (!pid_rc) { + condlog(3, "unlink pidfile"); + unlink(DEFAULT_PIDFILE); + unlink(DEFAULT_TIMESTAMP_FILE); - } - - condlog(2, "--------shut down-------"); + } + + condlog(2, "--------shut down-------"); Index: multipath-tools-130222/multipathd/multipathd.service =================================================================== --- multipath-tools-130222.orig/multipathd/multipathd.service +++ multipath-tools-130222/multipathd/multipathd.service @@ -9,7 +9,7 @@ Conflicts=shutdown.target - + [Service] Type=forking -PIDFile=/var/run/multipathd.pid @@ -309,31 +309,31 @@ Index: multipath-tools-130222/multipath/main.c #include +#include #include "dev_t.h" - + int logsink; @@ -84,7 +85,7 @@ usage (char * progname) { - fprintf (stderr, VERSION_STRING); - fprintf (stderr, "Usage:\n"); + fprintf (stderr, VERSION_STRING); + fprintf (stderr, "Usage:\n"); - fprintf (stderr, " %s [-c|-w|-W] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); + fprintf (stderr, " %s [-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); - fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); - fprintf (stderr, " %s -F [-v lvl]\n", progname); - fprintf (stderr, " %s -t\n", progname); + fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); + fprintf (stderr, " %s -F [-v lvl]\n", progname); + fprintf (stderr, " %s -t\n", progname); @@ -98,6 +99,9 @@ usage (char * progname) - " -f flush a multipath device map\n" \ - " -F flush all multipath device maps\n" \ - " -c check if a device should be a path in a multipath device\n" \ + " -f flush a multipath device map\n" \ + " -F flush all multipath device maps\n" \ + " -c check if a device should be a path in a multipath device\n" \ + " -T tm:val\n" \ + " check if tm matches the multipathd timestamp. If so val is\n" \ + " whether or not the device is a path in a multipath device\n" \ - " -q allow queue_if_no_path when multipathd is not running\n"\ - " -d dry run, do not create or update devmaps\n" \ - " -t dump internal hardware table\n" \ + " -q allow queue_if_no_path when multipathd is not running\n"\ + " -d dry run, do not create or update devmaps\n" \ + " -t dump internal hardware table\n" \ @@ -441,7 +445,31 @@ main (int argc, char *argv[]) - extern char *optarg; - extern int optind; - int r = 1; + extern char *optarg; + extern int optind; + int r = 1; - + long int timestamp = -1; + int valid = -1; @@ -360,24 +360,24 @@ Index: multipath-tools-130222/multipath/main.c + } + } + optind = 1; - if (getuid() != 0) { - fprintf(stderr, "need to be root\n"); - exit(1); + if (getuid() != 0) { + fprintf(stderr, "need to be root\n"); + exit(1); @@ -455,7 +483,7 @@ main (int argc, char *argv[]) - if (dm_prereq()) - exit(1); - + if (dm_prereq()) + exit(1); + - while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtqwW")) != EOF ) { + while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { - switch(arg) { - case 1: printf("optarg : %s\n",optarg); - break; + switch(arg) { + case 1: printf("optarg : %s\n",optarg); + break; @@ -517,6 +545,8 @@ main (int argc, char *argv[]) - case 't': - r = dump_config(); - goto out; + case 't': + r = dump_config(); + goto out; + case 'T': + break; - case 'h': - usage(argv[0]); - exit(0); + case 'h': + usage(argv[0]); + exit(0); diff --git a/SOURCES/0065-UPBZ-995538-fail-rdac-on-unavailable.patch b/SOURCES/0065-UPBZ-995538-fail-rdac-on-unavailable.patch index 12242485..ca72b613 100644 --- a/SOURCES/0065-UPBZ-995538-fail-rdac-on-unavailable.patch +++ b/SOURCES/0065-UPBZ-995538-fail-rdac-on-unavailable.patch @@ -7,15 +7,15 @@ Index: multipath-tools-130222/libmultipath/checkers/rdac.c --- multipath-tools-130222.orig/libmultipath/checkers/rdac.c +++ multipath-tools-130222/libmultipath/checkers/rdac.c @@ -222,10 +222,9 @@ libcheck_check (struct checker * c) - goto done; - } - + goto done; + } + - /* check if controller is in service mode */ + /* check if controller is reporting asymmetric access state of unavailable */ - if ((inq.avtcvp & 0x10) && + if ((inq.avtcvp & 0x10) && - ((inq.asym_access_state_cur & 0x0F) == 0x3) && - (inq.vendor_specific_cur == 0x7)) { + ((inq.asym_access_state_cur & 0x0F) == 0x3)) { - ret = PATH_DOWN; - goto done; - } + ret = PATH_DOWN; + goto done; + } diff --git a/SOURCES/0066-UP-dos-4k-partition-fix.patch b/SOURCES/0066-UP-dos-4k-partition-fix.patch index 3d906011..a2d1b441 100644 --- a/SOURCES/0066-UP-dos-4k-partition-fix.patch +++ b/SOURCES/0066-UP-dos-4k-partition-fix.patch @@ -10,62 +10,62 @@ Index: multipath-tools-130222/kpartx/dos.c --- multipath-tools-130222.orig/kpartx/dos.c +++ multipath-tools-130222/kpartx/dos.c @@ -26,7 +26,9 @@ read_extended_partition(int fd, struct p - int moretodo = 1; - int i, n=0; - + int moretodo = 1; + int i, n=0; + - next = start = le32_to_cpu(ep->start_sect); + int sector_size_mul = get_sector_size(fd)/512; + + next = start = sector_size_mul * le32_to_cpu(ep->start_sect); - - while (moretodo) { - here = next; + + while (moretodo) { + here = next; @@ -45,14 +47,14 @@ read_extended_partition(int fd, struct p - memcpy(&p, bp + 0x1be + i * sizeof (p), sizeof (p)); - if (is_extended(p.sys_type)) { - if (p.nr_sects && !moretodo) { + memcpy(&p, bp + 0x1be + i * sizeof (p), sizeof (p)); + if (is_extended(p.sys_type)) { + if (p.nr_sects && !moretodo) { - next = start + le32_to_cpu(p.start_sect); + next = start + sector_size_mul * le32_to_cpu(p.start_sect); - moretodo = 1; - } - continue; - } - if (n < ns) { + moretodo = 1; + } + continue; + } + if (n < ns) { - sp[n].start = here + le32_to_cpu(p.start_sect); - sp[n].size = le32_to_cpu(p.nr_sects); + sp[n].start = here + sector_size_mul * le32_to_cpu(p.start_sect); + sp[n].size = sector_size_mul * le32_to_cpu(p.nr_sects); - n++; - } else { - fprintf(stderr, + n++; + } else { + fprintf(stderr, @@ -76,6 +78,7 @@ read_dos_pt(int fd, struct slice all, st - unsigned long offset = all.start; - int i, n=4; - unsigned char *bp; + unsigned long offset = all.start; + int i, n=4; + unsigned char *bp; + int sector_size_mul = get_sector_size(fd)/512; - - bp = (unsigned char *)getblock(fd, offset); - if (bp == NULL) + + bp = (unsigned char *)getblock(fd, offset); + if (bp == NULL) @@ -89,8 +92,8 @@ read_dos_pt(int fd, struct slice all, st - if (is_gpt(p.sys_type)) - return 0; - if (i < ns) { + if (is_gpt(p.sys_type)) + return 0; + if (i < ns) { - sp[i].start = le32_to_cpu(p.start_sect); - sp[i].size = le32_to_cpu(p.nr_sects); + sp[i].start = sector_size_mul * le32_to_cpu(p.start_sect); + sp[i].size = sector_size_mul * le32_to_cpu(p.nr_sects); - } else { - fprintf(stderr, - "dos_partition: too many slices\n"); + } else { + fprintf(stderr, + "dos_partition: too many slices\n"); @@ -99,7 +102,7 @@ read_dos_pt(int fd, struct slice all, st - if (is_extended(p.sys_type)) { - n += read_extended_partition(fd, &p, sp+n, ns-n); - /* hide the extended partition itself */ + if (is_extended(p.sys_type)) { + n += read_extended_partition(fd, &p, sp+n, ns-n); + /* hide the extended partition itself */ - sp[i].size = 2; + sp[i].size = sector_size_mul * 2; - } - } - return n; + } + } + return n; Index: multipath-tools-130222/kpartx/gpt.c =================================================================== --- multipath-tools-130222.orig/kpartx/gpt.c @@ -75,12 +75,12 @@ Index: multipath-tools-130222/kpartx/gpt.c #include #include "crc32.h" +#include "kpartx.h" - + #if BYTE_ORDER == LITTLE_ENDIAN # define __le16_to_cpu(x) (x) @@ -116,25 +117,6 @@ is_pmbr_valid(legacy_mbr *mbr) - - + + /************************************************************ - * get_sector_size - * Requires: @@ -117,8 +117,8 @@ Index: multipath-tools-130222/kpartx/kpartx.c #include #include @@ -606,3 +607,14 @@ getblock (int fd, unsigned int secnr) { - - return bp->block; + + return bp->block; } + +int @@ -137,16 +137,16 @@ Index: multipath-tools-130222/kpartx/kpartx.h +++ multipath-tools-130222/kpartx/kpartx.h @@ -2,6 +2,7 @@ #define _KPARTX_H - + #include +#include - + /* * For each partition type there is a routine that takes @@ -18,6 +19,13 @@ #define safe_sprintf(var, format, args...) \ - snprintf(var, sizeof(var), format, ##args) >= sizeof(var) - + snprintf(var, sizeof(var), format, ##args) >= sizeof(var) + +#ifndef BLKSSZGET +#define BLKSSZGET _IO(0x12,104) /* get block device sector size */ +#endif diff --git a/SOURCES/0067-RHBZ-1022899-fix-udev-partition-handling.patch b/SOURCES/0067-RHBZ-1022899-fix-udev-partition-handling.patch index c86c5c27..6f0a3d8b 100644 --- a/SOURCES/0067-RHBZ-1022899-fix-udev-partition-handling.patch +++ b/SOURCES/0067-RHBZ-1022899-fix-udev-partition-handling.patch @@ -7,13 +7,13 @@ Index: multipath-tools-130222/multipath/multipath.rules --- multipath-tools-130222.orig/multipath/multipath.rules +++ multipath-tools-130222/multipath/multipath.rules @@ -13,12 +13,13 @@ ACTION=="add", ENV{DM_MULTIPATH_DEVICE_P - PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \ - ENV{DM_MULTIPATH_DEVICE_PATH}="1", ENV{ID_FS_TYPE}="mpath_member" - + PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \ + ENV{DM_MULTIPATH_DEVICE_PATH}="1", ENV{ID_FS_TYPE}="mpath_member" + -ENV{DM_MULTIPATH_DEVICE_PATH}=="1", \ +ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DM_MULTIPATH_WIPE_PARTS}="1", \ - RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}" - + RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}" + ACTION!="change", GOTO="update_timestamp" IMPORT{db}="DM_MULTIPATH_TIMESTAMP" IMPORT{db}="DM_MULTIPATH_DEVICE_PATH" @@ -22,16 +22,16 @@ Index: multipath-tools-130222/multipath/multipath.rules # the old result if the timestamp hasn't changed. PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -T $env{DM_MULTIPATH_TIMESTAMP}:$env{DM_MULTIPATH_DEVICE_PATH} -c $env{DEVNAME}", \ @@ -27,8 +28,13 @@ PROGRAM=="$env{MPATH_SBIN_PATH}/multipat - + # If the device isn't part of a multipath device, clear this ENV{DM_MULTIPATH_DEVICE_PATH}="" +ENV{DM_MULTIPATH_WIPE_PARTS}="" - + LABEL="update_timestamp" +ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DM_MULTIPATH_WIPE_PARTS}!="1", \ + ENV{DM_MULTIPATH_WIPE_PARTS}="1", \ + RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}" + IMPORT{file}="/run/multipathd/timestamp" - + LABEL="check_kpartx" diff --git a/SOURCES/0068-RHBZ-1034578-label-partition-devices.patch b/SOURCES/0068-RHBZ-1034578-label-partition-devices.patch index 9b0f4f5a..e8008f7d 100644 --- a/SOURCES/0068-RHBZ-1034578-label-partition-devices.patch +++ b/SOURCES/0068-RHBZ-1034578-label-partition-devices.patch @@ -7,7 +7,7 @@ Index: multipath-tools-130222/multipath/multipath.rules --- multipath-tools-130222.orig/multipath/multipath.rules +++ multipath-tools-130222/multipath/multipath.rules @@ -4,7 +4,8 @@ SUBSYSTEM!="block", GOTO="end_mpath" - + IMPORT{cmdline}="nompath" ENV{nompath}=="?*", GOTO="end_mpath" -ENV{DEVTYPE}=="partition", GOTO="end_mpath" diff --git a/SOURCES/0069-UPBZ-1033791-improve-rdac-checker.patch b/SOURCES/0069-UPBZ-1033791-improve-rdac-checker.patch index 8eec7225..c838f29f 100644 --- a/SOURCES/0069-UPBZ-1033791-improve-rdac-checker.patch +++ b/SOURCES/0069-UPBZ-1033791-improve-rdac-checker.patch @@ -1,6 +1,6 @@ --- libmultipath/checkers/rdac.c | 91 ++++++++++++++++++++++++++++++++++++++----- - libmultipath/discovery.c | 2 + libmultipath/discovery.c | 2 2 files changed, 81 insertions(+), 12 deletions(-) Index: multipath-tools-130222/libmultipath/checkers/rdac.c @@ -23,24 +23,24 @@ Index: multipath-tools-130222/libmultipath/checkers/rdac.c +#define RTPG_UNAVAIL_CFW_DL2 0x5 +#define RTPG_UNAVAIL_QUIESCED 0x6 +#define RTPG_UNAVAIL_SERVICE_MODE 0x7 - + struct control_mode_page { - unsigned char header[8]; + unsigned char header[8]; @@ -199,22 +211,64 @@ struct volume_access_inq - char PQ_PDT; - char dontcare0[7]; - char avtcvp; + char PQ_PDT; + char dontcare0[7]; + char avtcvp; - char dontcare1; - char asym_access_state_cur; + char vol_ppp; + char aas_cur; - char vendor_specific_cur; + char vendor_specific_cur; - char dontcare2[36]; + char aas_alt; + char vendor_specific_alt; + char dontcare1[34]; }; - + +const char +*checker_msg_string(struct volume_access_inq *inq) +{ @@ -82,23 +82,23 @@ Index: multipath-tools-130222/libmultipath/checkers/rdac.c extern int libcheck_check (struct checker * c) { - struct volume_access_inq inq; + struct volume_access_inq inq; - int ret; + int ret, inqfail; - + + inqfail = 0; - memset(&inq, 0, sizeof(struct volume_access_inq)); - if (0 != do_inq(c->fd, 0xC9, &inq, sizeof(struct volume_access_inq), - c->timeout)) { - ret = PATH_DOWN; + memset(&inq, 0, sizeof(struct volume_access_inq)); + if (0 != do_inq(c->fd, 0xC9, &inq, sizeof(struct volume_access_inq), + c->timeout)) { + ret = PATH_DOWN; + inqfail = 1; - goto done; - } else if (((inq.PQ_PDT & 0xE0) == 0x20) || (inq.PQ_PDT & 0x7f)) { - /* LUN not connected*/ + goto done; + } else if (((inq.PQ_PDT & 0xE0) == 0x20) || (inq.PQ_PDT & 0x7f)) { + /* LUN not connected*/ @@ -222,11 +276,27 @@ libcheck_check (struct checker * c) - goto done; - } - + goto done; + } + - /* check if controller is reporting asymmetric access state of unavailable */ - if ((inq.avtcvp & 0x10) && - ((inq.asym_access_state_cur & 0x0F) == 0x3)) { @@ -125,28 +125,29 @@ Index: multipath-tools-130222/libmultipath/checkers/rdac.c + } + break; + } - } - - /* If owner set or ioship mode is enabled return PATH_UP always */ + } + + /* If owner set or ioship mode is enabled return PATH_UP always */ @@ -238,7 +308,8 @@ libcheck_check (struct checker * c) done: - switch (ret) { - case PATH_DOWN: + switch (ret) { + case PATH_DOWN: - MSG(c, MSG_RDAC_DOWN); + MSG(c, (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") : + checker_msg_string(&inq)); - break; - case PATH_UP: - MSG(c, MSG_RDAC_UP); + break; + case PATH_UP: + MSG(c, MSG_RDAC_UP); Index: multipath-tools-130222/libmultipath/discovery.c =================================================================== --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -1116,8 +1116,6 @@ pathinfo (struct path *pp, vector hwtabl - if (!strlen(pp->wwid)) - get_uid(pp); - get_prio(pp); + if (!strlen(pp->wwid)) + get_uid(pp); + get_prio(pp); - } else { - pp->priority = PRIO_UNDEF; - } - } + } + } + diff --git a/SOURCES/0070-RHBZ-1036503-blacklist-td-devs.patch b/SOURCES/0070-RHBZ-1036503-blacklist-td-devs.patch index 543c0f13..ffcae46c 100644 --- a/SOURCES/0070-RHBZ-1036503-blacklist-td-devs.patch +++ b/SOURCES/0070-RHBZ-1036503-blacklist-td-devs.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/libmultipath/blacklist.c --- multipath-tools-130222.orig/libmultipath/blacklist.c +++ multipath-tools-130222/libmultipath/blacklist.c @@ -163,7 +163,7 @@ setup_default_blist (struct config * con - if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT)) - return 1; - + if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT)) + return 1; + - str = STRDUP("^hd[a-z]"); + str = STRDUP("^(td|hd)[a-z]"); - if (!str) - return 1; - if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT)) + if (!str) + return 1; + if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT)) diff --git a/SOURCES/0071-RHBZ-1031546-strip-dev.patch b/SOURCES/0071-RHBZ-1031546-strip-dev.patch index 2a074777..64118c24 100644 --- a/SOURCES/0071-RHBZ-1031546-strip-dev.patch +++ b/SOURCES/0071-RHBZ-1031546-strip-dev.patch @@ -10,9 +10,9 @@ Index: multipath-tools-130222/libmultipath/util.c --- multipath-tools-130222.orig/libmultipath/util.c +++ multipath-tools-130222/libmultipath/util.c @@ -236,6 +236,28 @@ skip_proc: - return 0; + return 0; } - + +/* This function returns a pointer inside of the supplied pathname string. + * If is_path_device is true, it may also modify the supplied string */ +char *convert_dev(char *name, int is_path_device) @@ -37,7 +37,7 @@ Index: multipath-tools-130222/libmultipath/util.c + dev_t parse_devt(const char *dev_t) { - int maj, min; + int maj, min; Index: multipath-tools-130222/libmultipath/util.h =================================================================== --- multipath-tools-130222.orig/libmultipath/util.h @@ -47,17 +47,17 @@ Index: multipath-tools-130222/libmultipath/util.h int devt2devname (char *, int, char *); dev_t parse_devt(const char *dev_t); +char *convert_dev(char *dev, int is_path_device); - + #define safe_sprintf(var, format, args...) \ - snprintf(var, sizeof(var), format, ##args) >= sizeof(var) + snprintf(var, sizeof(var), format, ##args) >= sizeof(var) Index: multipath-tools-130222/multipath/main.c =================================================================== --- multipath-tools-130222.orig/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -254,16 +254,7 @@ configure (void) - vecs.pathvec = pathvec; - vecs.mpvec = curmp; - + vecs.pathvec = pathvec; + vecs.mpvec = curmp; + - /* - * dev is "/dev/" . "sysfs block dev" - */ @@ -69,13 +69,13 @@ Index: multipath-tools-130222/multipath/main.c - dev = conf->dev; - } + dev = convert_dev(conf->dev, (conf->dev_type == DEV_DEVNODE)); - - /* - * if we have a blacklisted device parameter, exit early + + /* + * if we have a blacklisted device parameter, exit early @@ -427,16 +418,6 @@ get_dev_type(char *dev) { - return DEV_DEVMAP; + return DEV_DEVMAP; } - + -static void -convert_dev(char *dev) -{ @@ -90,158 +90,159 @@ Index: multipath-tools-130222/multipath/main.c main (int argc, char *argv[]) { @@ -577,8 +558,6 @@ main (int argc, char *argv[]) - - strncpy(conf->dev, argv[optind], FILE_NAME_SIZE); - conf->dev_type = get_dev_type(conf->dev); + + strncpy(conf->dev, argv[optind], FILE_NAME_SIZE); + conf->dev_type = get_dev_type(conf->dev); - if (conf->dev_type == DEV_DEVNODE) - convert_dev(conf->dev); - } - conf->daemon = 0; - + } + conf->daemon = 0; + Index: multipath-tools-130222/multipathd/cli_handlers.c =================================================================== --- multipath-tools-130222.orig/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -235,6 +235,7 @@ cli_list_map_topology (void * v, char ** - struct vectors * vecs = (struct vectors *)data; - char * param = get_keyparam(v, MAP); - + struct vectors * vecs = (struct vectors *)data; + char * param = get_keyparam(v, MAP); + + param = convert_dev(param, 0); - get_path_layout(vecs->pathvec, 0); - mpp = find_mp_by_str(vecs->mpvec, param); - + get_path_layout(vecs->pathvec, 0); + mpp = find_mp_by_str(vecs->mpvec, param); + @@ -416,6 +417,7 @@ cli_add_path (void * v, char ** reply, i - struct path *pp; - int r; - + struct path *pp; + int r; + + param = convert_dev(param, 1); - condlog(2, "%s: add path (operator)", param); - - if (filter_devnode(conf->blist_devnode, conf->elist_devnode, + condlog(2, "%s: add path (operator)", param); + + if (filter_devnode(conf->blist_devnode, conf->elist_devnode, @@ -459,6 +461,7 @@ cli_del_path (void * v, char ** reply, i - char * param = get_keyparam(v, PATH); - struct path *pp; - + char * param = get_keyparam(v, PATH); + struct path *pp; + + param = convert_dev(param, 1); - condlog(2, "%s: remove path (operator)", param); - pp = find_path_by_dev(vecs->pathvec, param); - if (!pp) { + condlog(2, "%s: remove path (operator)", param); + pp = find_path_by_dev(vecs->pathvec, param); + if (!pp) { @@ -478,6 +481,7 @@ cli_add_map (void * v, char ** reply, in - char *alias; - int rc; - + char *alias; + int rc; + + param = convert_dev(param, 0); - condlog(2, "%s: add map (operator)", param); - - if (filter_wwid(conf->blist_wwid, conf->elist_wwid, param) > 0) { + condlog(2, "%s: add map (operator)", param); + + if (filter_wwid(conf->blist_wwid, conf->elist_wwid, param) > 0) { @@ -518,6 +522,7 @@ cli_del_map (void * v, char ** reply, in - char *alias; - int rc; - + char *alias; + int rc; + + param = convert_dev(param, 0); - condlog(2, "%s: remove map (operator)", param); - minor = dm_get_minor(param); - if (minor < 0) { + condlog(2, "%s: remove map (operator)", param); + minor = dm_get_minor(param); + if (minor < 0) { @@ -549,6 +554,7 @@ cli_reload(void *v, char **reply, int *l - struct multipath *mpp; - int minor; - + struct multipath *mpp; + int minor; + + mapname = convert_dev(mapname, 0); - condlog(2, "%s: reload map (operator)", mapname); - if (sscanf(mapname, "dm-%d", &minor) == 1) - mpp = find_mp_by_minor(vecs->mpvec, minor); + condlog(2, "%s: reload map (operator)", mapname); + if (sscanf(mapname, "dm-%d", &minor) == 1) + mpp = find_mp_by_minor(vecs->mpvec, minor); @@ -591,6 +597,7 @@ cli_resize(void *v, char **reply, int *l - struct pathgroup *pgp; - struct path *pp; - + struct pathgroup *pgp; + struct path *pp; + + mapname = convert_dev(mapname, 0); - condlog(2, "%s: resize map (operator)", mapname); - if (sscanf(mapname, "dm-%d", &minor) == 1) - mpp = find_mp_by_minor(vecs->mpvec, minor); + condlog(2, "%s: resize map (operator)", mapname); + if (sscanf(mapname, "dm-%d", &minor) == 1) + mpp = find_mp_by_minor(vecs->mpvec, minor); @@ -665,6 +672,7 @@ cli_restore_queueing(void *v, char **rep - struct multipath *mpp; - int minor; - + struct multipath *mpp; + int minor; + + mapname = convert_dev(mapname, 0); - condlog(2, "%s: restore map queueing (operator)", mapname); - if (sscanf(mapname, "dm-%d", &minor) == 1) - mpp = find_mp_by_minor(vecs->mpvec, minor); + condlog(2, "%s: restore map queueing (operator)", mapname); + if (sscanf(mapname, "dm-%d", &minor) == 1) + mpp = find_mp_by_minor(vecs->mpvec, minor); @@ -716,6 +724,7 @@ cli_disable_queueing(void *v, char **rep - struct multipath *mpp; - int minor; - + struct multipath *mpp; + int minor; + + mapname = convert_dev(mapname, 0); - condlog(2, "%s: disable map queueing (operator)", mapname); - if (sscanf(mapname, "dm-%d", &minor) == 1) - mpp = find_mp_by_minor(vecs->mpvec, minor); + condlog(2, "%s: disable map queueing (operator)", mapname); + if (sscanf(mapname, "dm-%d", &minor) == 1) + mpp = find_mp_by_minor(vecs->mpvec, minor); @@ -753,6 +762,7 @@ cli_switch_group(void * v, char ** reply - char * mapname = get_keyparam(v, MAP); - int groupnum = atoi(get_keyparam(v, GROUP)); - + char * mapname = get_keyparam(v, MAP); + int groupnum = atoi(get_keyparam(v, GROUP)); + + mapname = convert_dev(mapname, 0); - condlog(2, "%s: switch to path group #%i (operator)", mapname, groupnum); - - return dm_switchgroup(mapname, groupnum); + condlog(2, "%s: switch to path group #%i (operator)", mapname, groupnum); + + return dm_switchgroup(mapname, groupnum); @@ -775,6 +785,7 @@ cli_suspend(void * v, char ** reply, int - char * param = get_keyparam(v, MAP); - int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param); - + char * param = get_keyparam(v, MAP); + int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param); + + param = convert_dev(param, 0); - condlog(2, "%s: suspend (operator)", param); - - if (!r) /* error */ + condlog(2, "%s: suspend (operator)", param); + + if (!r) /* error */ @@ -796,6 +807,7 @@ cli_resume(void * v, char ** reply, int - char * param = get_keyparam(v, MAP); - int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param); - + char * param = get_keyparam(v, MAP); + int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param); + + param = convert_dev(param, 0); - condlog(2, "%s: resume (operator)", param); - - if (!r) /* error */ + condlog(2, "%s: resume (operator)", param); + + if (!r) /* error */ @@ -817,6 +829,7 @@ cli_reinstate(void * v, char ** reply, i - char * param = get_keyparam(v, PATH); - struct path * pp; - + char * param = get_keyparam(v, PATH); + struct path * pp; + + param = convert_dev(param, 1); - pp = find_path_by_dev(vecs->pathvec, param); - - if (!pp) + pp = find_path_by_dev(vecs->pathvec, param); + + if (!pp) @@ -837,6 +850,7 @@ cli_reassign (void * v, char ** reply, i { - char * param = get_keyparam(v, MAP); - + char * param = get_keyparam(v, MAP); + + param = convert_dev(param, 0); - condlog(3, "%s: reset devices (operator)", param); - - dm_reassign(param); + condlog(3, "%s: reset devices (operator)", param); + + dm_reassign(param); @@ -851,6 +865,7 @@ cli_fail(void * v, char ** reply, int * - struct path * pp; - int r; - + struct path * pp; + int r; + + param = convert_dev(param, 1); - pp = find_path_by_dev(vecs->pathvec, param); - - if (!pp) + pp = find_path_by_dev(vecs->pathvec, param); + + if (!pp) @@ -962,6 +977,7 @@ cli_getprstatus (void * v, char ** reply - struct vectors * vecs = (struct vectors *)data; - char * param = get_keyparam(v, MAP); - + struct vectors * vecs = (struct vectors *)data; + char * param = get_keyparam(v, MAP); + + param = convert_dev(param, 0); - get_path_layout(vecs->pathvec, 0); - mpp = find_mp_by_str(vecs->mpvec, param); - + get_path_layout(vecs->pathvec, 0); + mpp = find_mp_by_str(vecs->mpvec, param); + @@ -991,6 +1007,7 @@ cli_setprstatus(void * v, char ** reply, - struct vectors * vecs = (struct vectors *)data; - char * param = get_keyparam(v, MAP); - + struct vectors * vecs = (struct vectors *)data; + char * param = get_keyparam(v, MAP); + + param = convert_dev(param, 0); - get_path_layout(vecs->pathvec, 0); - mpp = find_mp_by_str(vecs->mpvec, param); - + get_path_layout(vecs->pathvec, 0); + mpp = find_mp_by_str(vecs->mpvec, param); + @@ -1013,6 +1030,7 @@ cli_unsetprstatus(void * v, char ** repl - struct vectors * vecs = (struct vectors *)data; - char * param = get_keyparam(v, MAP); - + struct vectors * vecs = (struct vectors *)data; + char * param = get_keyparam(v, MAP); + + param = convert_dev(param, 0); - get_path_layout(vecs->pathvec, 0); - mpp = find_mp_by_str(vecs->mpvec, param); + get_path_layout(vecs->pathvec, 0); + mpp = find_mp_by_str(vecs->mpvec, param); + diff --git a/SOURCES/0072-RHBZ-1039199-check-loop-control.patch b/SOURCES/0072-RHBZ-1039199-check-loop-control.patch index 83f6f053..21bd0c37 100644 --- a/SOURCES/0072-RHBZ-1039199-check-loop-control.patch +++ b/SOURCES/0072-RHBZ-1039199-check-loop-control.patch @@ -9,7 +9,7 @@ Index: multipath-tools-130222/kpartx/lopart.c @@ -32,6 +32,10 @@ #include "lopart.h" #include "xstrncpy.h" - + +#ifndef LOOP_CTL_GET_FREE +#define LOOP_CTL_GET_FREE 0x4C82 +#endif @@ -18,15 +18,15 @@ Index: multipath-tools-130222/kpartx/lopart.c && !defined (__s390x__) #define int2ptr(x) ((void *) ((int) x)) @@ -140,14 +144,24 @@ find_unused_loop_device (void) - - char dev[20]; - char *loop_formats[] = { "/dev/loop%d", "/dev/loop/%d" }; + + char dev[20]; + char *loop_formats[] = { "/dev/loop%d", "/dev/loop/%d" }; - int i, j, fd, somedev = 0, someloop = 0, loop_known = 0; + int i, j, fd, first = 0, somedev = 0, someloop = 0, loop_known = 0; - struct stat statbuf; - struct loop_info loopinfo; - FILE *procdev; - + struct stat statbuf; + struct loop_info loopinfo; + FILE *procdev; + + if (stat("/dev/loop-control", &statbuf) == 0 && + S_ISCHR(statbuf.st_mode)) { + fd = open("/dev/loop-control", O_RDWR); @@ -37,10 +37,10 @@ Index: multipath-tools-130222/kpartx/lopart.c + if (first < 0) + first = 0; + } - for (j = 0; j < SIZE(loop_formats); j++) { - + for (j = 0; j < SIZE(loop_formats); j++) { + - for(i = 0; i < 256; i++) { + for(i = first; i < 256; i++) { - sprintf(dev, loop_formats[j], i); - - if (stat (dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) { + sprintf(dev, loop_formats[j], i); + + if (stat (dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) { diff --git a/SOURCES/0073-RH-update-build-flags.patch b/SOURCES/0073-RH-update-build-flags.patch index a1d78027..3ab72d00 100644 --- a/SOURCES/0073-RH-update-build-flags.patch +++ b/SOURCES/0073-RH-update-build-flags.patch @@ -9,12 +9,12 @@ Index: multipath-tools-130222/Makefile.inc +++ multipath-tools-130222/Makefile.inc @@ -39,7 +39,7 @@ GZIP = /bin/gzip -9 -c INSTALL_PROGRAM = install - + ifndef RPM_OPT_FLAGS - RPM_OPT_FLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 + RPM_OPT_FLAGS = -O2 -g -pipe -Wformat-security -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 endif - + LDFLAGS += -Wl,-z,relro Index: multipath-tools-130222/libmultipath/checkers/rdac.c =================================================================== @@ -22,12 +22,12 @@ Index: multipath-tools-130222/libmultipath/checkers/rdac.c +++ multipath-tools-130222/libmultipath/checkers/rdac.c @@ -308,8 +308,8 @@ libcheck_check (struct checker * c) done: - switch (ret) { - case PATH_DOWN: + switch (ret) { + case PATH_DOWN: - MSG(c, (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") : - checker_msg_string(&inq)); + MSG(c, "%s", (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") : + checker_msg_string(&inq)); - break; - case PATH_UP: - MSG(c, MSG_RDAC_UP); + break; + case PATH_UP: + MSG(c, MSG_RDAC_UP); diff --git a/SOURCES/0074-RHBZ-1056976-dm-mpath-rules.patch b/SOURCES/0074-RHBZ-1056976-dm-mpath-rules.patch index 15ceb2ad..9f6c880c 100644 --- a/SOURCES/0074-RHBZ-1056976-dm-mpath-rules.patch +++ b/SOURCES/0074-RHBZ-1056976-dm-mpath-rules.patch @@ -47,18 +47,18 @@ Index: multipath-tools-130222/multipath/Makefile --- multipath-tools-130222.orig/multipath/Makefile +++ multipath-tools-130222/multipath/Makefile @@ -25,6 +25,7 @@ install: - $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ - $(INSTALL_PROGRAM) -d $(DESTDIR)/usr/lib/udev/rules.d - $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules + $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) -d $(DESTDIR)/usr/lib/udev/rules.d + $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules + $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)/usr/lib/udev/rules.d/11-dm-mpath.rules - $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) @@ -33,6 +34,7 @@ install: - + uninstall: - rm $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules + rm $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules + rm $(DESTDIR)/usr/lib/udev/rules.d/11-dm-mpath.rules - rm $(DESTDIR)$(bindir)/$(EXEC) - rm $(DESTDIR)$(bindir)/mpathconf - rm $(DESTDIR)$(mandir)/$(EXEC).8.gz + rm $(DESTDIR)$(bindir)/$(EXEC) + rm $(DESTDIR)$(bindir)/mpathconf + rm $(DESTDIR)$(mandir)/$(EXEC).8.gz diff --git a/SOURCES/0075-RHBZ-1056976-reload-flag.patch b/SOURCES/0075-RHBZ-1056976-reload-flag.patch index a9f9981c..ee2cdee9 100644 --- a/SOURCES/0075-RHBZ-1056976-reload-flag.patch +++ b/SOURCES/0075-RHBZ-1056976-reload-flag.patch @@ -14,22 +14,22 @@ Index: multipath-tools-130222/kpartx/devmapper.c +++ multipath-tools-130222/kpartx/devmapper.c @@ -60,7 +60,7 @@ dm_prereq (char * str, int x, int y, int } - + extern int -dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie) { +dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie, uint16_t udev_flags) { - int r = 0; - int udev_wait_flag = (task == DM_DEVICE_RESUME || - task == DM_DEVICE_REMOVE); + int r = 0; + int udev_wait_flag = (task == DM_DEVICE_RESUME || + task == DM_DEVICE_REMOVE); @@ -78,7 +78,7 @@ dm_simplecmd (int task, const char *name - if (no_flush) - dm_task_no_flush(dmt); - + if (no_flush) + dm_task_no_flush(dmt); + - if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, (udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK)) + if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, ((udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK) | udev_flags)) - goto out; - r = dm_task_run(dmt); - + goto out; + r = dm_task_run(dmt); + Index: multipath-tools-130222/kpartx/devmapper.h =================================================================== --- multipath-tools-130222.orig/kpartx/devmapper.h @@ -37,7 +37,7 @@ Index: multipath-tools-130222/kpartx/devmapper.h @@ -2,10 +2,16 @@ #define MINOR(dev) ((dev & 0xff) | ((dev >> 12) & 0xfff00)) #define MKDEV(ma,mi) ((mi & 0xff) | (ma << 8) | ((mi & ~0xff) << 12)) - + +#ifdef DM_SUBSYSTEM_UDEV_FLAG0 +#define MPATH_UDEV_RELOAD_FLAG DM_SUBSYSTEM_UDEV_FLAG0 +#else @@ -45,159 +45,159 @@ Index: multipath-tools-130222/kpartx/devmapper.h +#endif + extern int udev_sync; - + int dm_prereq (char *, int, int, int); -int dm_simplecmd (int, const char *, int, uint32_t *); +int dm_simplecmd (int, const char *, int, uint32_t *, uint16_t); int dm_addmap (int, const char *, const char *, const char *, uint64_t, - int, const char *, int, mode_t, uid_t, gid_t, uint32_t *); + int, const char *, int, mode_t, uid_t, gid_t, uint32_t *); int dm_map_present (char *); Index: multipath-tools-130222/kpartx/kpartx.c =================================================================== --- multipath-tools-130222.orig/kpartx/kpartx.c +++ multipath-tools-130222/kpartx/kpartx.c @@ -421,7 +421,7 @@ main(int argc, char **argv){ - continue; - - if (!dm_simplecmd(DM_DEVICE_REMOVE, partname, + continue; + + if (!dm_simplecmd(DM_DEVICE_REMOVE, partname, - 0, &cookie)) { + 0, &cookie, 0)) { - r++; - continue; - } + r++; + continue; + } @@ -473,7 +473,7 @@ main(int argc, char **argv){ - } - if (op == DM_DEVICE_RELOAD && - !dm_simplecmd(DM_DEVICE_RESUME, partname, + } + if (op == DM_DEVICE_RELOAD && + !dm_simplecmd(DM_DEVICE_RESUME, partname, - 1, &cookie)) { + 1, &cookie, MPATH_UDEV_RELOAD_FLAG)) { - fprintf(stderr, "resume failed on %s\n", - partname); - r++; + fprintf(stderr, "resume failed on %s\n", + partname); + r++; @@ -505,7 +505,7 @@ main(int argc, char **argv){ - continue; - - if (!dm_simplecmd(DM_DEVICE_REMOVE, + continue; + + if (!dm_simplecmd(DM_DEVICE_REMOVE, - partname, 1, &cookie)) { + partname, 1, &cookie, 0)) { - r++; - continue; - } + r++; + continue; + } Index: multipath-tools-130222/libmultipath/configure.c =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -390,13 +390,13 @@ domap (struct multipath * mpp, char * pa - case ACT_RELOAD: - r = dm_addmap_reload(mpp, params); - if (r) + case ACT_RELOAD: + r = dm_addmap_reload(mpp, params); + if (r) - r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias); + r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, MPATH_UDEV_RELOAD_FLAG); - break; - - case ACT_RESIZE: - r = dm_addmap_reload(mpp, params); - if (r) + break; + + case ACT_RESIZE: + r = dm_addmap_reload(mpp, params); + if (r) - r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1); + r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1, 0); - break; - - case ACT_RENAME: + break; + + case ACT_RENAME: Index: multipath-tools-130222/libmultipath/devmapper.c =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -103,7 +103,9 @@ dm_lib_prereq (void) { - char version[64]; - int v[3]; + char version[64]; + int v[3]; -#ifdef LIBDM_API_COOKIE +#if defined(DM_SUBSYSTEM_UDEV_FLAG0) + int minv[3] = {1, 2, 82}; +#elif defined(LIBDM_API_COOKIE) - int minv[3] = {1, 2, 38}; + int minv[3] = {1, 2, 38}; #else - int minv[3] = {1, 2, 8}; + int minv[3] = {1, 2, 8}; @@ -200,7 +202,7 @@ dm_prereq (void) } - + static int -dm_simplecmd (int task, const char *name, int no_flush, int need_sync) { +dm_simplecmd (int task, const char *name, int no_flush, int need_sync, uint16_t udev_flags) { - int r = 0; - int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME || - task == DM_DEVICE_REMOVE)); + int r = 0; + int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME || + task == DM_DEVICE_REMOVE)); @@ -219,7 +221,7 @@ dm_simplecmd (int task, const char *name - dm_task_no_flush(dmt); /* for DM_DEVICE_SUSPEND/RESUME */ + dm_task_no_flush(dmt); /* for DM_DEVICE_SUSPEND/RESUME */ #endif - + - if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0)) + if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags)) - goto out; - r = dm_task_run (dmt); - + goto out; + r = dm_task_run (dmt); + @@ -229,13 +231,13 @@ dm_simplecmd (int task, const char *name } - + extern int -dm_simplecmd_flush (int task, const char *name, int needsync) { - return dm_simplecmd(task, name, 0, needsync); +dm_simplecmd_flush (int task, const char *name, int needsync, uint16_t udev_flags) { + return dm_simplecmd(task, name, 0, needsync, udev_flags); } - + extern int -dm_simplecmd_noflush (int task, const char *name) { - return dm_simplecmd(task, name, 1, 1); +dm_simplecmd_noflush (int task, const char *name, uint16_t udev_flags) { + return dm_simplecmd(task, name, 1, 1, udev_flags); } - + extern int @@ -670,7 +672,7 @@ _dm_flush_map (const char * mapname, int - return 1; - } - + return 1; + } + - r = dm_simplecmd_flush(DM_DEVICE_REMOVE, mapname, need_sync); + r = dm_simplecmd_flush(DM_DEVICE_REMOVE, mapname, need_sync, 0); - - if (r) { - condlog(4, "multipath map %s removed", mapname); + + if (r) { + condlog(4, "multipath map %s removed", mapname); @@ -703,14 +705,14 @@ dm_suspend_and_flush_map (const char * m - if (s) - queue_if_no_path = 0; - else + if (s) + queue_if_no_path = 0; + else - s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0); + s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0, 0); - - if (!dm_flush_map(mapname)) { - condlog(4, "multipath map %s removed", mapname); - return 0; - } - condlog(2, "failed to remove multipath map %s", mapname); + + if (!dm_flush_map(mapname)) { + condlog(4, "multipath map %s removed", mapname); + return 0; + } + condlog(2, "failed to remove multipath map %s", mapname); - dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname); + dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname, 0); - if (queue_if_no_path) - s = dm_queue_if_no_path((char *)mapname, 1); - return 1; + if (queue_if_no_path) + s = dm_queue_if_no_path((char *)mapname, 1); + return 1; @@ -1077,7 +1079,7 @@ dm_remove_partmaps (const char * mapname - condlog(4, "partition map %s removed", - names->name); - dm_simplecmd_flush(DM_DEVICE_REMOVE, names->name, + condlog(4, "partition map %s removed", + names->name); + dm_simplecmd_flush(DM_DEVICE_REMOVE, names->name, - need_sync); + need_sync, 0); - } - - next = names->next; + } + + next = names->next; @@ -1305,7 +1307,7 @@ int dm_reassign_table(const char *name, - condlog(3, "%s: failed to reassign targets", name); - goto out_reload; - } + condlog(3, "%s: failed to reassign targets", name); + goto out_reload; + } - dm_simplecmd_noflush(DM_DEVICE_RESUME, name); + dm_simplecmd_noflush(DM_DEVICE_RESUME, name, MPATH_UDEV_RELOAD_FLAG); - } - r = 1; - + } + r = 1; + Index: multipath-tools-130222/libmultipath/devmapper.h =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.h @@ -205,7 +205,7 @@ Index: multipath-tools-130222/libmultipath/devmapper.h @@ -6,11 +6,17 @@ #define TGT_MPATH "multipath" #define TGT_PART "linear" - + +#ifdef DM_SUBSYSTEM_UDEV_FLAG0 +#define MPATH_UDEV_RELOAD_FLAG DM_SUBSYSTEM_UDEV_FLAG0 +#else @@ -228,19 +228,19 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -783,7 +783,7 @@ cli_suspend(void * v, char ** reply, int { - struct vectors * vecs = (struct vectors *)data; - char * param = get_keyparam(v, MAP); + struct vectors * vecs = (struct vectors *)data; + char * param = get_keyparam(v, MAP); - int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param); + int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param, 0); - - param = convert_dev(param, 0); - condlog(2, "%s: suspend (operator)", param); + + param = convert_dev(param, 0); + condlog(2, "%s: suspend (operator)", param); @@ -805,7 +805,7 @@ cli_resume(void * v, char ** reply, int { - struct vectors * vecs = (struct vectors *)data; - char * param = get_keyparam(v, MAP); + struct vectors * vecs = (struct vectors *)data; + char * param = get_keyparam(v, MAP); - int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param); + int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param, 0); - - param = convert_dev(param, 0); - condlog(2, "%s: resume (operator)", param); + + param = convert_dev(param, 0); + condlog(2, "%s: resume (operator)", param); diff --git a/SOURCES/0076-RHBZ-1056686-add-hw_str_match.patch b/SOURCES/0076-RHBZ-1056686-add-hw_str_match.patch index 1921ca94..dc9aca61 100644 --- a/SOURCES/0076-RHBZ-1056686-add-hw_str_match.patch +++ b/SOURCES/0076-RHBZ-1056686-add-hw_str_match.patch @@ -10,52 +10,52 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -431,11 +431,16 @@ restart: - break; - j = n; - vector_foreach_slot_after(hw, hwe2, j) { + break; + j = n; + vector_foreach_slot_after(hw, hwe2, j) { - if (hwe_regmatch(hwe1, hwe2)) + if (conf->hw_strmatch) { + if (hwe_strmatch(hwe2, hwe1)) + continue; + } + else if (hwe_regmatch(hwe1, hwe2)) - continue; - /* dup */ - merge_hwe(hwe2, hwe1); + continue; + /* dup */ + merge_hwe(hwe2, hwe1); - if (hwe_strmatch(hwe2, hwe1) == 0) { + if (conf->hw_strmatch || + hwe_strmatch(hwe2, hwe1) == 0) { - vector_del_slot(hw, i); - free_hwe(hwe1); - n -= 1; + vector_del_slot(hw, i); + free_hwe(hwe1); + n -= 1; @@ -550,6 +555,7 @@ load_config (char * file, struct udev *u - conf->fast_io_fail = DEFAULT_FAST_IO_FAIL; - conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER; - conf->detect_prio = DEFAULT_DETECT_PRIO; + conf->fast_io_fail = DEFAULT_FAST_IO_FAIL; + conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER; + conf->detect_prio = DEFAULT_DETECT_PRIO; + conf->hw_strmatch = 0; - - /* - * preload default hwtable + + /* + * preload default hwtable Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -107,6 +107,7 @@ struct config { - int log_checker_err; - int allow_queueing; - int find_multipaths; + int log_checker_err; + int allow_queueing; + int find_multipaths; + int hw_strmatch; - uid_t uid; - gid_t gid; - mode_t mode; + uid_t uid; + gid_t gid; + mode_t mode; Index: multipath-tools-130222/libmultipath/dict.c =================================================================== --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -693,6 +693,25 @@ def_detect_prio_handler(vector strvec) - return 0; + return 0; } - + +static int +def_hw_strmatch_handler(vector strvec) +{ @@ -80,7 +80,7 @@ Index: multipath-tools-130222/libmultipath/dict.c */ @@ -2795,6 +2814,14 @@ snprint_def_detect_prio(char * buff, int } - + static int +snprint_def_hw_strmatch(char * buff, int len, void * data) +{ @@ -92,15 +92,15 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_ble_simple (char * buff, int len, void * data) { - struct blentry * ble = (struct blentry *)data; + struct blentry * ble = (struct blentry *)data; @@ -2861,6 +2888,7 @@ init_keywords(void) - install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths); - install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler); - install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio); + install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths); + install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler); + install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio); + install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch); - __deprecated install_keyword("default_selector", &def_selector_handler, NULL); - __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); - __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); + __deprecated install_keyword("default_selector", &def_selector_handler, NULL); + __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); + __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.conf.5 diff --git a/SOURCES/0077-RHBZ-1054806-mpathconf-always-reload.patch b/SOURCES/0077-RHBZ-1054806-mpathconf-always-reload.patch index ebc4b61e..467da8a5 100644 --- a/SOURCES/0077-RHBZ-1054806-mpathconf-always-reload.patch +++ b/SOURCES/0077-RHBZ-1054806-mpathconf-always-reload.patch @@ -7,10 +7,10 @@ Index: multipath-tools-130222/multipath/mpathconf --- multipath-tools-130222.orig/multipath/mpathconf +++ multipath-tools-130222/multipath/mpathconf @@ -316,6 +316,6 @@ elif [ "$ENABLE" = 0 ]; then - if [ "$HAVE_MULTIPATHD" = 1 ]; then - systemctl stop multipathd.service - fi + if [ "$HAVE_MULTIPATHD" = 1 ]; then + systemctl stop multipathd.service + fi -elif [ -n "$CHANGED_CONFIG" -a "$HAVE_MULTIPATHD" = 1 ]; then +elif [ "$HAVE_MULTIPATHD" = 1 ]; then - systemctl reload multipathd.service + systemctl reload multipathd.service fi diff --git a/SOURCES/0079-RHBZ-1070581-add-wwid-option.patch b/SOURCES/0079-RHBZ-1070581-add-wwid-option.patch index 6e6d196c..e967a512 100644 --- a/SOURCES/0079-RHBZ-1070581-add-wwid-option.patch +++ b/SOURCES/0079-RHBZ-1070581-add-wwid-option.patch @@ -9,25 +9,25 @@ Index: multipath-tools-130222/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -85,7 +85,7 @@ usage (char * progname) { - fprintf (stderr, VERSION_STRING); - fprintf (stderr, "Usage:\n"); + fprintf (stderr, VERSION_STRING); + fprintf (stderr, "Usage:\n"); - fprintf (stderr, " %s [-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); + fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); - fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); - fprintf (stderr, " %s -F [-v lvl]\n", progname); - fprintf (stderr, " %s -t\n", progname); + fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); + fprintf (stderr, " %s -F [-v lvl]\n", progname); + fprintf (stderr, " %s -t\n", progname); @@ -98,6 +98,7 @@ usage (char * progname) - " -ll show multipath topology (maximum info)\n" \ - " -f flush a multipath device map\n" \ - " -F flush all multipath device maps\n" \ + " -ll show multipath topology (maximum info)\n" \ + " -f flush a multipath device map\n" \ + " -F flush all multipath device maps\n" \ + " -a add a device wwid to the wwids file\n" \ - " -c check if a device should be a path in a multipath device\n" \ - " -T tm:val\n" \ - " check if tm matches the multipathd timestamp. If so val is\n" \ + " -c check if a device should be a path in a multipath device\n" \ + " -T tm:val\n" \ + " check if tm matches the multipathd timestamp. If so val is\n" \ @@ -292,6 +293,15 @@ configure (void) - } - goto out; - } + } + goto out; + } + if (conf->dry_run == 5) { + r = remember_wwid(refwwid); + if (r == 0) @@ -37,37 +37,37 @@ Index: multipath-tools-130222/multipath/main.c + refwwid); + goto out; + } - condlog(3, "scope limited to %s", refwwid); - if (conf->dry_run == 2) { - if (check_wwids_file(refwwid, 0) == 0){ + condlog(3, "scope limited to %s", refwwid); + if (conf->dry_run == 2) { + if (check_wwids_file(refwwid, 0) == 0){ @@ -428,7 +438,7 @@ main (int argc, char *argv[]) - int r = 1; - long int timestamp = -1; - int valid = -1; + int r = 1; + long int timestamp = -1; + int valid = -1; - while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { + while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { - switch(arg) { - case 'T': - if (optarg[0] == ':') + switch(arg) { + case 'T': + if (optarg[0] == ':') @@ -464,7 +474,7 @@ main (int argc, char *argv[]) - if (dm_prereq()) - exit(1); - + if (dm_prereq()) + exit(1); + - while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { + while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { - switch(arg) { - case 1: printf("optarg : %s\n",optarg); - break; + switch(arg) { + case 1: printf("optarg : %s\n",optarg); + break; @@ -537,6 +547,9 @@ main (int argc, char *argv[]) - case 'W': - conf->dry_run = 4; - break; + case 'W': + conf->dry_run = 4; + break; + case 'a': + conf->dry_run = 5; + break; - case ':': - fprintf(stderr, "Missing option argument\n"); - usage(argv[0]); + case ':': + fprintf(stderr, "Missing option argument\n"); + usage(argv[0]); Index: multipath-tools-130222/multipath/multipath.8 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.8 diff --git a/SOURCES/0080-RHBZ-1075796-cmdline-wwid.patch b/SOURCES/0080-RHBZ-1075796-cmdline-wwid.patch index 55256632..f943aa32 100644 --- a/SOURCES/0080-RHBZ-1075796-cmdline-wwid.patch +++ b/SOURCES/0080-RHBZ-1075796-cmdline-wwid.patch @@ -1,9 +1,9 @@ --- libmultipath/wwids.c | 44 ++++++++++++++++++++++++++++++++++++++++++ - libmultipath/wwids.h | 1 + libmultipath/wwids.h | 1 multipath/main.c | 12 ++++++++--- multipath/multipath.8 | 5 +++- - multipathd/multipathd.service | 1 + multipathd/multipathd.service | 1 5 files changed, 59 insertions(+), 4 deletions(-) Index: multipath-tools-130222/libmultipath/wwids.c @@ -11,8 +11,8 @@ Index: multipath-tools-130222/libmultipath/wwids.c --- multipath-tools-130222.orig/libmultipath/wwids.c +++ multipath-tools-130222/libmultipath/wwids.c @@ -305,3 +305,47 @@ remember_wwid(char *wwid) - condlog(4, "wwid %s already in wwids file", wwid); - return 0; + condlog(4, "wwid %s already in wwids file", wwid); + return 0; } + +int remember_cmdline_wwid(void) @@ -67,7 +67,7 @@ Index: multipath-tools-130222/libmultipath/wwids.h int remove_wwid(char *wwid); int replace_wwids(vector mp); +int remember_cmdline_wwid(void); - + #endif /* _WWIDS_H */ Index: multipath-tools-130222/multipath/main.c =================================================================== @@ -75,51 +75,51 @@ Index: multipath-tools-130222/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -85,7 +85,7 @@ usage (char * progname) { - fprintf (stderr, VERSION_STRING); - fprintf (stderr, "Usage:\n"); + fprintf (stderr, VERSION_STRING); + fprintf (stderr, "Usage:\n"); - fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); + fprintf (stderr, " %s [-a|-A|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); - fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); - fprintf (stderr, " %s -F [-v lvl]\n", progname); - fprintf (stderr, " %s -t\n", progname); + fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); + fprintf (stderr, " %s -F [-v lvl]\n", progname); + fprintf (stderr, " %s -t\n", progname); @@ -99,6 +99,8 @@ usage (char * progname) - " -f flush a multipath device map\n" \ - " -F flush all multipath device maps\n" \ - " -a add a device wwid to the wwids file\n" \ + " -f flush a multipath device map\n" \ + " -F flush all multipath device maps\n" \ + " -a add a device wwid to the wwids file\n" \ + " -A add devices from kernel command line mpath.wwids\n" + " parameters to wwids file\n" \ - " -c check if a device should be a path in a multipath device\n" \ - " -T tm:val\n" \ - " check if tm matches the multipathd timestamp. If so val is\n" \ + " -c check if a device should be a path in a multipath device\n" \ + " -T tm:val\n" \ + " check if tm matches the multipathd timestamp. If so val is\n" \ @@ -438,7 +440,7 @@ main (int argc, char *argv[]) - int r = 1; - long int timestamp = -1; - int valid = -1; + int r = 1; + long int timestamp = -1; + int valid = -1; - while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { + while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { - switch(arg) { - case 'T': - if (optarg[0] == ':') + switch(arg) { + case 'T': + if (optarg[0] == ':') @@ -474,7 +476,7 @@ main (int argc, char *argv[]) - if (dm_prereq()) - exit(1); - + if (dm_prereq()) + exit(1); + - while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { + while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { - switch(arg) { - case 1: printf("optarg : %s\n",optarg); - break; + switch(arg) { + case 1: printf("optarg : %s\n",optarg); + break; @@ -538,6 +540,10 @@ main (int argc, char *argv[]) - goto out; - case 'T': - break; + goto out; + case 'T': + break; + case 'A': + if (remember_cmdline_wwid() != 0) + exit(1); + exit(0); - case 'h': - usage(argv[0]); - exit(0); + case 'h': + usage(argv[0]); + exit(0); Index: multipath-tools-130222/multipathd/multipathd.service =================================================================== --- multipath-tools-130222.orig/multipathd/multipathd.service diff --git a/SOURCES/0081-RHBZ-1066264-check-prefix-on-rename.patch b/SOURCES/0081-RHBZ-1066264-check-prefix-on-rename.patch index 1647cd88..791f32e2 100644 --- a/SOURCES/0081-RHBZ-1066264-check-prefix-on-rename.patch +++ b/SOURCES/0081-RHBZ-1066264-check-prefix-on-rename.patch @@ -7,35 +7,35 @@ Index: multipath-tools-130222/libmultipath/devmapper.c --- multipath-tools-130222.orig/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -1151,6 +1151,8 @@ dm_rename_partmaps (char * old, char * n - unsigned long long size; - char dev_t[32]; - int r = 1; + unsigned long long size; + char dev_t[32]; + int r = 1; + int offset; + char *delim; - - if (!(dmt = dm_task_create(DM_DEVICE_LIST))) - return 1; + + if (!(dmt = dm_task_create(DM_DEVICE_LIST))) + return 1; @@ -1171,6 +1173,11 @@ dm_rename_partmaps (char * old, char * n - if (dm_dev_t(old, &dev_t[0], 32)) - goto out; - + if (dm_dev_t(old, &dev_t[0], 32)) + goto out; + + if (isdigit(new[strlen(new)-1])) + delim = "p"; + else + delim = ""; + - do { - if ( - /* + do { + if ( + /* @@ -1198,8 +1205,9 @@ dm_rename_partmaps (char * old, char * n - * then it's a kpartx generated partition. - * Rename it. - */ + * then it's a kpartx generated partition. + * Rename it. + */ - snprintf(buff, PARAMS_SIZE, "%s%s", - new, names->name + strlen(old)); + for (offset = strlen(old); names->name[offset] && !(isdigit(names->name[offset])); offset++); /* do nothing */ + snprintf(buff, PARAMS_SIZE, "%s%s%s", + new, delim, names->name + offset); - dm_rename(names->name, buff); - condlog(4, "partition map %s renamed", - names->name); + dm_rename(names->name, buff); + condlog(4, "partition map %s renamed", + names->name); diff --git a/SOURCES/0082-UPBZ-1109995-no-sync-turs-on-pthread_cancel.patch b/SOURCES/0082-UPBZ-1109995-no-sync-turs-on-pthread_cancel.patch index 8c5cf41d..9a1bd344 100644 --- a/SOURCES/0082-UPBZ-1109995-no-sync-turs-on-pthread_cancel.patch +++ b/SOURCES/0082-UPBZ-1109995-no-sync-turs-on-pthread_cancel.patch @@ -7,19 +7,19 @@ Index: multipath-tools-130222/libmultipath/checkers/tur.c --- multipath-tools-130222.orig/libmultipath/checkers/tur.c +++ multipath-tools-130222/libmultipath/checkers/tur.c @@ -409,7 +409,6 @@ libcheck_check (struct checker * c) - ct->running = 0; - MSG(c, MSG_TUR_TIMEOUT); - tur_status = PATH_DOWN; + ct->running = 0; + MSG(c, MSG_TUR_TIMEOUT); + tur_status = PATH_DOWN; - ct->state = PATH_UNCHECKED; - } else { - condlog(3, "%d:%d: tur checker not finished", - TUR_DEVT(ct)); + } else { + condlog(3, "%d:%d: tur checker not finished", + TUR_DEVT(ct)); @@ -426,12 +425,10 @@ libcheck_check (struct checker * c) - pthread_mutex_unlock(&ct->lock); - } else { - if (ct->thread) { + pthread_mutex_unlock(&ct->lock); + } else { + if (ct->thread) { - /* pthread cancel failed. continue in sync mode */ - pthread_mutex_unlock(&ct->lock); + pthread_mutex_unlock(&ct->lock); - condlog(3, "%d:%d: tur thread not responding, " - "using sync mode", TUR_DEVT(ct)); - return tur_check(c->fd, c->timeout, c->message, @@ -27,6 +27,6 @@ Index: multipath-tools-130222/libmultipath/checkers/tur.c + condlog(3, "%d:%d: tur thread not responding, ", + TUR_DEVT(ct)); + return PATH_DOWN; - } - /* Start new TUR checker */ - ct->state = PATH_UNCHECKED; + } + /* Start new TUR checker */ + ct->state = PATH_UNCHECKED; diff --git a/SOURCES/0083-RHBZ-1080055-orphan-paths-on-reload.patch b/SOURCES/0083-RHBZ-1080055-orphan-paths-on-reload.patch index 4c8fb165..8eaee742 100644 --- a/SOURCES/0083-RHBZ-1080055-orphan-paths-on-reload.patch +++ b/SOURCES/0083-RHBZ-1080055-orphan-paths-on-reload.patch @@ -8,9 +8,9 @@ Index: multipath-tools-130222/libmultipath/structs_vec.c --- multipath-tools-130222.orig/libmultipath/structs_vec.c +++ multipath-tools-130222/libmultipath/structs_vec.c @@ -280,12 +280,38 @@ update_multipath_status (struct multipat - return 0; + return 0; } - + +void sync_paths(struct multipath *mpp, vector pathvec) +{ + struct path *pp; @@ -39,47 +39,47 @@ Index: multipath-tools-130222/libmultipath/structs_vec.c extern int update_multipath_strings (struct multipath *mpp, vector pathvec) { - if (!mpp) - return 1; - + if (!mpp) + return 1; + + update_mpp_paths(mpp, pathvec); - condlog(4, "%s: %s", mpp->alias, __FUNCTION__); - - free_multipath_attributes(mpp); + condlog(4, "%s: %s", mpp->alias, __FUNCTION__); + + free_multipath_attributes(mpp); @@ -294,6 +320,7 @@ update_multipath_strings (struct multipa - - if (update_multipath_table(mpp, pathvec)) - return 1; + + if (update_multipath_table(mpp, pathvec)) + return 1; + sync_paths(mpp, pathvec); - - if (update_multipath_status(mpp)) - return 1; + + if (update_multipath_status(mpp)) + return 1; @@ -494,13 +521,9 @@ int update_multipath (struct vectors *ve - return 2; - } - + return 2; + } + - free_pgvec(mpp->pg, KEEP_PATHS); - mpp->pg = NULL; - - if (__setup_multipath(vecs, mpp, reset)) - return 1; /* mpp freed in setup_multipath */ - + if (__setup_multipath(vecs, mpp, reset)) + return 1; /* mpp freed in setup_multipath */ + - adopt_paths(vecs->pathvec, mpp, 0); - /* - * compare checkers states with DM states - */ + /* + * compare checkers states with DM states + */ Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -1152,6 +1152,10 @@ check_path (struct vectors * vecs, struc - pp->dev); - pp->dmstate = PSTATE_UNDEF; - } + pp->dev); + pp->dmstate = PSTATE_UNDEF; + } + /* if update_multipath_strings orphaned the path, quit early */ + if (!pp->mpp) + return; + - pp->chkrstate = newstate; - if (newstate != pp->state) { - int oldstate = pp->state; + pp->chkrstate = newstate; + if (newstate != pp->state) { + int oldstate = pp->state; diff --git a/SOURCES/0084-RHBZ-1110000-multipath-man.patch b/SOURCES/0084-RHBZ-1110000-multipath-man.patch index 730599d2..4ea422a3 100644 --- a/SOURCES/0084-RHBZ-1110000-multipath-man.patch +++ b/SOURCES/0084-RHBZ-1110000-multipath-man.patch @@ -9,7 +9,7 @@ Index: multipath-tools-130222/multipathd/multipathd.8 +++ multipath-tools-130222/multipathd/multipathd.8 @@ -42,6 +42,9 @@ format wildcards. .B list|show maps|multipaths - Show the multipath devices that the multipathd is monitoring. + Show the multipath devices that the multipathd is monitoring. .TP +.B list|show daemon +Show the current state of the multipathd daemon @@ -23,7 +23,7 @@ Index: multipath-tools-130222/multipathd/multipathd.8 .TP -.B add map $map +.B add map|multipath $map - Add a multipath device to the list of monitored devices. $map can either be a device-mapper device as listed in /sys/block (e.g. dm-0) or it can be the alias for the multipath device (e.g. mpath1) or the uid of the multipath device (e.g. 36005076303ffc56200000000000010aa). + Add a multipath device to the list of monitored devices. $map can either be a device-mapper device as listed in /sys/block (e.g. dm-0) or it can be the alias for the multipath device (e.g. mpath1) or the uid of the multipath device (e.g. 36005076303ffc56200000000000010aa). .TP -.B remove|del map $map +.B remove|del map|multipath $map @@ -31,7 +31,7 @@ Index: multipath-tools-130222/multipathd/multipathd.8 .TP .B resize map|multipath $map Resizes map $map to the given size - .TP + .TP -.B switch|switchgroup map $map group $group +.B switch|switchgroup map|multipath $map group $group Force a multipath device to switch to a specific path group. $group is the path group index, starting with 1. @@ -79,7 +79,7 @@ Index: multipath-tools-130222/multipathd/multipathd.8 +.TP +.B shutdown +Stop multipathd. - + .SH "SEE ALSO" .BR multipath (8) Index: multipath-tools-130222/libmultipath/prioritizers/alua.c @@ -87,15 +87,15 @@ Index: multipath-tools-130222/libmultipath/prioritizers/alua.c --- multipath-tools-130222.orig/libmultipath/prioritizers/alua.c +++ multipath-tools-130222/libmultipath/prioritizers/alua.c @@ -119,10 +119,10 @@ int getprio (struct path * pp, char * ar - condlog(0, "%s: couldn't get target port group", pp->dev); - break; - case ALUA_PRIO_GETAAS_FAILED: + condlog(0, "%s: couldn't get target port group", pp->dev); + break; + case ALUA_PRIO_GETAAS_FAILED: - condlog(0, "%s: couln't get asymmetric access state", pp->dev); + condlog(0, "%s: couldn't get asymmetric access state", pp->dev); - break; - case ALUA_PRIO_TPGS_FAILED: + break; + case ALUA_PRIO_TPGS_FAILED: - condlog(3, "%s: couln't get supported alua states", pp->dev); + condlog(3, "%s: couldn't get supported alua states", pp->dev); - break; - } - } + break; + } + } diff --git a/SOURCES/0085-UPBZ-1110006-datacore-config.patch b/SOURCES/0085-UPBZ-1110006-datacore-config.patch index fc048a6b..cedb5e3e 100644 --- a/SOURCES/0085-UPBZ-1110006-datacore-config.patch +++ b/SOURCES/0085-UPBZ-1110006-datacore-config.patch @@ -7,9 +7,9 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -1108,6 +1108,19 @@ static struct hwentry default_hw[] = { - .prio_name = PRIO_ALUA, - .prio_args = NULL, - }, + .prio_name = PRIO_ALUA, + .prio_args = NULL, + }, + { + .vendor = "DataCore", + .product = "Virtual Disk", @@ -23,6 +23,6 @@ Index: multipath-tools-130222/libmultipath/hwtable.c + .prio_name = PRIO_ALUA, + .prio_args = NULL, + }, - /* - * EOL - */ + /* + * EOL + */ diff --git a/SOURCES/0086-RHBZ-1110007-orphan-path-on-failed-add.patch b/SOURCES/0086-RHBZ-1110007-orphan-path-on-failed-add.patch index 90ec3ac7..0d6aa589 100644 --- a/SOURCES/0086-RHBZ-1110007-orphan-path-on-failed-add.patch +++ b/SOURCES/0086-RHBZ-1110007-orphan-path-on-failed-add.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -562,7 +562,7 @@ rescan: - return 0; - } - else + return 0; + } + else - return 1; + goto fail; - + fail_map: - remove_map(mpp, vecs, 1); + remove_map(mpp, vecs, 1); diff --git a/SOURCES/0087-RHBZ-1110013-config-error-checking.patch b/SOURCES/0087-RHBZ-1110013-config-error-checking.patch index 6daac076..c774bc5f 100644 --- a/SOURCES/0087-RHBZ-1110013-config-error-checking.patch +++ b/SOURCES/0087-RHBZ-1110013-config-error-checking.patch @@ -7,22 +7,22 @@ Index: multipath-tools-130222/libmultipath/parser.c --- multipath-tools-130222.orig/libmultipath/parser.c +++ multipath-tools-130222/libmultipath/parser.c @@ -395,36 +395,57 @@ set_value(vector strvec) - char *alloc = NULL; - char *tmp; - + char *alloc = NULL; + char *tmp; + - if (!str) + if (!str) { + condlog(0, "option '%s' missing value", + (char *)VECTOR_SLOT(strvec, 0)); - return NULL; + return NULL; - + } - size = strlen(str); + size = strlen(str); - if (size == 0) + if (size == 0) { + condlog(0, "option '%s' has empty value", + (char *)VECTOR_SLOT(strvec, 0)); - return NULL; + return NULL; - - if (*str == '"') { - for (i = 2; i < VECTOR_SIZE(strvec); i++) { @@ -48,8 +48,8 @@ Index: multipath-tools-130222/libmultipath/parser.c + } + if (*str != '"') { + alloc = MALLOC(sizeof (char) * (size + 1)); - if (alloc) - memcpy(alloc, str, size); + if (alloc) + memcpy(alloc, str, size); + else + condlog(0, "can't allocate memeory for option '%s'", + (char *)VECTOR_SLOT(strvec, 0)); @@ -86,12 +86,12 @@ Index: multipath-tools-130222/libmultipath/parser.c + if (*alloc != '\0') + strncat(alloc, " ", 1); + strncat(alloc, str, strlen(str)); - } - return alloc; + } + return alloc; } @@ -465,6 +486,74 @@ void free_uniques(vector uniques) } - + int +is_sublevel_keyword(char *str) +{ @@ -163,18 +163,18 @@ Index: multipath-tools-130222/libmultipath/parser.c +int process_stream(vector keywords) { - int i; + int i; @@ -494,11 +583,20 @@ process_stream(vector keywords) - if (!strvec) - continue; - + if (!strvec) + continue; + + if (validate_config_strvec(strvec) != 0) { + free_strvec(strvec); + continue; + } + - str = VECTOR_SLOT(strvec, 0); - + str = VECTOR_SLOT(strvec, 0); + - if (!strcmp(str, EOB) && kw_level > 0) { - free_strvec(strvec); - break; @@ -185,6 +185,6 @@ Index: multipath-tools-130222/libmultipath/parser.c + } + condlog(0, "unmatched '%s' at line %d of config file", + EOB, line_nr); - } - - for (i = 0; i < VECTOR_SIZE(keywords); i++) { + } + + for (i = 0; i < VECTOR_SIZE(keywords); i++) { diff --git a/SOURCES/0088-RHBZ-1069811-configurable-prio-timeout.patch b/SOURCES/0088-RHBZ-1069811-configurable-prio-timeout.patch index 39f1d252..60f374be 100644 --- a/SOURCES/0088-RHBZ-1069811-configurable-prio-timeout.patch +++ b/SOURCES/0088-RHBZ-1069811-configurable-prio-timeout.patch @@ -16,9 +16,9 @@ Index: multipath-tools-130222/libmultipath/prio.c --- multipath-tools-130222.orig/libmultipath/prio.c +++ multipath-tools-130222/libmultipath/prio.c @@ -10,6 +10,13 @@ - + static LIST_HEAD(prioritizers); - + +unsigned int get_prio_timeout(unsigned int default_timeout) +{ + if (conf->checker_timeout) @@ -28,15 +28,15 @@ Index: multipath-tools-130222/libmultipath/prio.c + int init_prio (void) { - if (!add_prio(DEFAULT_PRIO)) + if (!add_prio(DEFAULT_PRIO)) Index: multipath-tools-130222/libmultipath/prio.h =================================================================== --- multipath-tools-130222.orig/libmultipath/prio.h +++ multipath-tools-130222/libmultipath/prio.h @@ -51,6 +51,7 @@ struct prio { - int (*getprio)(struct path *, char *); + int (*getprio)(struct path *, char *); }; - + +unsigned int get_prio_timeout(unsigned int default_timeout); int init_prio (void); void cleanup_prio (void); @@ -48,103 +48,103 @@ Index: multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.c @@ -21,6 +21,7 @@ #define __user #include - + +#include "../prio.h" #include "alua_rtpg.h" - + #define SENSE_BUFF_LEN 32 @@ -134,7 +135,7 @@ do_inquiry(int fd, int evpd, unsigned in - hdr.dxfer_len = resplen; - hdr.sbp = sense; - hdr.mx_sb_len = sizeof(sense); + hdr.dxfer_len = resplen; + hdr.sbp = sense; + hdr.mx_sb_len = sizeof(sense); - hdr.timeout = DEF_TIMEOUT; + hdr.timeout = get_prio_timeout(DEF_TIMEOUT); - - if (ioctl(fd, SG_IO, &hdr) < 0) { - PRINT_DEBUG("do_inquiry: IOCTL failed!\n"); + + if (ioctl(fd, SG_IO, &hdr) < 0) { + PRINT_DEBUG("do_inquiry: IOCTL failed!\n"); @@ -253,7 +254,7 @@ do_rtpg(int fd, void* resp, long resplen - hdr.dxfer_len = resplen; - hdr.mx_sb_len = sizeof(sense); - hdr.sbp = sense; + hdr.dxfer_len = resplen; + hdr.mx_sb_len = sizeof(sense); + hdr.sbp = sense; - hdr.timeout = DEF_TIMEOUT; + hdr.timeout = get_prio_timeout(DEF_TIMEOUT); - - if (ioctl(fd, SG_IO, &hdr) < 0) - return -RTPG_RTPG_FAILED; + + if (ioctl(fd, SG_IO, &hdr) < 0) + return -RTPG_RTPG_FAILED; Index: multipath-tools-130222/libmultipath/prioritizers/emc.c =================================================================== --- multipath-tools-130222.orig/libmultipath/prioritizers/emc.c +++ multipath-tools-130222/libmultipath/prioritizers/emc.c @@ -31,7 +31,7 @@ int emc_clariion_prio(const char *dev, i - io_hdr.dxferp = sense_buffer; - io_hdr.cmdp = inqCmdBlk; - io_hdr.sbp = sb; + io_hdr.dxferp = sense_buffer; + io_hdr.cmdp = inqCmdBlk; + io_hdr.sbp = sb; - io_hdr.timeout = 60000; + io_hdr.timeout = get_prio_timeout(60000); - io_hdr.pack_id = 0; - if (ioctl(fd, SG_IO, &io_hdr) < 0) { - pp_emc_log(0, "sending query command failed"); + io_hdr.pack_id = 0; + if (ioctl(fd, SG_IO, &io_hdr) < 0) { + pp_emc_log(0, "sending query command failed"); Index: multipath-tools-130222/libmultipath/prioritizers/hds.c =================================================================== --- multipath-tools-130222.orig/libmultipath/prioritizers/hds.c +++ multipath-tools-130222/libmultipath/prioritizers/hds.c @@ -114,7 +114,7 @@ int hds_modular_prio (const char *dev, i - io_hdr.dxferp = inqBuff; - io_hdr.cmdp = inqCmdBlk; - io_hdr.sbp = sense_buffer; + io_hdr.dxferp = inqBuff; + io_hdr.cmdp = inqCmdBlk; + io_hdr.sbp = sense_buffer; - io_hdr.timeout = 2000; /* TimeOut = 2 seconds */ + io_hdr.timeout = get_prio_timeout(2000); /* TimeOut = 2 seconds */ - - if (ioctl (fd, SG_IO, &io_hdr) < 0) { - pp_hds_log(0, "SG_IO error"); + + if (ioctl (fd, SG_IO, &io_hdr) < 0) { + pp_hds_log(0, "SG_IO error"); Index: multipath-tools-130222/libmultipath/prioritizers/hp_sw.c =================================================================== --- multipath-tools-130222.orig/libmultipath/prioritizers/hp_sw.c +++ multipath-tools-130222/libmultipath/prioritizers/hp_sw.c @@ -46,7 +46,7 @@ int hp_sw_prio(const char *dev, int fd) - io_hdr.dxfer_direction = SG_DXFER_NONE; - io_hdr.cmdp = turCmdBlk; - io_hdr.sbp = sb; + io_hdr.dxfer_direction = SG_DXFER_NONE; + io_hdr.cmdp = turCmdBlk; + io_hdr.sbp = sb; - io_hdr.timeout = 60000; + io_hdr.timeout = get_prio_timeout(60000); - io_hdr.pack_id = 0; + io_hdr.pack_id = 0; retry: - if (ioctl(fd, SG_IO, &io_hdr) < 0) { + if (ioctl(fd, SG_IO, &io_hdr) < 0) { Index: multipath-tools-130222/libmultipath/prioritizers/ontap.c =================================================================== --- multipath-tools-130222.orig/libmultipath/prioritizers/ontap.c +++ multipath-tools-130222/libmultipath/prioritizers/ontap.c @@ -89,7 +89,7 @@ static int send_gva(const char *dev, int - io_hdr.dxferp = results; - io_hdr.cmdp = cdb; - io_hdr.sbp = sb; + io_hdr.dxferp = results; + io_hdr.cmdp = cdb; + io_hdr.sbp = sb; - io_hdr.timeout = SG_TIMEOUT; + io_hdr.timeout = get_prio_timeout(SG_TIMEOUT); - io_hdr.pack_id = 0; - if (ioctl(fd, SG_IO, &io_hdr) < 0) { - pp_ontap_log(0, "SG_IO ioctl failed, errno=%d", errno); + io_hdr.pack_id = 0; + if (ioctl(fd, SG_IO, &io_hdr) < 0) { + pp_ontap_log(0, "SG_IO ioctl failed, errno=%d", errno); @@ -141,7 +141,7 @@ static int get_proxy(const char *dev, in - io_hdr.dxferp = results; - io_hdr.cmdp = cdb; - io_hdr.sbp = sb; + io_hdr.dxferp = results; + io_hdr.cmdp = cdb; + io_hdr.sbp = sb; - io_hdr.timeout = SG_TIMEOUT; + io_hdr.timeout = get_prio_timeout(SG_TIMEOUT); - io_hdr.pack_id = 0; - if (ioctl(fd, SG_IO, &io_hdr) < 0) { - pp_ontap_log(0, "ioctl sending inquiry command failed, " + io_hdr.pack_id = 0; + if (ioctl(fd, SG_IO, &io_hdr) < 0) { + pp_ontap_log(0, "ioctl sending inquiry command failed, " Index: multipath-tools-130222/libmultipath/prioritizers/rdac.c =================================================================== --- multipath-tools-130222.orig/libmultipath/prioritizers/rdac.c +++ multipath-tools-130222/libmultipath/prioritizers/rdac.c @@ -31,7 +31,7 @@ int rdac_prio(const char *dev, int fd) - io_hdr.dxferp = sense_buffer; - io_hdr.cmdp = inqCmdBlk; - io_hdr.sbp = sb; + io_hdr.dxferp = sense_buffer; + io_hdr.cmdp = inqCmdBlk; + io_hdr.sbp = sb; - io_hdr.timeout = 60000; + io_hdr.timeout = get_prio_timeout(60000); - io_hdr.pack_id = 0; - if (ioctl(fd, SG_IO, &io_hdr) < 0) { - pp_rdac_log(0, "sending inquiry command failed"); + io_hdr.pack_id = 0; + if (ioctl(fd, SG_IO, &io_hdr) < 0) { + pp_rdac_log(0, "sending inquiry command failed"); Index: multipath-tools-130222/multipath.conf.annotated =================================================================== --- multipath-tools-130222.orig/multipath.conf.annotated diff --git a/SOURCES/0089-RHBZ-1110016-add-noasync-option.patch b/SOURCES/0089-RHBZ-1110016-add-noasync-option.patch index 53edf8ea..2651c0e9 100644 --- a/SOURCES/0089-RHBZ-1110016-add-noasync-option.patch +++ b/SOURCES/0089-RHBZ-1110016-add-noasync-option.patch @@ -12,33 +12,33 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -556,6 +556,7 @@ load_config (char * file, struct udev *u - conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER; - conf->detect_prio = DEFAULT_DETECT_PRIO; - conf->hw_strmatch = 0; + conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER; + conf->detect_prio = DEFAULT_DETECT_PRIO; + conf->hw_strmatch = 0; + conf->force_sync = 0; - - /* - * preload default hwtable + + /* + * preload default hwtable Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -115,6 +115,7 @@ struct config { - int reassign_maps; - int retain_hwhandler; - int detect_prio; + int reassign_maps; + int retain_hwhandler; + int detect_prio; + int force_sync; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/libmultipath/dict.c =================================================================== --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -712,6 +712,29 @@ def_hw_strmatch_handler(vector strvec) - return 0; + return 0; } - + +static int +def_force_sync_handler(vector strvec) +{ @@ -67,7 +67,7 @@ Index: multipath-tools-130222/libmultipath/dict.c */ @@ -2822,6 +2845,15 @@ snprint_def_hw_strmatch(char * buff, int } - + static int +snprint_def_force_sync(char * buff, int len, void * data) +{ @@ -80,23 +80,23 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_ble_simple (char * buff, int len, void * data) { - struct blentry * ble = (struct blentry *)data; + struct blentry * ble = (struct blentry *)data; @@ -2889,6 +2921,7 @@ init_keywords(void) - install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler); - install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio); - install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch); + install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler); + install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio); + install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch); + install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync); - __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); + __deprecated install_keyword("default_selector", &def_selector_handler, NULL); + __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); + __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); Index: multipath-tools-130222/libmultipath/discovery.c =================================================================== --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -952,8 +952,12 @@ get_state (struct path * pp, int daemon) - } - } - checker_clear_message(c); + } + } + checker_clear_message(c); - if (daemon) - checker_set_async(c); + if (daemon) { @@ -105,9 +105,9 @@ Index: multipath-tools-130222/libmultipath/discovery.c + else + checker_set_sync(c); + } - if (!conf->checker_timeout && - (pp->bus != SYSFS_BUS_SCSI || - sysfs_get_timeout(pp, &(c->timeout)))) + if (!conf->checker_timeout && + (pp->bus != SYSFS_BUS_SCSI || + sysfs_get_timeout(pp, &(c->timeout)))) Index: multipath-tools-130222/multipath.conf.annotated =================================================================== --- multipath-tools-130222.orig/multipath.conf.annotated @@ -134,7 +134,7 @@ Index: multipath-tools-130222/multipath.conf.annotated +# # default : no +# force_sync yes #} - # + # ## Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== diff --git a/SOURCES/0090-UPBZ-1080038-reorder-paths-for-round-robin.patch b/SOURCES/0090-UPBZ-1080038-reorder-paths-for-round-robin.patch index 3515dec3..44f84073 100644 --- a/SOURCES/0090-UPBZ-1080038-reorder-paths-for-round-robin.patch +++ b/SOURCES/0090-UPBZ-1080038-reorder-paths-for-round-robin.patch @@ -1,8 +1,8 @@ --- libmultipath/configure.c | 229 +++++++++++++++++++++++++++++++++++++++++++++++ - libmultipath/configure.h | 2 + libmultipath/configure.h | 2 libmultipath/discovery.c | 87 +++++++++++++++++ - libmultipath/discovery.h | 2 + libmultipath/discovery.h | 2 libmultipath/structs.c | 84 +++++++++++++++++ libmultipath/structs.h | 25 ++++- 6 files changed, 427 insertions(+), 2 deletions(-) @@ -14,7 +14,7 @@ Index: multipath-tools-130222/libmultipath/configure.c @@ -39,6 +39,219 @@ #include "uxsock.h" #include "wwids.h" - + +/* group paths in pg by host adapter + */ +int group_by_host_adapter(struct pathgroup *pgp, vector adapters) @@ -232,9 +232,9 @@ Index: multipath-tools-130222/libmultipath/configure.c setup_map (struct multipath * mpp, char * params, int params_size) { @@ -101,6 +314,22 @@ setup_map (struct multipath * mpp, char - */ - mpp->bestpg = select_path_group(mpp); - + */ + mpp->bestpg = select_path_group(mpp); + + /* re-order paths in all path groups in an optimized way + * for round-robin path selectors to get maximum throughput. + */ @@ -251,9 +251,9 @@ Index: multipath-tools-130222/libmultipath/configure.c + } + } + - /* - * transform the mp->pg vector of vectors of paths - * into a mp->params strings to feed the device-mapper + /* + * transform the mp->pg vector of vectors of paths + * into a mp->params strings to feed the device-mapper Index: multipath-tools-130222/libmultipath/configure.h =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.h @@ -269,9 +269,9 @@ Index: multipath-tools-130222/libmultipath/discovery.c --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -310,6 +310,93 @@ sysfs_get_tgt_nodename (struct path *pp, - return 1; + return 1; } - + +int sysfs_get_host_adapter_name(struct path *pp, char *adapter_name) +{ + int proto_id; @@ -367,12 +367,12 @@ Index: multipath-tools-130222/libmultipath/discovery.h --- multipath-tools-130222.orig/libmultipath/discovery.h +++ multipath-tools-130222/libmultipath/discovery.h @@ -38,6 +38,8 @@ int store_pathinfo (vector pathvec, vect - struct path **pp_ptr); + struct path **pp_ptr); int sysfs_set_scsi_tmo (struct multipath *mpp); int sysfs_get_timeout(struct path *pp, unsigned int *timeout); +int sysfs_get_host_pci_name(struct path *pp, char *pci_name); +int sysfs_get_iscsi_ip_address(struct path *pp, char *ip_address); - + /* * discovery bitmask Index: multipath-tools-130222/libmultipath/structs.c @@ -382,7 +382,7 @@ Index: multipath-tools-130222/libmultipath/structs.c @@ -18,6 +18,70 @@ #include "blacklist.h" #include "prio.h" - + +struct adapter_group * +alloc_adaptergroup(void) +{ @@ -451,9 +451,9 @@ Index: multipath-tools-130222/libmultipath/structs.c alloc_path (void) { @@ -242,6 +306,26 @@ store_pathgroup (vector pgvec, struct pa - return 0; + return 0; } - + +int +store_hostgroup(vector hostgroupvec, struct host_group * hgp) +{ @@ -488,13 +488,13 @@ Index: multipath-tools-130222/libmultipath/structs.h - +#define HOST_NAME_LEN 8 +#define SLOT_NAME_SIZE 40 - + #define SCSI_VENDOR_SIZE 9 #define SCSI_PRODUCT_SIZE 17 @@ -251,6 +252,20 @@ struct pathgroup { - char * selector; + char * selector; }; - + +struct adapter_group { + char adapter_name[SLOT_NAME_SIZE]; + struct pathgroup *pgp; @@ -515,7 +515,7 @@ Index: multipath-tools-130222/libmultipath/structs.h @@ -263,6 +278,14 @@ void free_multipath_attributes (struct m void drop_multipath (vector mpvec, char * wwid, enum free_path_mode free_paths); void free_multipathvec (vector mpvec, enum free_path_mode free_paths); - + +struct adapter_group * alloc_adaptergroup(void); +struct host_group * alloc_hostgroup(void); +void free_adaptergroup(vector adapters); @@ -526,3 +526,4 @@ Index: multipath-tools-130222/libmultipath/structs.h + int store_path (vector pathvec, struct path * pp); int store_pathgroup (vector pgvec, struct pathgroup * pgp); + diff --git a/SOURCES/0091-RHBZ-1069584-fix-empty-values-fast-io-fail-and-dev-loss.patch b/SOURCES/0091-RHBZ-1069584-fix-empty-values-fast-io-fail-and-dev-loss.patch index 54b84b07..d164de13 100644 --- a/SOURCES/0091-RHBZ-1069584-fix-empty-values-fast-io-fail-and-dev-loss.patch +++ b/SOURCES/0091-RHBZ-1069584-fix-empty-values-fast-io-fail-and-dev-loss.patch @@ -7,32 +7,32 @@ Index: multipath-tools-130222/libmultipath/dict.c --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -43,6 +43,9 @@ def_fast_io_fail_handler(vector strvec) - char * buff; - - buff = set_value(strvec); + char * buff; + + buff = set_value(strvec); + if (!buff) + return 1; + - if (strlen(buff) == 3 && !strcmp(buff, "off")) - conf->fast_io_fail = MP_FAST_IO_FAIL_OFF; - else if (sscanf(buff, "%d", &conf->fast_io_fail) != 1 || + if (strlen(buff) == 3 && !strcmp(buff, "off")) + conf->fast_io_fail = MP_FAST_IO_FAIL_OFF; + else if (sscanf(buff, "%d", &conf->fast_io_fail) != 1 || @@ -1002,6 +1005,9 @@ hw_dev_loss_handler(vector strvec) - char * buff; - struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); - + char * buff; + struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); + + if (!hwe) + return 1; + - buff = set_value(strvec); - if (!buff) - return 1; + buff = set_value(strvec); + if (!buff) + return 1; @@ -1021,6 +1027,9 @@ hw_pgpolicy_handler(vector strvec) - char * buff; - struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); - + char * buff; + struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); + + if (!hwe) + return 1; + - buff = set_value(strvec); - - if (!buff) + buff = set_value(strvec); + + if (!buff) diff --git a/SOURCES/0092-UPBZ-1104605-reload-on-rename.patch b/SOURCES/0092-UPBZ-1104605-reload-on-rename.patch index afe84e17..465257c0 100644 --- a/SOURCES/0092-UPBZ-1104605-reload-on-rename.patch +++ b/SOURCES/0092-UPBZ-1104605-reload-on-rename.patch @@ -9,18 +9,18 @@ Index: multipath-tools-130222/libmultipath/configure.c --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -394,6 +394,8 @@ select_action (struct multipath * mpp, v - cmpp->alias, mpp->alias); - strncpy(mpp->alias_old, cmpp->alias, WWID_SIZE); - mpp->action = ACT_RENAME; + cmpp->alias, mpp->alias); + strncpy(mpp->alias_old, cmpp->alias, WWID_SIZE); + mpp->action = ACT_RENAME; + if (force_reload) + mpp->action = ACT_RENAME2; - return; - } - mpp->action = ACT_CREATE; + return; + } + mpp->action = ACT_CREATE; @@ -632,6 +634,15 @@ domap (struct multipath * mpp, char * pa - r = dm_rename(mpp->alias_old, mpp->alias); - break; - + r = dm_rename(mpp->alias_old, mpp->alias); + break; + + case ACT_RENAME2: + r = dm_rename(mpp->alias_old, mpp->alias); + if (r) { @@ -30,33 +30,34 @@ Index: multipath-tools-130222/libmultipath/configure.c + } + break; + - default: - break; - } + default: + break; + } Index: multipath-tools-130222/libmultipath/configure.h =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.h +++ multipath-tools-130222/libmultipath/configure.h @@ -18,6 +18,7 @@ enum actions { - ACT_RENAME, - ACT_CREATE, - ACT_RESIZE, + ACT_RENAME, + ACT_CREATE, + ACT_RESIZE, + ACT_RENAME2, }; - + #define FLUSH_ONE 1 Index: multipath-tools-130222/libmultipath/devmapper.c =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -565,10 +565,9 @@ dm_dev_t (const char * mapname, char * d - if (!dm_task_run(dmt)) - goto out; - + if (!dm_task_run(dmt)) + goto out; + - if (!dm_task_get_info(dmt, &info)) + if (!dm_task_get_info(dmt, &info) || !info.exists) - goto out; - + goto out; + - r = info.open_count; - if (snprintf(dev_t, len, "%i:%i", info.major, info.minor) > len) - goto out; + if (snprintf(dev_t, len, "%i:%i", info.major, info.minor) > len) + goto out; + diff --git a/SOURCES/0093-UPBZ-1086825-user-friendly-name-remap.patch b/SOURCES/0093-UPBZ-1086825-user-friendly-name-remap.patch index 290fa84f..ab5abbd1 100644 --- a/SOURCES/0093-UPBZ-1086825-user-friendly-name-remap.patch +++ b/SOURCES/0093-UPBZ-1086825-user-friendly-name-remap.patch @@ -11,37 +11,37 @@ Index: multipath-tools-130222/libmultipath/alias.c +++ multipath-tools-130222/libmultipath/alias.c @@ -145,7 +145,7 @@ lookup_binding(FILE *f, char *map_wwid, } - + static int -rlookup_binding(FILE *f, char *buff, char *map_alias) +rlookup_binding(FILE *f, char *buff, char *map_alias, char *prefix) { - char line[LINE_MAX]; - unsigned int line_nr = 0; + char line[LINE_MAX]; + unsigned int line_nr = 0; @@ -164,7 +164,7 @@ rlookup_binding(FILE *f, char *buff, cha - alias = strtok(line, " \t"); - if (!alias) /* blank line */ - continue; + alias = strtok(line, " \t"); + if (!alias) /* blank line */ + continue; - curr_id = scan_devname(alias, NULL); /* TBD: Why this call? */ + curr_id = scan_devname(alias, prefix); - if (curr_id >= id) - id = curr_id + 1; - wwid = strtok(NULL, " \t"); + if (curr_id >= id) + id = curr_id + 1; + wwid = strtok(NULL, " \t"); @@ -188,6 +188,11 @@ rlookup_binding(FILE *f, char *buff, cha - } - } - condlog(3, "No matching alias [%s] in bindings file.", map_alias); + } + } + condlog(3, "No matching alias [%s] in bindings file.", map_alias); + + /* Get the theoretical id for this map alias. + * Used by use_existing_alias + */ + id = scan_devname(map_alias, prefix); - return id; + return id; } - + @@ -237,6 +242,59 @@ allocate_binding(int fd, char *wwid, int } - + char * +use_existing_alias (char *wwid, char *file, char *alias_old, + char *prefix, int bindings_read_only) @@ -80,7 +80,7 @@ Index: multipath-tools-130222/libmultipath/alias.c + condlog(0, "alias %s already bound to wwid %s, cannot reuse", + alias_old, buff); + } -+ goto out; ++ goto out; + } + + /* allocate the existing alias in the bindings file */ @@ -97,24 +97,24 @@ Index: multipath-tools-130222/libmultipath/alias.c + +char * get_user_friendly_alias(char *wwid, char *file, char *prefix, - int bindings_read_only) + int bindings_read_only) { @@ -305,7 +363,7 @@ get_user_friendly_wwid(char *alias, char - return -1; - } - + return -1; + } + - rlookup_binding(f, buff, alias); + rlookup_binding(f, buff, alias, NULL); - if (!strlen(buff)) { - fclose(f); - return -1; + if (!strlen(buff)) { + fclose(f); + return -1; Index: multipath-tools-130222/libmultipath/alias.h =================================================================== --- multipath-tools-130222.orig/libmultipath/alias.h +++ multipath-tools-130222/libmultipath/alias.h @@ -10,3 +10,5 @@ char *get_user_friendly_alias(char *wwid, char *file, char *prefix, - int bindings_readonly); + int bindings_readonly); int get_user_friendly_wwid(char *alias, char *buff, char *file); +char *use_existing_alias (char *wwid, char *file, char *alias_old, + char *prefix, int bindings_read_only); @@ -128,7 +128,7 @@ Index: multipath-tools-130222/libmultipath/propsel.c { - if (mp->mpe && mp->mpe->alias) + if (mp->mpe && mp->mpe->alias) { - mp->alias = STRDUP(mp->mpe->alias); + mp->alias = STRDUP(mp->mpe->alias); - else { - mp->alias = NULL; - if (want_user_friendly_names(mp)) { @@ -139,20 +139,20 @@ Index: multipath-tools-130222/libmultipath/propsel.c - if (mp->alias == NULL) - mp->alias = STRDUP(mp->wwid); + goto out; - } - + } + + mp->alias = NULL; + if (!want_user_friendly_names(mp)) + goto out; + + select_alias_prefix(mp); -+ ++ + if (strlen(mp->alias_old) > 0) { + mp->alias = use_existing_alias(mp->wwid, conf->bindings_file, + mp->alias_old, mp->alias_prefix, + conf->bindings_read_only); + memset (mp->alias_old, 0, WWID_SIZE); -+ } ++ } + + if (mp->alias == NULL) + mp->alias = get_user_friendly_alias(mp->wwid, @@ -161,17 +161,17 @@ Index: multipath-tools-130222/libmultipath/propsel.c + if (mp->alias == NULL) + mp->alias = STRDUP(mp->wwid); + - return mp->alias ? 0 : 1; + return mp->alias ? 0 : 1; } - + Index: multipath-tools-130222/libmultipath/structs_vec.c =================================================================== --- multipath-tools-130222.orig/libmultipath/structs_vec.c +++ multipath-tools-130222/libmultipath/structs_vec.c @@ -430,6 +430,20 @@ out: - return NULL; + return NULL; } - + +static void +find_existing_alias (struct multipath * mpp, + struct vectors *vecs) @@ -188,12 +188,12 @@ Index: multipath-tools-130222/libmultipath/structs_vec.c + extern struct multipath * add_map_with_path (struct vectors * vecs, - struct path * pp, int add_vec) + struct path * pp, int add_vec) @@ -443,6 +457,7 @@ add_map_with_path (struct vectors * vecs - mpp->hwe = pp->hwe; - - strcpy(mpp->wwid, pp->wwid); + mpp->hwe = pp->hwe; + + strcpy(mpp->wwid, pp->wwid); + find_existing_alias(mpp, vecs); - if (select_alias(mpp)) - goto out; - mpp->size = pp->size; + if (select_alias(mpp)) + goto out; + mpp->size = pp->size; diff --git a/SOURCES/0094-RHBZ-1086825-cleanup-remap.patch b/SOURCES/0094-RHBZ-1086825-cleanup-remap.patch index b887a838..7d85c2d2 100644 --- a/SOURCES/0094-RHBZ-1086825-cleanup-remap.patch +++ b/SOURCES/0094-RHBZ-1086825-cleanup-remap.patch @@ -9,38 +9,38 @@ Index: multipath-tools-130222/libmultipath/alias.c +++ multipath-tools-130222/libmultipath/alias.c @@ -149,13 +149,11 @@ rlookup_binding(FILE *f, char *buff, cha { - char line[LINE_MAX]; - unsigned int line_nr = 0; + char line[LINE_MAX]; + unsigned int line_nr = 0; - int id = 0; - - buff[0] = '\0'; - - while (fgets(line, LINE_MAX, f)) { - char *c, *alias, *wwid; + + buff[0] = '\0'; + + while (fgets(line, LINE_MAX, f)) { + char *c, *alias, *wwid; - int curr_id; - - line_nr++; - c = strpbrk(line, "#\n\r"); + + line_nr++; + c = strpbrk(line, "#\n\r"); @@ -164,9 +162,6 @@ rlookup_binding(FILE *f, char *buff, cha - alias = strtok(line, " \t"); - if (!alias) /* blank line */ - continue; + alias = strtok(line, " \t"); + if (!alias) /* blank line */ + continue; - curr_id = scan_devname(alias, prefix); - if (curr_id >= id) - id = curr_id + 1; - wwid = strtok(NULL, " \t"); - if (!wwid){ - condlog(3, + wwid = strtok(NULL, " \t"); + if (!wwid){ + condlog(3, @@ -184,16 +179,12 @@ rlookup_binding(FILE *f, char *buff, cha - "\nSetting wwid to %s", alias, wwid); - strncpy(buff, wwid, WWID_SIZE); - buff[WWID_SIZE - 1] = '\0'; + "\nSetting wwid to %s", alias, wwid); + strncpy(buff, wwid, WWID_SIZE); + buff[WWID_SIZE - 1] = '\0'; - return id; + return 0; - } - } - condlog(3, "No matching alias [%s] in bindings file.", map_alias); - + } + } + condlog(3, "No matching alias [%s] in bindings file.", map_alias); + - /* Get the theoretical id for this map alias. - * Used by use_existing_alias - */ @@ -48,28 +48,28 @@ Index: multipath-tools-130222/libmultipath/alias.c - return id; + return -1; } - + static char * @@ -264,9 +255,7 @@ use_existing_alias (char *wwid, char *fi - /* lookup the binding. if it exsists, the wwid will be in buff - * either way, id contains the id for the alias - */ + /* lookup the binding. if it exsists, the wwid will be in buff + * either way, id contains the id for the alias + */ - id = rlookup_binding(f , buff, alias_old, prefix); - if (id < 0) - goto out; + rlookup_binding(f, buff, alias_old, prefix); - - if (strlen(buff) > 0) { - /* if buff is our wwid, it's already + + if (strlen(buff) > 0) { + /* if buff is our wwid, it's already @@ -279,11 +268,21 @@ use_existing_alias (char *wwid, char *fi - condlog(0, "alias %s already bound to wwid %s, cannot reuse", - alias_old, buff); - } -- goto out; + condlog(0, "alias %s already bound to wwid %s, cannot reuse", + alias_old, buff); + } +- goto out; + goto out; - } - - /* allocate the existing alias in the bindings file */ + } + + /* allocate the existing alias in the bindings file */ - if (can_write && id && !bindings_read_only) { + id = scan_devname(alias_old, prefix); + if (id <= 0) @@ -82,26 +82,26 @@ Index: multipath-tools-130222/libmultipath/alias.c + } + + if (can_write && !bindings_read_only) { - alias = allocate_binding(fd, wwid, id, prefix); - condlog(0, "Allocated existing binding [%s] for WWID [%s]", - alias, wwid); + alias = allocate_binding(fd, wwid, id, prefix); + condlog(0, "Allocated existing binding [%s] for WWID [%s]", + alias, wwid); Index: multipath-tools-130222/libmultipath/propsel.c =================================================================== --- multipath-tools-130222.orig/libmultipath/propsel.c +++ multipath-tools-130222/libmultipath/propsel.c @@ -263,13 +263,13 @@ select_alias (struct multipath * mp) - goto out; - - select_alias_prefix(mp); -- + goto out; + + select_alias_prefix(mp); +- + - if (strlen(mp->alias_old) > 0) { - mp->alias = use_existing_alias(mp->wwid, conf->bindings_file, - mp->alias_old, mp->alias_prefix, - conf->bindings_read_only); - memset (mp->alias_old, 0, WWID_SIZE); -- } + if (strlen(mp->alias_old) > 0) { + mp->alias = use_existing_alias(mp->wwid, conf->bindings_file, + mp->alias_old, mp->alias_prefix, + conf->bindings_read_only); + memset (mp->alias_old, 0, WWID_SIZE); +- } + } - - if (mp->alias == NULL) - mp->alias = get_user_friendly_alias(mp->wwid, + + if (mp->alias == NULL) + mp->alias = get_user_friendly_alias(mp->wwid, diff --git a/SOURCES/0095-RHBZ-1127944-xtremIO-config.patch b/SOURCES/0095-RHBZ-1127944-xtremIO-config.patch index 216c0b94..6807cbc3 100644 --- a/SOURCES/0095-RHBZ-1127944-xtremIO-config.patch +++ b/SOURCES/0095-RHBZ-1127944-xtremIO-config.patch @@ -7,9 +7,9 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -1121,6 +1121,19 @@ static struct hwentry default_hw[] = { - .prio_name = PRIO_ALUA, - .prio_args = NULL, - }, + .prio_name = PRIO_ALUA, + .prio_args = NULL, + }, + { + .vendor = "XtremIO", + .product = "XtremApp", @@ -23,6 +23,6 @@ Index: multipath-tools-130222/libmultipath/hwtable.c + .prio_name = DEFAULT_PRIO, + .prio_args = NULL, + }, - /* - * EOL - */ + /* + * EOL + */ diff --git a/SOURCES/0096-RHBZ-979474-new-wildcards.patch b/SOURCES/0096-RHBZ-979474-new-wildcards.patch index d18e4adc..9025efe4 100644 --- a/SOURCES/0096-RHBZ-979474-new-wildcards.patch +++ b/SOURCES/0096-RHBZ-979474-new-wildcards.patch @@ -11,7 +11,7 @@ Index: multipath-tools-130222/libmultipath/print.c #include #include +#include - + #include "checkers.h" #include "vector.h" @@ -44,7 +45,7 @@ @@ -21,11 +21,11 @@ Index: multipath-tools-130222/libmultipath/print.c -snprint_str (char * buff, size_t len, char * str) +snprint_str (char * buff, size_t len, const char * str) { - return snprintf(buff, len, "%s", str); + return snprintf(buff, len, "%s", str); } @@ -432,6 +433,83 @@ snprint_path_mpp (char * buff, size_t le } - + static int +snprint_host_attr (char * buff, size_t len, struct path * pp, char *attr) +{ @@ -106,14 +106,15 @@ Index: multipath-tools-130222/libmultipath/print.c +static int snprint_path_checker (char * buff, size_t len, struct path * pp) { - struct checker * c = &pp->checker; + struct checker * c = &pp->checker; @@ -475,6 +553,10 @@ struct path_data pd[] = { - {'S', "size", 0, snprint_path_size}, - {'z', "serial", 0, snprint_path_serial}, - {'m', "multipath", 0, snprint_path_mpp}, + {'S', "size", 0, snprint_path_size}, + {'z', "serial", 0, snprint_path_serial}, + {'m', "multipath", 0, snprint_path_mpp}, + {'N', "host WWNN", 0, snprint_host_wwnn}, + {'n', "target WWNN", 0, snprint_tgt_wwnn}, + {'R', "host WWPN", 0, snprint_host_wwpn}, + {'r', "target WWPN", 0, snprint_tgt_wwpn}, - {0, NULL, 0 , NULL} + {0, NULL, 0 , NULL} }; + diff --git a/SOURCES/0097-RH-fix-coverity-errors.patch b/SOURCES/0097-RH-fix-coverity-errors.patch index db30d5e6..8ce0e87d 100644 --- a/SOURCES/0097-RH-fix-coverity-errors.patch +++ b/SOURCES/0097-RH-fix-coverity-errors.patch @@ -14,145 +14,145 @@ Index: multipath-tools-130222/kpartx/devmapper.c --- multipath-tools-130222.orig/kpartx/devmapper.c +++ multipath-tools-130222/kpartx/devmapper.c @@ -132,8 +132,9 @@ dm_addmap (int task, const char *name, c - goto addout; - r = dm_task_run (dmt); - + goto addout; + r = dm_task_run (dmt); + - addout: +addout: - dm_task_destroy (dmt); + dm_task_destroy (dmt); + free(prefixed_uuid); - - return r; + + return r; } Index: multipath-tools-130222/libmultipath/alias.c =================================================================== --- multipath-tools-130222.orig/libmultipath/alias.c +++ multipath-tools-130222/libmultipath/alias.c @@ -328,6 +328,7 @@ get_user_friendly_alias(char *wwid, char - if (fflush(f) != 0) { - condlog(0, "cannot fflush bindings file stream : %s", - strerror(errno)); + if (fflush(f) != 0) { + condlog(0, "cannot fflush bindings file stream : %s", + strerror(errno)); + free(alias); - fclose(f); - return NULL; - } + fclose(f); + return NULL; + } Index: multipath-tools-130222/libmultipath/blacklist.c =================================================================== --- multipath-tools-130222.orig/libmultipath/blacklist.c +++ multipath-tools-130222/libmultipath/blacklist.c @@ -79,6 +79,8 @@ set_ble_device (vector blist, char * ven - if (regcomp(&ble->vendor_reg, vendor, - REG_EXTENDED|REG_NOSUB)) { - FREE(vendor); + if (regcomp(&ble->vendor_reg, vendor, + REG_EXTENDED|REG_NOSUB)) { + FREE(vendor); + if (product) + FREE(product); - return 1; - } - ble->vendor = vendor; + return 1; + } + ble->vendor = vendor; @@ -87,6 +89,10 @@ set_ble_device (vector blist, char * ven - if (regcomp(&ble->product_reg, product, - REG_EXTENDED|REG_NOSUB)) { - FREE(product); + if (regcomp(&ble->product_reg, product, + REG_EXTENDED|REG_NOSUB)) { + FREE(product); + if (vendor) { + ble->vendor = NULL; + FREE(vendor); + } - return 1; - } - ble->product = product; + return 1; + } + ble->product = product; @@ -189,6 +195,7 @@ setup_default_blist (struct config * con - STRDUP(hwe->bl_product), - ORIGIN_DEFAULT)) { - FREE(ble); + STRDUP(hwe->bl_product), + ORIGIN_DEFAULT)) { + FREE(ble); + vector_del_slot(conf->blist_device, VECTOR_SIZE(conf->blist_device) - 1); - return 1; - } - } + return 1; + } + } Index: multipath-tools-130222/libmultipath/prioritizers/iet.c =================================================================== --- multipath-tools-130222.orig/libmultipath/prioritizers/iet.c +++ multipath-tools-130222/libmultipath/prioritizers/iet.c @@ -109,6 +109,7 @@ int iet_prio(const char *dev, char * arg - ssize_t nchars = readlink(path, buffer, sizeof(buffer)-1); - if (nchars != -1) { - char *device; + ssize_t nchars = readlink(path, buffer, sizeof(buffer)-1); + if (nchars != -1) { + char *device; + buffer[nchars] = '\0'; - device = find_regex(buffer,"(sd[a-z]+)"); - // if device parsed is the right one - if (device!=NULL && strncmp(device, dev, strlen(device)) == 0) { + device = find_regex(buffer,"(sd[a-z]+)"); + // if device parsed is the right one + if (device!=NULL && strncmp(device, dev, strlen(device)) == 0) { @@ -118,6 +119,7 @@ int iet_prio(const char *dev, char * arg - if (ip!=NULL && strncmp(ip, preferredip, strlen(ip)) == 0) { - // high prio - free(ip); + if (ip!=NULL && strncmp(ip, preferredip, strlen(ip)) == 0) { + // high prio + free(ip); + free(device); - closedir(dir_p); - return 20; - } + closedir(dir_p); + return 20; + } Index: multipath-tools-130222/libmultipath/prioritizers/weightedpath.c =================================================================== --- multipath-tools-130222.orig/libmultipath/prioritizers/weightedpath.c +++ multipath-tools-130222/libmultipath/prioritizers/weightedpath.c @@ -61,8 +61,10 @@ int prio_path_weight(struct path *pp, ch - regex = get_next_string(&temp, split_char); - - /* Return default priority if the argument is not parseable */ + regex = get_next_string(&temp, split_char); + + /* Return default priority if the argument is not parseable */ - if (!regex) + if (!regex) { + FREE(arg); - return priority; + return priority; + } - - if (!strcmp(regex, HBTL)) { - sprintf(path, "%d:%d:%d:%d", pp->sg_id.host_no, + + if (!strcmp(regex, HBTL)) { + sprintf(path, "%d:%d:%d:%d", pp->sg_id.host_no, @@ -72,6 +74,7 @@ int prio_path_weight(struct path *pp, ch - } else { - condlog(0, "%s: %s - Invalid arguments", pp->dev, - pp->prio.name); + } else { + condlog(0, "%s: %s - Invalid arguments", pp->dev, + pp->prio.name); + FREE(arg); - return priority; - } - + return priority; + } + Index: multipath-tools-130222/libmultipath/regex.c =================================================================== --- multipath-tools-130222.orig/libmultipath/regex.c +++ multipath-tools-130222/libmultipath/regex.c @@ -3936,8 +3936,11 @@ int eflags; - regs.num_regs = nmatch; - regs.start = TALLOC(nmatch, regoff_t); - regs.end = TALLOC(nmatch, regoff_t); + regs.num_regs = nmatch; + regs.start = TALLOC(nmatch, regoff_t); + regs.end = TALLOC(nmatch, regoff_t); - if (regs.start == NULL || regs.end == NULL) + if (regs.start == NULL || regs.end == NULL) { + free(regs.start); + free(regs.end); - return (int) REG_NOMATCH; + return (int) REG_NOMATCH; + } - } - - /* Perform the searching operation. */ + } + + /* Perform the searching operation. */ Index: multipath-tools-130222/libmultipath/sysfs.c =================================================================== --- multipath-tools-130222.orig/libmultipath/sysfs.c +++ multipath-tools-130222/libmultipath/sysfs.c @@ -88,7 +88,8 @@ ssize_t sysfs_attr_get_value(struct udev - } else if (size == value_len) { - condlog(4, "overflow while reading from %s", devpath); - size = 0; + } else if (size == value_len) { + condlog(4, "overflow while reading from %s", devpath); + size = 0; - } + } else + value[size] = '\0'; - - close(fd); - return size; + + close(fd); + return size; Index: multipath-tools-130222/libmultipath/util.c =================================================================== --- multipath-tools-130222.orig/libmultipath/util.c +++ multipath-tools-130222/libmultipath/util.c @@ -175,7 +175,7 @@ devt2devname (char *devname, int devname - sprintf(block_path,"/sys/dev/block/%u:%u", major, minor); - if (lstat(block_path, &statbuf) == 0) { - if (S_ISLNK(statbuf.st_mode) && + sprintf(block_path,"/sys/dev/block/%u:%u", major, minor); + if (lstat(block_path, &statbuf) == 0) { + if (S_ISLNK(statbuf.st_mode) && - readlink(block_path, dev, FILE_NAME_SIZE) > 0) { + readlink(block_path, dev, FILE_NAME_SIZE-1) > 0) { - char *p = strrchr(dev, '/'); - - if (!p) { + char *p = strrchr(dev, '/'); + + if (!p) { diff --git a/SOURCES/0098-UPBZ-1067171-mutipath-i.patch b/SOURCES/0098-UPBZ-1067171-mutipath-i.patch index d7038cbe..cf41863e 100644 --- a/SOURCES/0098-UPBZ-1067171-mutipath-i.patch +++ b/SOURCES/0098-UPBZ-1067171-mutipath-i.patch @@ -11,9 +11,9 @@ Index: multipath-tools-130222/libmultipath/config.h --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -23,6 +23,17 @@ enum devtypes { - DEV_DEVMAP + DEV_DEVMAP }; - + +enum mpath_cmds { + CMD_CREATE, + CMD_DRY_RUN, @@ -26,251 +26,251 @@ Index: multipath-tools-130222/libmultipath/config.h +}; + struct hwentry { - char * vendor; - char * product; + char * vendor; + char * product; @@ -79,8 +90,7 @@ struct mpentry { - + struct config { - int verbosity; + int verbosity; - int dry_run; - int list; + enum mpath_cmds cmd; - int pgpolicy_flag; - int pgpolicy; - enum devtypes dev_type; + int pgpolicy_flag; + int pgpolicy; + enum devtypes dev_type; @@ -98,6 +108,7 @@ struct config { - int max_fds; - int force_reload; - int queue_without_daemon; + int max_fds; + int force_reload; + int queue_without_daemon; + int ignore_wwids; - int checker_timeout; - int daemon; - int flush_on_last_del; + int checker_timeout; + int daemon; + int flush_on_last_del; Index: multipath-tools-130222/multipath/main.c =================================================================== --- multipath-tools-130222.orig/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -85,7 +85,7 @@ usage (char * progname) { - fprintf (stderr, VERSION_STRING); - fprintf (stderr, "Usage:\n"); + fprintf (stderr, VERSION_STRING); + fprintf (stderr, "Usage:\n"); - fprintf (stderr, " %s [-a|-A|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); + fprintf (stderr, " %s [-a|-A|-c|-w|-W] [-d] [-T tm:val] [-r] [-i] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); - fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); - fprintf (stderr, " %s -F [-v lvl]\n", progname); - fprintf (stderr, " %s -t\n", progname); + fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); + fprintf (stderr, " %s -F [-v lvl]\n", progname); + fprintf (stderr, " %s -t\n", progname); @@ -109,6 +109,7 @@ usage (char * progname) - " -d dry run, do not create or update devmaps\n" \ - " -t dump internal hardware table\n" \ - " -r force devmap reload\n" \ + " -d dry run, do not create or update devmaps\n" \ + " -t dump internal hardware table\n" \ + " -r force devmap reload\n" \ + " -i ignore wwids file\n" \ - " -B treat the bindings file as read only\n" \ - " -p policy failover|multibus|group_by_serial|group_by_prio\n" \ - " -b fil bindings file location\n" \ + " -B treat the bindings file as read only\n" \ + " -p policy failover|multibus|group_by_serial|group_by_prio\n" \ + " -b fil bindings file location\n" \ @@ -209,18 +210,19 @@ get_dm_mpvec (vector curmp, vector pathv - * If not in "fast list mode", we need to fetch information - * about them - */ + * If not in "fast list mode", we need to fetch information + * about them + */ - if (conf->list != 1) + if (conf->cmd != CMD_LIST_SHORT) - update_paths(mpp); - + update_paths(mpp); + - if (conf->list > 1) + if (conf->cmd == CMD_LIST_LONG) - mpp->bestpg = select_path_group(mpp); - - disassemble_status(status, mpp); - + mpp->bestpg = select_path_group(mpp); + + disassemble_status(status, mpp); + - if (conf->list) + if (conf->cmd == CMD_LIST_SHORT || + conf->cmd == CMD_LIST_LONG) - print_multipath_topology(mpp, conf->verbosity); - + print_multipath_topology(mpp, conf->verbosity); + - if (!conf->dry_run) + if (conf->cmd == CMD_CREATE) - reinstate_paths(mpp); - } - return 0; + reinstate_paths(mpp); + } + return 0; @@ -262,10 +264,11 @@ configure (void) - /* - * if we have a blacklisted device parameter, exit early - */ + /* + * if we have a blacklisted device parameter, exit early + */ - if (dev && conf->dev_type == DEV_DEVNODE && conf->dry_run != 3 && + if (dev && conf->dev_type == DEV_DEVNODE && + conf->cmd != CMD_REMOVE_WWID && - (filter_devnode(conf->blist_devnode, - conf->elist_devnode, dev) > 0)) { + (filter_devnode(conf->blist_devnode, + conf->elist_devnode, dev) > 0)) { - if (conf->dry_run == 2) + if (conf->cmd == CMD_VALID_PATH) - printf("%s is not a valid multipath device path\n", - conf->dev); - goto out; + printf("%s is not a valid multipath device path\n", + conf->dev); + goto out; @@ -278,13 +281,13 @@ configure (void) - int failed = get_refwwid(conf->dev, conf->dev_type, pathvec, - &refwwid); - if (!refwwid) { + int failed = get_refwwid(conf->dev, conf->dev_type, pathvec, + &refwwid); + if (!refwwid) { - if (failed == 2 && conf->dry_run == 2) + if (failed == 2 && conf->cmd == CMD_VALID_PATH) - printf("%s is not a valid multipath device path\n", conf->dev); - else - condlog(3, "scope is nul"); - goto out; - } + printf("%s is not a valid multipath device path\n", conf->dev); + else + condlog(3, "scope is nul"); + goto out; + } - if (conf->dry_run == 3) { + if (conf->cmd == CMD_REMOVE_WWID) { - r = remove_wwid(refwwid); - if (r == 0) - printf("wwid '%s' removed\n", refwwid); + r = remove_wwid(refwwid); + if (r == 0) + printf("wwid '%s' removed\n", refwwid); @@ -295,7 +298,7 @@ configure (void) - } - goto out; - } + } + goto out; + } - if (conf->dry_run == 5) { + if (conf->cmd == CMD_ADD_WWID) { - r = remember_wwid(refwwid); - if (r == 0) - printf("wwid '%s' added\n", refwwid); + r = remember_wwid(refwwid); + if (r == 0) + printf("wwid '%s' added\n", refwwid); @@ -305,13 +308,13 @@ configure (void) - goto out; - } - condlog(3, "scope limited to %s", refwwid); + goto out; + } + condlog(3, "scope limited to %s", refwwid); - if (conf->dry_run == 2) { - if (check_wwids_file(refwwid, 0) == 0){ - printf("%s is a valid multipath device path\n", conf->dev); + if (conf->cmd == CMD_VALID_PATH) { + if (conf->ignore_wwids || + check_wwids_file(refwwid, 0) == 0) - r = 0; + r = 0; - } - else - printf("%s is not a valid multipath device path\n", conf->dev); + + printf("%s %s a valid multipath device path\n", + conf->dev, r == 0 ? "is" : "is not"); - goto out; - } - } + goto out; + } + } @@ -319,13 +322,13 @@ configure (void) - /* - * get a path list - */ + /* + * get a path list + */ - if (conf->dev && !conf->list) + if (conf->dev) - di_flag = DI_WWID; - + di_flag = DI_WWID; + - if (conf->list > 1) + if (conf->cmd == CMD_LIST_LONG) - /* extended path info '-ll' */ - di_flag |= DI_SYSFS | DI_CHECKER; + /* extended path info '-ll' */ + di_flag |= DI_SYSFS | DI_CHECKER; - else if (conf->list) + else if (conf->cmd == CMD_LIST_SHORT) - /* minimum path info '-l' */ - di_flag |= DI_SYSFS; - else + /* minimum path info '-l' */ + di_flag |= DI_SYSFS; + else @@ -345,7 +348,7 @@ configure (void) - - filter_pathvec(pathvec, refwwid); - + + filter_pathvec(pathvec, refwwid); + - if (conf->list) { + if (conf->cmd != CMD_CREATE && conf->cmd != CMD_DRY_RUN) { - r = 0; - goto out; - } + r = 0; + goto out; + } @@ -440,7 +443,7 @@ main (int argc, char *argv[]) - int r = 1; - long int timestamp = -1; - int valid = -1; + int r = 1; + long int timestamp = -1; + int valid = -1; - while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { + while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BritT:qwW")) != EOF ) { - switch(arg) { - case 'T': - if (optarg[0] == ':') + switch(arg) { + case 'T': + if (optarg[0] == ':') @@ -476,7 +479,7 @@ main (int argc, char *argv[]) - if (dm_prereq()) - exit(1); - + if (dm_prereq()) + exit(1); + - while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) { + while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BritT:qwW")) != EOF ) { - switch(arg) { - case 1: printf("optarg : %s\n",optarg); - break; + switch(arg) { + case 1: printf("optarg : %s\n",optarg); + break; @@ -499,11 +502,11 @@ main (int argc, char *argv[]) - conf->allow_queueing = 1; - break; - case 'c': + conf->allow_queueing = 1; + break; + case 'c': - conf->dry_run = 2; + conf->cmd = CMD_VALID_PATH; - break; - case 'd': + break; + case 'd': - if (!conf->dry_run) - conf->dry_run = 1; + if (conf->cmd == CMD_CREATE) + conf->cmd = CMD_DRY_RUN; - break; - case 'f': - conf->remove = FLUSH_ONE; + break; + case 'f': + conf->remove = FLUSH_ONE; @@ -512,11 +515,10 @@ main (int argc, char *argv[]) - conf->remove = FLUSH_ALL; - break; - case 'l': + conf->remove = FLUSH_ALL; + break; + case 'l': - conf->list = 1; - conf->dry_run = 1; - - if (optarg && !strncmp(optarg, "l", 1)) + if (optarg && !strncmp(optarg, "l", 1)) - conf->list++; + conf->cmd = CMD_LIST_LONG; + else + conf->cmd = CMD_LIST_SHORT; - - break; - case 'M': + + break; + case 'M': @@ -535,6 +537,9 @@ main (int argc, char *argv[]) - case 'r': - conf->force_reload = 1; - break; + case 'r': + conf->force_reload = 1; + break; + case 'i': + conf->ignore_wwids = 1; + break; - case 't': - r = dump_config(); - goto out; + case 't': + r = dump_config(); + goto out; @@ -548,13 +553,13 @@ main (int argc, char *argv[]) - usage(argv[0]); - exit(0); - case 'w': + usage(argv[0]); + exit(0); + case 'w': - conf->dry_run = 3; + conf->cmd = CMD_REMOVE_WWID; - break; - case 'W': + break; + case 'W': - conf->dry_run = 4; + conf->cmd = CMD_RESET_WWIDS; - break; - case 'a': + break; + case 'a': - conf->dry_run = 5; + conf->cmd = CMD_ADD_WWID; - break; - case ':': - fprintf(stderr, "Missing option argument\n"); + break; + case ':': + fprintf(stderr, "Missing option argument\n"); @@ -600,16 +605,16 @@ main (int argc, char *argv[]) - } - dm_init(); - + } + dm_init(); + - if (conf->dry_run == 2 && + if (conf->cmd == CMD_VALID_PATH && - (!conf->dev || conf->dev_type == DEV_DEVMAP)) { - condlog(0, "the -c option requires a path to check"); - goto out; - } + (!conf->dev || conf->dev_type == DEV_DEVMAP)) { + condlog(0, "the -c option requires a path to check"); + goto out; + } - if (conf->dry_run == 3 && !conf->dev) { + if (conf->cmd == CMD_REMOVE_WWID && !conf->dev) { - condlog(0, "the -w option requires a device"); - goto out; - } + condlog(0, "the -w option requires a device"); + goto out; + } - if (conf->dry_run == 4) { + if (conf->cmd == CMD_RESET_WWIDS) { - struct multipath * mpp; - int i; - vector curmp; + struct multipath * mpp; + int i; + vector curmp; Index: multipath-tools-130222/multipath/multipath.8 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.8 @@ -299,34 +299,34 @@ Index: multipath-tools-130222/libmultipath/configure.c --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -580,7 +580,7 @@ domap (struct multipath * mpp, char * pa - /* - * last chance to quit before touching the devmaps - */ + /* + * last chance to quit before touching the devmaps + */ - if (conf->dry_run && mpp->action != ACT_NOTHING) { + if (conf->cmd == CMD_DRY_RUN && mpp->action != ACT_NOTHING) { - print_multipath_topology(mpp, conf->verbosity); - return DOMAP_DRY; - } + print_multipath_topology(mpp, conf->verbosity); + return DOMAP_DRY; + } Index: multipath-tools-130222/libmultipath/discovery.c =================================================================== --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -54,7 +54,8 @@ store_pathinfo (vector pathvec, vector h - } - pp->udev = udev_device_ref(udevice); - err = pathinfo(pp, hwtable, + } + pp->udev = udev_device_ref(udevice); + err = pathinfo(pp, hwtable, - (conf->dry_run == 3)? flag : (flag | DI_BLACKLIST)); + (conf->cmd == CMD_REMOVE_WWID)? flag : + (flag | DI_BLACKLIST)); - if (err) - goto out; - + if (err) + goto out; + @@ -1101,7 +1102,7 @@ get_uid (struct path * pp) - - memset(pp->wwid, 0, WWID_SIZE); - value = udev_device_get_property_value(pp->udev, pp->uid_attribute); + + memset(pp->wwid, 0, WWID_SIZE); + value = udev_device_get_property_value(pp->udev, pp->uid_attribute); - if ((!value || strlen(value) == 0) && conf->dry_run == 2) + if ((!value || strlen(value) == 0) && conf->cmd == CMD_VALID_PATH) - value = getenv(pp->uid_attribute); - if (value && strlen(value)) { - size_t len = WWID_SIZE; + value = getenv(pp->uid_attribute); + if (value && strlen(value)) { + size_t len = WWID_SIZE; diff --git a/SOURCES/0099-RH-add-all-devs.patch b/SOURCES/0099-RH-add-all-devs.patch index ee7e7faa..aca6d4c3 100644 --- a/SOURCES/0099-RH-add-all-devs.patch +++ b/SOURCES/0099-RH-add-all-devs.patch @@ -1,6 +1,6 @@ --- libmultipath/config.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++- - libmultipath/config.h | 1 + libmultipath/config.h | 1 libmultipath/dict.c | 38 +++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 1 deletion(-) @@ -9,18 +9,18 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -113,6 +113,8 @@ find_hwe (vector hwtable, char * vendor, - * continuing to the generic entries - */ - vector_foreach_slot_backwards (hwtable, tmp, i) { + * continuing to the generic entries + */ + vector_foreach_slot_backwards (hwtable, tmp, i) { + if (tmp->all_devs == 1) + continue; - if (hwe_regmatch(tmp, &hwe)) - continue; - ret = tmp; + if (hwe_regmatch(tmp, &hwe)) + continue; + ret = tmp; @@ -348,6 +350,62 @@ merge_hwe (struct hwentry * dst, struct - return 0; + return 0; } - + +#define overwrite_str(s) \ +do { \ + if (src->s) { \ @@ -81,37 +81,37 @@ Index: multipath-tools-130222/libmultipath/config.c store_hwe (vector hwtable, struct hwentry * dhwe) { @@ -431,7 +489,11 @@ restart: - break; - j = n; - vector_foreach_slot_after(hw, hwe2, j) { + break; + j = n; + vector_foreach_slot_after(hw, hwe2, j) { - if (conf->hw_strmatch) { + if (hwe2->all_devs == 1) { + overwrite_hwe(hwe1, hwe2); + continue; + } + else if (conf->hw_strmatch) { - if (hwe_strmatch(hwe2, hwe1)) - continue; - } + if (hwe_strmatch(hwe2, hwe1)) + continue; + } Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -47,6 +47,7 @@ struct hwentry { - char * prio_args; - char * alias_prefix; - + char * prio_args; + char * alias_prefix; + + int all_devs; - int pgpolicy; - int pgfailback; - int rr_weight; + int pgpolicy; + int pgfailback; + int rr_weight; Index: multipath-tools-130222/libmultipath/dict.c =================================================================== --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -918,6 +918,32 @@ device_handler(vector strvec) } - + static int +all_devs_handler(vector strvec) +{ @@ -141,10 +141,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int vendor_handler(vector strvec) { - struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); + struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); @@ -2182,6 +2208,17 @@ snprint_hw_dev_loss(char * buff, int len } - + static int +snprint_hw_all_devs (char *buff, int len, void *data) +{ @@ -159,12 +159,12 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_hw_vendor (char * buff, int len, void * data) { - struct hwentry * hwe = (struct hwentry *)data; + struct hwentry * hwe = (struct hwentry *)data; @@ -2968,6 +3005,7 @@ init_keywords(void) - install_keyword_root("devices", &devices_handler); - install_keyword_multi("device", &device_handler, NULL); - install_sublevel(); + install_keyword_root("devices", &devices_handler); + install_keyword_multi("device", &device_handler, NULL); + install_sublevel(); + install_keyword("all_devs", &all_devs_handler, &snprint_hw_all_devs); - install_keyword("vendor", &vendor_handler, &snprint_hw_vendor); - install_keyword("product", &product_handler, &snprint_hw_product); - install_keyword("revision", &revision_handler, &snprint_hw_revision); + install_keyword("vendor", &vendor_handler, &snprint_hw_vendor); + install_keyword("product", &product_handler, &snprint_hw_product); + install_keyword("revision", &revision_handler, &snprint_hw_revision); diff --git a/SOURCES/0100-RHBZ-1067171-multipath-i-update.patch b/SOURCES/0100-RHBZ-1067171-multipath-i-update.patch index 1eb866c3..9a67e7aa 100644 --- a/SOURCES/0100-RHBZ-1067171-multipath-i-update.patch +++ b/SOURCES/0100-RHBZ-1067171-multipath-i-update.patch @@ -7,19 +7,19 @@ Index: multipath-tools-130222/multipath/main.c --- multipath-tools-130222.orig/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -198,6 +198,9 @@ get_dm_mpvec (vector curmp, vector pathv - continue; - } - + continue; + } + + if (conf->cmd == CMD_VALID_PATH) + continue; + - dm_get_map(mpp->alias, &mpp->size, params); - condlog(3, "params = %s", params); - dm_get_status(mpp->alias, status); + dm_get_map(mpp->alias, &mpp->size, params); + condlog(3, "params = %s", params); + dm_get_status(mpp->alias, status); @@ -308,7 +311,13 @@ configure (void) - goto out; - } - condlog(3, "scope limited to %s", refwwid); + goto out; + } + condlog(3, "scope limited to %s", refwwid); - if (conf->cmd == CMD_VALID_PATH) { + /* If you are ignoring the wwids file and find_multipaths is + * set, you need to actually check if there are two available @@ -28,13 +28,13 @@ Index: multipath-tools-130222/multipath/main.c + * the paths */ + if (conf->cmd == CMD_VALID_PATH && + (!conf->find_multipaths || !conf->ignore_wwids)) { - if (conf->ignore_wwids || - check_wwids_file(refwwid, 0) == 0) - r = 0; + if (conf->ignore_wwids || + check_wwids_file(refwwid, 0) == 0) + r = 0; @@ -348,6 +357,20 @@ configure (void) - - filter_pathvec(pathvec, refwwid); - + + filter_pathvec(pathvec, refwwid); + + + if (conf->cmd == CMD_VALID_PATH) { + /* This only happens if find_multipaths is and @@ -49,6 +49,6 @@ Index: multipath-tools-130222/multipath/main.c + goto out; + } + - if (conf->cmd != CMD_CREATE && conf->cmd != CMD_DRY_RUN) { - r = 0; - goto out; + if (conf->cmd != CMD_CREATE && conf->cmd != CMD_DRY_RUN) { + r = 0; + goto out; diff --git a/SOURCES/0101-RH-cleanup-partmaps-code.patch b/SOURCES/0101-RH-cleanup-partmaps-code.patch index fd43e747..57fb402c 100644 --- a/SOURCES/0101-RH-cleanup-partmaps-code.patch +++ b/SOURCES/0101-RH-cleanup-partmaps-code.patch @@ -7,21 +7,21 @@ Index: multipath-tools-130222/libmultipath/devmapper.c --- multipath-tools-130222.orig/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -1006,8 +1006,9 @@ bad: - return NULL; + return NULL; } - + -int -dm_remove_partmaps (const char * mapname, int need_sync) +static int +do_foreach_partmaps (const char * mapname, int (*partmap_func)(char *, void *), + void *data) { - struct dm_task *dmt; - struct dm_names *names; + struct dm_task *dmt; + struct dm_names *names; @@ -1059,26 +1060,8 @@ dm_remove_partmaps (const char * mapname - */ - strstr(params, dev_t) - ) { + */ + strstr(params, dev_t) + ) { - /* - * then it's a kpartx generated partition. - * remove it. @@ -44,13 +44,13 @@ Index: multipath-tools-130222/libmultipath/devmapper.c - need_sync, 0); + if (partmap_func(names->name, data) != 0) + goto out; - } - - next = names->next; + } + + next = names->next; @@ -1091,6 +1074,35 @@ out: - return r; + return r; } - + +struct remove_data { + int need_sync; +}; @@ -84,9 +84,9 @@ Index: multipath-tools-130222/libmultipath/devmapper.c alloc_dminfo (void) { @@ -1140,86 +1152,41 @@ out: - return r; + return r; } - + -int -dm_rename_partmaps (char * old, char * new) +struct rename_data { @@ -101,17 +101,17 @@ Index: multipath-tools-130222/libmultipath/devmapper.c - struct dm_task *dmt; - struct dm_names *names; - unsigned next = 0; - char buff[PARAMS_SIZE]; + char buff[PARAMS_SIZE]; - unsigned long long size; - char dev_t[32]; - int r = 1; - int offset; + int offset; - char *delim; - - if (!(dmt = dm_task_create(DM_DEVICE_LIST))) - return 1; + struct rename_data *rd = (struct rename_data *)data; - + - dm_task_no_open_count(dmt); - - if (!dm_task_run(dmt)) @@ -133,20 +133,20 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + condlog(4, "partition map %s renamed", name); + return 0; +} - + - if (dm_dev_t(old, &dev_t[0], 32)) - goto out; +int +dm_rename_partmaps (char * old, char * new) +{ + struct rename_data rd; - + + rd.old = old; + rd.new = new; - if (isdigit(new[strlen(new)-1])) + if (isdigit(new[strlen(new)-1])) - delim = "p"; + rd.delim = "p"; - else + else - delim = ""; - - do { @@ -195,5 +195,5 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + rd.delim = ""; + return do_foreach_partmaps(old, rename_partmap, &rd); } - + int diff --git a/SOURCES/0102-RHBZ-631009-deferred-remove.patch b/SOURCES/0102-RHBZ-631009-deferred-remove.patch index 3e29f6f7..9e403372 100644 --- a/SOURCES/0102-RHBZ-631009-deferred-remove.patch +++ b/SOURCES/0102-RHBZ-631009-deferred-remove.patch @@ -1,16 +1,16 @@ --- libmultipath/Makefile | 6 + - libmultipath/config.c | 3 - libmultipath/config.h | 3 - libmultipath/configure.c | 1 - libmultipath/defaults.h | 1 + libmultipath/config.c | 3 + libmultipath/config.h | 3 + libmultipath/configure.c | 1 + libmultipath/defaults.h | 1 libmultipath/devmapper.c | 142 ++++++++++++++++++++++++++++++++++++++++----- libmultipath/devmapper.h | 11 ++- libmultipath/dict.c | 116 ++++++++++++++++++++++++++++++++++++ libmultipath/propsel.c | 28 ++++++++ - libmultipath/propsel.h | 1 + libmultipath/propsel.h | 1 libmultipath/structs.h | 8 ++ - libmultipath/structs_vec.c | 3 + libmultipath/structs_vec.c | 3 multipath/multipath.conf.5 | 14 ++++ multipathd/main.c | 23 +++++-- 14 files changed, 333 insertions(+), 27 deletions(-) @@ -20,69 +20,69 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -337,6 +337,7 @@ merge_hwe (struct hwentry * dst, struct - merge_num(user_friendly_names); - merge_num(retain_hwhandler); - merge_num(detect_prio); + merge_num(user_friendly_names); + merge_num(retain_hwhandler); + merge_num(detect_prio); + merge_num(deferred_remove); - - /* - * Make sure features is consistent with + + /* + * Make sure features is consistent with @@ -394,6 +395,7 @@ overwrite_hwe (struct hwentry * dst, str - overwrite_num(user_friendly_names); - overwrite_num(retain_hwhandler); - overwrite_num(detect_prio); + overwrite_num(user_friendly_names); + overwrite_num(retain_hwhandler); + overwrite_num(detect_prio); + overwrite_num(deferred_remove); - - /* - * Make sure features is consistent with + + /* + * Make sure features is consistent with @@ -617,6 +619,7 @@ load_config (char * file, struct udev *u - conf->fast_io_fail = DEFAULT_FAST_IO_FAIL; - conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER; - conf->detect_prio = DEFAULT_DETECT_PRIO; + conf->fast_io_fail = DEFAULT_FAST_IO_FAIL; + conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER; + conf->detect_prio = DEFAULT_DETECT_PRIO; + conf->deferred_remove = DEFAULT_DEFERRED_REMOVE; - conf->hw_strmatch = 0; - conf->force_sync = 0; - + conf->hw_strmatch = 0; + conf->force_sync = 0; + Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -61,6 +61,7 @@ struct hwentry { - int user_friendly_names; - int retain_hwhandler; - int detect_prio; + int user_friendly_names; + int retain_hwhandler; + int detect_prio; + int deferred_remove; - char * bl_product; + char * bl_product; }; - + @@ -84,6 +85,7 @@ struct mpentry { - int flush_on_last_del; - int attribute_flags; - int user_friendly_names; + int flush_on_last_del; + int attribute_flags; + int user_friendly_names; + int deferred_remove; - uid_t uid; - gid_t gid; - mode_t mode; + uid_t uid; + gid_t gid; + mode_t mode; @@ -128,6 +130,7 @@ struct config { - int retain_hwhandler; - int detect_prio; - int force_sync; + int retain_hwhandler; + int detect_prio; + int force_sync; + int deferred_remove; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/libmultipath/configure.c =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -290,6 +290,7 @@ setup_map (struct multipath * mpp, char - select_dev_loss(mpp); - select_reservation_key(mpp); - select_retain_hwhandler(mpp); + select_dev_loss(mpp); + select_reservation_key(mpp); + select_retain_hwhandler(mpp); + select_deferred_remove(mpp); - - sysfs_set_scsi_tmo(mpp); - /* + + sysfs_set_scsi_tmo(mpp); + /* Index: multipath-tools-130222/libmultipath/defaults.h =================================================================== --- multipath-tools-130222.orig/libmultipath/defaults.h @@ -92,7 +92,7 @@ Index: multipath-tools-130222/libmultipath/defaults.h #define DEFAULT_RETAIN_HWHANDLER RETAIN_HWHANDLER_OFF #define DEFAULT_DETECT_PRIO DETECT_PRIO_OFF +#define DEFAULT_DEFERRED_REMOVE DEFERRED_REMOVE_OFF - + #define DEFAULT_CHECKINT 5 #define MAX_CHECKINT(a) (a << 2) Index: multipath-tools-130222/libmultipath/devmapper.c @@ -102,7 +102,7 @@ Index: multipath-tools-130222/libmultipath/devmapper.c @@ -32,6 +32,8 @@ #define UUID_PREFIX "mpath-" #define UUID_PREFIX_LEN 6 - + +static int dm_cancel_remove_partmaps(const char * mapname); + #ifndef LIBDM_API_COOKIE @@ -110,47 +110,47 @@ Index: multipath-tools-130222/libmultipath/devmapper.c { @@ -103,7 +105,9 @@ dm_lib_prereq (void) { - char version[64]; - int v[3]; + char version[64]; + int v[3]; -#if defined(DM_SUBSYSTEM_UDEV_FLAG0) +#if defined(LIBDM_API_DEFERRED) + int minv[3] = {1, 2, 89}; +#elif defined(DM_SUBSYSTEM_UDEV_FLAG0) - int minv[3] = {1, 2, 82}; + int minv[3] = {1, 2, 82}; #elif defined(LIBDM_API_COOKIE) - int minv[3] = {1, 2, 38}; + int minv[3] = {1, 2, 38}; @@ -201,8 +205,10 @@ dm_prereq (void) - return dm_drv_prereq(); + return dm_drv_prereq(); } - + +#define do_deferred(x) ((x) == DEFERRED_REMOVE_ON || (x) == DEFERRED_REMOVE_IN_PROGRESS) + static int -dm_simplecmd (int task, const char *name, int no_flush, int need_sync, uint16_t udev_flags) { +dm_simplecmd (int task, const char *name, int no_flush, int need_sync, uint16_t udev_flags, int deferred_remove) { - int r = 0; - int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME || - task == DM_DEVICE_REMOVE)); + int r = 0; + int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME || + task == DM_DEVICE_REMOVE)); @@ -220,7 +226,10 @@ dm_simplecmd (int task, const char *name - if (no_flush) - dm_task_no_flush(dmt); /* for DM_DEVICE_SUSPEND/RESUME */ + if (no_flush) + dm_task_no_flush(dmt); /* for DM_DEVICE_SUSPEND/RESUME */ #endif - +#ifdef LIBDM_API_DEFERRED + if (do_deferred(deferred_remove)) + dm_task_deferred_remove(dmt); +#endif - if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags)) - goto out; - r = dm_task_run (dmt); + if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags)) + goto out; + r = dm_task_run (dmt); @@ -232,12 +241,18 @@ dm_simplecmd (int task, const char *name - + extern int dm_simplecmd_flush (int task, const char *name, int needsync, uint16_t udev_flags) { - return dm_simplecmd(task, name, 0, needsync, udev_flags); + return dm_simplecmd(task, name, 0, needsync, udev_flags, 0); } - + extern int dm_simplecmd_noflush (int task, const char *name, uint16_t udev_flags) { - return dm_simplecmd(task, name, 1, 1, udev_flags); @@ -162,46 +162,46 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + return dm_simplecmd(DM_DEVICE_REMOVE, name, 0, needsync, 0, + deferred_remove); } - + extern int @@ -653,7 +668,7 @@ out: } - + extern int -_dm_flush_map (const char * mapname, int need_sync) +_dm_flush_map (const char * mapname, int need_sync, int deferred_remove) { - int r; - + int r; + @@ -663,23 +678,46 @@ _dm_flush_map (const char * mapname, int - if (dm_type(mapname, TGT_MPATH) <= 0) - return 0; /* nothing to do */ - + if (dm_type(mapname, TGT_MPATH) <= 0) + return 0; /* nothing to do */ + - if (dm_remove_partmaps(mapname, need_sync)) + if (dm_remove_partmaps(mapname, need_sync, deferred_remove)) - return 1; - + return 1; + - if (dm_get_opencount(mapname)) { + if (!do_deferred(deferred_remove) && dm_get_opencount(mapname)) { - condlog(2, "%s: map in use", mapname); - return 1; - } - + condlog(2, "%s: map in use", mapname); + return 1; + } + - r = dm_simplecmd_flush(DM_DEVICE_REMOVE, mapname, need_sync, 0); + r = dm_device_remove(mapname, need_sync, deferred_remove); - - if (r) { + + if (r) { + if (do_deferred(deferred_remove) && dm_map_present(mapname)) { + condlog(4, "multipath map %s remove deferred", + mapname); + return 2; + } - condlog(4, "multipath map %s removed", mapname); - return 0; - } - return 1; + condlog(4, "multipath map %s removed", mapname); + return 0; + } + return 1; } - + +#ifdef LIBDM_API_DEFERRED + +int @@ -224,42 +224,42 @@ Index: multipath-tools-130222/libmultipath/devmapper.c dm_suspend_and_flush_map (const char * mapname) { @@ -1076,6 +1114,7 @@ out: - + struct remove_data { - int need_sync; + int need_sync; + int deferred_remove; }; - + static int @@ -1084,25 +1123,98 @@ remove_partmap(char *name, void *data) - struct remove_data *rd = (struct remove_data *)data; - - if (dm_get_opencount(name)) { + struct remove_data *rd = (struct remove_data *)data; + + if (dm_get_opencount(name)) { - dm_remove_partmaps(name, rd->need_sync); - if (dm_get_opencount(name)) { + dm_remove_partmaps(name, rd->need_sync, rd->deferred_remove); + if (!do_deferred(rd->deferred_remove) && + dm_get_opencount(name)) { - condlog(2, "%s: map in use", name); - return 1; - } - } - condlog(4, "partition map %s removed", name); + condlog(2, "%s: map in use", name); + return 1; + } + } + condlog(4, "partition map %s removed", name); - dm_simplecmd_flush(DM_DEVICE_REMOVE, name, - rd->need_sync, 0); + dm_device_remove(name, rd->need_sync, rd->deferred_remove); - return 0; + return 0; } - + int -dm_remove_partmaps (const char * mapname, int need_sync) +dm_remove_partmaps (const char * mapname, int need_sync, int deferred_remove) { - struct remove_data rd = { need_sync }; + struct remove_data rd = { need_sync, deferred_remove }; - return do_foreach_partmaps(mapname, remove_partmap, &rd); + return do_foreach_partmaps(mapname, remove_partmap, &rd); } - + +#ifdef LIBDM_API_DEFERRED + +static int @@ -370,9 +370,9 @@ Index: multipath-tools-130222/libmultipath/dict.c --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -738,6 +738,29 @@ def_force_sync_handler(vector strvec) - return 0; + return 0; } - + +static int +def_deferred_remove_handler(vector strvec) +{ @@ -400,9 +400,9 @@ Index: multipath-tools-130222/libmultipath/dict.c * blacklist block handlers */ @@ -1445,6 +1468,33 @@ hw_detect_prio_handler(vector strvec) - return 0; + return 0; } - + +static int +hw_deferred_remove_handler(vector strvec) +{ @@ -434,9 +434,9 @@ Index: multipath-tools-130222/libmultipath/dict.c * multipaths block handlers */ @@ -1920,6 +1970,32 @@ mp_names_handler(vector strvec) - return 0; + return 0; } - + +static int +mp_deferred_remove_handler(vector strvec) +{ @@ -467,17 +467,17 @@ Index: multipath-tools-130222/libmultipath/dict.c * config file keywords printing */ @@ -2165,7 +2241,7 @@ snprint_mp_reservation_key (char * buff, - return snprintf(buff, len, "0x%" PRIx64, prkey); + return snprintf(buff, len, "0x%" PRIx64, prkey); } - + - static int +static int snprint_mp_user_friendly_names (char * buff, int len, void * data) { - struct mpentry * mpe = (struct mpentry *)data; + struct mpentry * mpe = (struct mpentry *)data; @@ -2179,6 +2255,19 @@ snprint_mp_user_friendly_names (char * b } - + static int +snprint_mp_deferred_remove (char * buff, int len, void * data) +{ @@ -494,10 +494,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_hw_fast_io_fail(char * buff, int len, void * data) { - struct hwentry * hwe = (struct hwentry *)data; + struct hwentry * hwe = (struct hwentry *)data; @@ -2507,6 +2596,19 @@ snprint_hw_retain_hwhandler_handler(char } - + static int +snprint_hw_deferred_remove(char * buff, int len, void * data) +{ @@ -514,10 +514,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_detect_prio(char * buff, int len, void * data) { - struct hwentry * hwe = (struct hwentry *)data; + struct hwentry * hwe = (struct hwentry *)data; @@ -2900,6 +3002,15 @@ snprint_def_force_sync(char * buff, int } - + static int +snprint_def_deferred_remove(char * buff, int len, void * data) +{ @@ -530,29 +530,29 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_ble_simple (char * buff, int len, void * data) { - struct blentry * ble = (struct blentry *)data; + struct blentry * ble = (struct blentry *)data; @@ -2968,6 +3079,7 @@ init_keywords(void) - install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio); - install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch); - install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync); + install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio); + install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch); + install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync); + install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove); - __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); + __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); @@ -3032,6 +3144,7 @@ init_keywords(void) - install_keyword("user_friendly_names", &hw_names_handler, &snprint_hw_user_friendly_names); - install_keyword("retain_attached_hw_handler", &hw_retain_hwhandler_handler, &snprint_hw_retain_hwhandler_handler); - install_keyword("detect_prio", &hw_detect_prio_handler, &snprint_detect_prio); + install_keyword("user_friendly_names", &hw_names_handler, &snprint_hw_user_friendly_names); + install_keyword("retain_attached_hw_handler", &hw_retain_hwhandler_handler, &snprint_hw_retain_hwhandler_handler); + install_keyword("detect_prio", &hw_detect_prio_handler, &snprint_detect_prio); + install_keyword("deferred_remove", &hw_deferred_remove_handler, &snprint_hw_deferred_remove); - install_sublevel_end(); - - install_keyword_root("multipaths", &multipaths_handler); + install_sublevel_end(); + + install_keyword_root("multipaths", &multipaths_handler); @@ -3056,5 +3169,6 @@ init_keywords(void) - install_keyword("gid", &mp_gid_handler, &snprint_mp_gid); - install_keyword("reservation_key", &mp_reservation_key_handler, &snprint_mp_reservation_key); - install_keyword("user_friendly_names", &mp_names_handler, &snprint_mp_user_friendly_names); + install_keyword("gid", &mp_gid_handler, &snprint_mp_gid); + install_keyword("reservation_key", &mp_reservation_key_handler, &snprint_mp_reservation_key); + install_keyword("user_friendly_names", &mp_names_handler, &snprint_mp_user_friendly_names); + install_keyword("deferred_remove", &mp_deferred_remove_handler, &snprint_mp_deferred_remove); - install_sublevel_end(); + install_sublevel_end(); } Index: multipath-tools-130222/libmultipath/propsel.c =================================================================== @@ -560,7 +560,7 @@ Index: multipath-tools-130222/libmultipath/propsel.c +++ multipath-tools-130222/libmultipath/propsel.c @@ -744,6 +744,34 @@ select_retain_hwhandler (struct multipat } - + extern int +select_deferred_remove (struct multipath *mp) +{ @@ -592,7 +592,7 @@ Index: multipath-tools-130222/libmultipath/propsel.c +extern int select_detect_prio (struct path * pp) { - if (pp->hwe && pp->hwe->detect_prio) { + if (pp->hwe && pp->hwe->detect_prio) { Index: multipath-tools-130222/libmultipath/propsel.h =================================================================== --- multipath-tools-130222.orig/libmultipath/propsel.h @@ -607,9 +607,9 @@ Index: multipath-tools-130222/libmultipath/structs.h --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -114,6 +114,13 @@ enum detect_prio_states { - DETECT_PRIO_ON, + DETECT_PRIO_ON, }; - + +enum deferred_remove_states { + DEFERRED_REMOVE_UNDEF, + DEFERRED_REMOVE_OFF, @@ -618,23 +618,23 @@ Index: multipath-tools-130222/libmultipath/structs.h +}; + enum scsi_protocol { - SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */ - SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */ + SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */ + SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */ @@ -207,6 +214,7 @@ struct multipath { - int attribute_flags; - int fast_io_fail; - int retain_hwhandler; + int attribute_flags; + int fast_io_fail; + int retain_hwhandler; + int deferred_remove; - unsigned int dev_loss; - uid_t uid; - gid_t gid; + unsigned int dev_loss; + uid_t uid; + gid_t gid; Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -214,19 +214,30 @@ sync_maps_state(vector mpvec) } - + static int -flush_map(struct multipath * mpp, struct vectors * vecs) +flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths) @@ -645,16 +645,16 @@ Index: multipath-tools-130222/multipathd/main.c + r = dm_flush_map_nopaths(mpp->alias, mpp->deferred_remove); + else + r = dm_flush_map(mpp->alias); - /* - * clear references to this map before flushing so we can ignore - * the spurious uevent we may generate with the dm_flush_map call below - */ + /* + * clear references to this map before flushing so we can ignore + * the spurious uevent we may generate with the dm_flush_map call below + */ - if (dm_flush_map(mpp->alias)) { + if (r) { - /* - * May not really be an error -- if the map was already flushed - * from the device mapper by dmsetup(8) for instance. - */ + /* + * May not really be an error -- if the map was already flushed + * from the device mapper by dmsetup(8) for instance. + */ - condlog(0, "%s: can't flush", mpp->alias); - return 1; + if (r == 1) @@ -664,48 +664,48 @@ Index: multipath-tools-130222/multipathd/main.c + mpp->deferred_remove = DEFERRED_REMOVE_IN_PROGRESS; + } + return r; - } - else { - dm_lib_release(); + } + else { + dm_lib_release(); @@ -372,7 +383,7 @@ ev_remove_map (char * devname, char * al - mpp->alias, mpp->dmi->minor, minor); - return 0; - } + mpp->alias, mpp->dmi->minor, minor); + return 0; + } - return flush_map(mpp, vecs); + return flush_map(mpp, vecs, 0); } - + static int @@ -628,7 +639,7 @@ ev_remove_path (struct path *pp, struct - mpp->flush_on_last_del = FLUSH_IN_PROGRESS; - dm_queue_if_no_path(mpp->alias, 0); - } + mpp->flush_on_last_del = FLUSH_IN_PROGRESS; + dm_queue_if_no_path(mpp->alias, 0); + } - if (!flush_map(mpp, vecs)) { + if (!flush_map(mpp, vecs, 1)) { - condlog(2, "%s: removed map after" - " removing all paths", - alias); + condlog(2, "%s: removed map after" + " removing all paths", + alias); Index: multipath-tools-130222/libmultipath/structs_vec.c =================================================================== --- multipath-tools-130222.orig/libmultipath/structs_vec.c +++ multipath-tools-130222/libmultipath/structs_vec.c @@ -392,6 +392,8 @@ __setup_multipath (struct vectors * vecs - set_no_path_retry(mpp); - select_pg_timeout(mpp); - select_flush_on_last_del(mpp); + set_no_path_retry(mpp); + select_pg_timeout(mpp); + select_flush_on_last_del(mpp); + if (VECTOR_SIZE(mpp->paths) != 0) + dm_cancel_deferred_remove(mpp); - } - - return 0; + } + + return 0; @@ -565,7 +567,6 @@ int update_multipath (struct vectors *ve - } - } - } + } + } + } - - return 0; + return 0; } - + Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.conf.5 @@ -750,14 +750,15 @@ Index: multipath-tools-130222/libmultipath/Makefile --- multipath-tools-130222.orig/libmultipath/Makefile +++ multipath-tools-130222/libmultipath/Makefile @@ -36,6 +36,12 @@ ifneq ($(strip $(LIBUDEV_API_RECVBUF)),0 - CFLAGS += -DLIBUDEV_API_RECVBUF + CFLAGS += -DLIBUDEV_API_RECVBUF endif - + +LIBDM_API_DEFERRED = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_deferred_remove' /usr/include/libdevmapper.h) + +ifneq ($(strip $(LIBDM_API_DEFERRED)),0) + CFLAGS += -DLIBDM_API_DEFERRED +endif + - + all: $(LIBS) + diff --git a/SOURCES/0104-RHBZ-1159337-fix-double-free.patch b/SOURCES/0104-RHBZ-1159337-fix-double-free.patch index e71213cb..cbe4d1e7 100644 --- a/SOURCES/0104-RHBZ-1159337-fix-double-free.patch +++ b/SOURCES/0104-RHBZ-1159337-fix-double-free.patch @@ -7,14 +7,14 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -669,9 +669,8 @@ ev_remove_path (struct path *pp, struct - /* - * update our state from kernel - */ + /* + * update our state from kernel + */ - if (setup_multipath(vecs, mpp)) { - goto fail; - } + if (setup_multipath(vecs, mpp)) + return 1; - sync_map_state(mpp); - - condlog(2, "%s [%s]: path removed from map %s", + sync_map_state(mpp); + + condlog(2, "%s [%s]: path removed from map %s", diff --git a/SOURCES/0106-RHBZ-1169935-no-new-devs.patch b/SOURCES/0106-RHBZ-1169935-no-new-devs.patch index 807381e2..99ae35a7 100644 --- a/SOURCES/0106-RHBZ-1169935-no-new-devs.patch +++ b/SOURCES/0106-RHBZ-1169935-no-new-devs.patch @@ -14,29 +14,29 @@ Index: multipath-tools-130222/libmultipath/config.h --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -131,6 +131,7 @@ struct config { - int detect_prio; - int force_sync; - int deferred_remove; + int detect_prio; + int force_sync; + int deferred_remove; + int ignore_new_boot_devs; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/libmultipath/configure.c =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -775,9 +775,8 @@ coalesce_paths (struct vectors * vecs, v - if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE)) - continue; - + if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE)) + continue; + - /* If find_multipaths was selected check if the path is valid */ - if (conf->find_multipaths && !refwwid && - !should_multipath(pp1, pathvec)) { + /* check if the path is valid */ + if (!refwwid && !should_multipath(pp1, pathvec)) { - orphan_path(pp1); - continue; - } + orphan_path(pp1); + continue; + } Index: multipath-tools-130222/libmultipath/wwids.c =================================================================== --- multipath-tools-130222.orig/libmultipath/wwids.c @@ -46,19 +46,19 @@ Index: multipath-tools-130222/libmultipath/wwids.c #include "defaults.h" #include "config.h" +#include "util.h" - + /* * Copyright (c) 2010 Benjamin Marzinski, Redhat @@ -268,15 +269,21 @@ should_multipath(struct path *pp1, vecto { - int i; - struct path *pp2; + int i; + struct path *pp2; + int ignore_new_devs = (conf->ignore_new_boot_devs && in_initrd()); + + if (!conf->find_multipaths && !ignore_new_devs) + return 1; - - condlog(4, "checking if %s should be multipathed", pp1->dev); + + condlog(4, "checking if %s should be multipathed", pp1->dev); - vector_foreach_slot(pathvec, pp2, i) { - if (pp1->dev == pp2->dev) - continue; @@ -75,53 +75,53 @@ Index: multipath-tools-130222/libmultipath/wwids.c + "multipathing %s", pp1->wwid, pp1->dev); + return 1; + } - } - } - if (check_wwids_file(pp1->wwid, 0) < 0) { + } + } + if (check_wwids_file(pp1->wwid, 0) < 0) { Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -503,8 +503,7 @@ rescan: - return 1; - } - + return 1; + } + - if (conf->find_multipaths && - !should_multipath(pp, vecs->pathvec)) { + if (!should_multipath(pp, vecs->pathvec)) { - orphan_path(pp); - return 0; - } + orphan_path(pp); + return 0; + } Index: multipath-tools-130222/libmultipath/config.c =================================================================== --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -622,6 +622,7 @@ load_config (char * file, struct udev *u - conf->deferred_remove = DEFAULT_DEFERRED_REMOVE; - conf->hw_strmatch = 0; - conf->force_sync = 0; + conf->deferred_remove = DEFAULT_DEFERRED_REMOVE; + conf->hw_strmatch = 0; + conf->force_sync = 0; + conf->ignore_new_boot_devs = 0; - - /* - * preload default hwtable + + /* + * preload default hwtable @@ -732,6 +733,9 @@ load_config (char * file, struct udev *u - !conf->wwids_file) - goto out; - + !conf->wwids_file) + goto out; + + if (conf->ignore_new_boot_devs) + in_initrd(); + - return 0; + return 0; out: - free_config(conf); + free_config(conf); Index: multipath-tools-130222/libmultipath/dict.c =================================================================== --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -761,6 +761,29 @@ def_deferred_remove_handler(vector strve - return 0; + return 0; } - + +static int +def_ignore_new_boot_devs_handler(vector strvec) +{ @@ -150,7 +150,7 @@ Index: multipath-tools-130222/libmultipath/dict.c */ @@ -3011,6 +3034,15 @@ snprint_def_deferred_remove(char * buff, } - + static int +snprint_def_ignore_new_boot_devs(char * buff, int len, void * data) +{ @@ -163,15 +163,15 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_ble_simple (char * buff, int len, void * data) { - struct blentry * ble = (struct blentry *)data; + struct blentry * ble = (struct blentry *)data; @@ -3080,6 +3112,7 @@ init_keywords(void) - install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch); - install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync); - install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove); + install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch); + install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync); + install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove); + install_keyword("ignore_new_boot_devs", &def_ignore_new_boot_devs_handler, &snprint_def_ignore_new_boot_devs); - __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); + __deprecated install_keyword("default_selector", &def_selector_handler, NULL); + __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); + __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); Index: multipath-tools-130222/libmultipath/util.c =================================================================== --- multipath-tools-130222.orig/libmultipath/util.c @@ -182,12 +182,12 @@ Index: multipath-tools-130222/libmultipath/util.c #include +#include +#include - + #include "debug.h" #include "memory.h" @@ -267,3 +269,31 @@ dev_t parse_devt(const char *dev_t) - - return makedev(maj, min); + + return makedev(maj, min); } + +/* This define was taken from systemd. src/shared/macro.h */ @@ -226,6 +226,6 @@ Index: multipath-tools-130222/libmultipath/util.h dev_t parse_devt(const char *dev_t); char *convert_dev(char *dev, int is_path_device); +int in_initrd(void); - + #define safe_sprintf(var, format, args...) \ - snprintf(var, sizeof(var), format, ##args) >= sizeof(var) + snprintf(var, sizeof(var), format, ##args) >= sizeof(var) diff --git a/SOURCES/0107-RH-adapter-name-wildcard.patch b/SOURCES/0107-RH-adapter-name-wildcard.patch index f3a39de1..3c67de5b 100644 --- a/SOURCES/0107-RH-adapter-name-wildcard.patch +++ b/SOURCES/0107-RH-adapter-name-wildcard.patch @@ -8,7 +8,7 @@ Index: multipath-tools-130222/libmultipath/print.c +++ multipath-tools-130222/libmultipath/print.c @@ -510,6 +510,16 @@ snprint_tgt_wwnn (char * buff, size_t le } - + static int +snprint_host_adapter (char * buff, size_t len, struct path * pp) +{ @@ -22,11 +22,12 @@ Index: multipath-tools-130222/libmultipath/print.c +static int snprint_path_checker (char * buff, size_t len, struct path * pp) { - struct checker * c = &pp->checker; + struct checker * c = &pp->checker; @@ -557,6 +567,7 @@ struct path_data pd[] = { - {'n', "target WWNN", 0, snprint_tgt_wwnn}, - {'R', "host WWPN", 0, snprint_host_wwpn}, - {'r', "target WWPN", 0, snprint_tgt_wwpn}, + {'n', "target WWNN", 0, snprint_tgt_wwnn}, + {'R', "host WWPN", 0, snprint_host_wwpn}, + {'r', "target WWPN", 0, snprint_tgt_wwpn}, + {'a', "host adapter", 0, snprint_host_adapter}, - {0, NULL, 0 , NULL} + {0, NULL, 0 , NULL} }; + diff --git a/SOURCES/0109-RH-read-only-bindings.patch b/SOURCES/0109-RH-read-only-bindings.patch index f4d21125..c08120fb 100644 --- a/SOURCES/0109-RH-read-only-bindings.patch +++ b/SOURCES/0109-RH-read-only-bindings.patch @@ -7,21 +7,21 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -1879,7 +1879,7 @@ main (int argc, char *argv[]) - if (!conf) - exit(1); - + if (!conf) + exit(1); + - while ((arg = getopt(argc, argv, ":dv:k::")) != EOF ) { + while ((arg = getopt(argc, argv, ":dv:k::B")) != EOF ) { - switch(arg) { - case 'd': - logsink = 0; + switch(arg) { + case 'd': + logsink = 0; @@ -1895,6 +1895,9 @@ main (int argc, char *argv[]) - case 'k': - uxclnt(optarg); - exit(0); + case 'k': + uxclnt(optarg); + exit(0); + case 'B': + conf->bindings_read_only = 1; + break; - default: - ; - } + default: + ; + } diff --git a/SOURCES/0110-RHBZ-blacklist-vd-devs.patch b/SOURCES/0110-RHBZ-blacklist-vd-devs.patch index 06bd93e1..af52d0de 100644 --- a/SOURCES/0110-RHBZ-blacklist-vd-devs.patch +++ b/SOURCES/0110-RHBZ-blacklist-vd-devs.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/libmultipath/blacklist.c --- multipath-tools-130222.orig/libmultipath/blacklist.c +++ multipath-tools-130222/libmultipath/blacklist.c @@ -169,7 +169,7 @@ setup_default_blist (struct config * con - if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT)) - return 1; - + if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT)) + return 1; + - str = STRDUP("^(td|hd)[a-z]"); + str = STRDUP("^(td|hd|vd)[a-z]"); - if (!str) - return 1; - if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT)) + if (!str) + return 1; + if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT)) diff --git a/SOURCES/0111-RH-dont-show-pg-timeout.patch b/SOURCES/0111-RH-dont-show-pg-timeout.patch index 59817931..f545cc5a 100644 --- a/SOURCES/0111-RH-dont-show-pg-timeout.patch +++ b/SOURCES/0111-RH-dont-show-pg-timeout.patch @@ -30,9 +30,9 @@ Index: multipath-tools-130222/libmultipath/dict.c - conf->pg_timeout = PGTIMEOUT_UNDEF; - - FREE(buff); - return 0; + return 0; } - + @@ -1358,30 +1338,6 @@ hw_minio_rq_handler(vector strvec) static int hw_pg_timeout_handler(vector strvec) @@ -61,9 +61,9 @@ Index: multipath-tools-130222/libmultipath/dict.c - hwe->pg_timeout = PGTIMEOUT_UNDEF; - - FREE(buff); - return 0; + return 0; } - + @@ -1819,29 +1775,6 @@ mp_minio_rq_handler(vector strvec) static int mp_pg_timeout_handler(vector strvec) @@ -91,9 +91,9 @@ Index: multipath-tools-130222/libmultipath/dict.c - mpe->pg_timeout = PGTIMEOUT_UNDEF; - - FREE(buff); - return 0; + return 0; } - + @@ -2180,16 +2113,6 @@ snprint_mp_rr_min_io_rq (char * buff, in static int snprint_mp_pg_timeout (char * buff, int len, void * data) @@ -108,9 +108,9 @@ Index: multipath-tools-130222/libmultipath/dict.c - default: - return snprintf(buff, len, "%i", mpe->pg_timeout); - } - return 0; + return 0; } - + @@ -2551,19 +2474,6 @@ snprint_hw_rr_min_io_rq (char * buff, in static int snprint_hw_pg_timeout (char * buff, int len, void * data) @@ -128,9 +128,9 @@ Index: multipath-tools-130222/libmultipath/dict.c - default: - return snprintf(buff, len, "%i", hwe->pg_timeout); - } - return 0; + return 0; } - + @@ -2895,13 +2805,6 @@ snprint_def_checker_timeout (char *buff, static int snprint_def_pg_timeout (char * buff, int len, void * data) @@ -142,5 +142,6 @@ Index: multipath-tools-130222/libmultipath/dict.c - default: - return snprintf(buff, len, "%i", conf->pg_timeout); - } - return 0; + return 0; } + diff --git a/SOURCES/0112-RHBZ-1194917-add-config_dir-option.patch b/SOURCES/0112-RHBZ-1194917-add-config_dir-option.patch index f1356fa8..6cc07e76 100644 --- a/SOURCES/0112-RHBZ-1194917-add-config_dir-option.patch +++ b/SOURCES/0112-RHBZ-1194917-add-config_dir-option.patch @@ -1,12 +1,12 @@ --- libmultipath/config.c | 56 +++++++++++++++++++++++++++++++- libmultipath/config.h | 2 + - libmultipath/defaults.h | 1 + libmultipath/defaults.h | 1 libmultipath/dict.c | 69 +++++++++++++++++++++++++++++++++++---- libmultipath/parser.c | 78 +++++++++++++++++++++++---------------------- libmultipath/parser.h | 3 - multipath.conf.annotated | 10 +++++ - multipath.conf.defaults | 1 + multipath.conf.defaults | 1 multipath/multipath.conf.5 | 7 ++++ 9 files changed, 179 insertions(+), 48 deletions(-) @@ -16,187 +16,187 @@ Index: multipath-tools-130222/libmultipath/parser.c +++ multipath-tools-130222/libmultipath/parser.c @@ -18,6 +18,7 @@ */ - + #include +#include - + #include "parser.h" #include "memory.h" @@ -453,14 +454,15 @@ set_value(vector strvec) /* non-recursive configuration stream handler */ static int kw_level = 0; - + -int warn_on_duplicates(vector uniques, char *str) +int warn_on_duplicates(vector uniques, char *str, char *file) { - char *tmp; - int i; - - vector_foreach_slot(uniques, tmp, i) { - if (!strcmp(str, tmp)) { + char *tmp; + int i; + + vector_foreach_slot(uniques, tmp, i) { + if (!strcmp(str, tmp)) { - condlog(1, "multipath.conf line %d, duplicate keyword: %s", line_nr, str); + condlog(1, "%s line %d, duplicate keyword: %s", + file, line_nr, str); - return 0; - } - } + return 0; + } + } @@ -496,65 +498,70 @@ is_sublevel_keyword(char *str) } - + int -validate_config_strvec(vector strvec) +validate_config_strvec(vector strvec, char *file) { - char *str; - int i; - - str = VECTOR_SLOT(strvec, 0); - if (str == NULL) { + char *str; + int i; + + str = VECTOR_SLOT(strvec, 0); + if (str == NULL) { - condlog(0, "can't parse option on line %d of config file", - line_nr); + condlog(0, "can't parse option on line %d of %s", + line_nr, file); - return -1; - } - if (*str == '}') { - if (VECTOR_SIZE(strvec) > 1) + return -1; + } + if (*str == '}') { + if (VECTOR_SIZE(strvec) > 1) - condlog(0, "ignoring extra data starting with '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, 1), line_nr); + condlog(0, "ignoring extra data starting with '%s' on line %d of %s", (char *)VECTOR_SLOT(strvec, 1), line_nr, file); - return 0; - } - if (*str == '{') { + return 0; + } + if (*str == '{') { - condlog(0, "invalid keyword '%s' on line %d of config file", str, line_nr); + condlog(0, "invalid keyword '%s' on line %d of %s", + str, line_nr, file); - return -1; - } - if (is_sublevel_keyword(str)) { - str = VECTOR_SLOT(strvec, 1); - if (str == NULL) + return -1; + } + if (is_sublevel_keyword(str)) { + str = VECTOR_SLOT(strvec, 1); + if (str == NULL) - condlog(0, "missing '{' on line %d of config file", line_nr); + condlog(0, "missing '{' on line %d of %s", + line_nr, file); - else if (*str != '{') + else if (*str != '{') - condlog(0, "expecting '{' on line %d of config file. found '%s'", line_nr, str); + condlog(0, "expecting '{' on line %d of %s. found '%s'", + line_nr, file, str); - else if (VECTOR_SIZE(strvec) > 2) + else if (VECTOR_SIZE(strvec) > 2) - condlog(0, "ignoring extra data starting with '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, 2), line_nr); + condlog(0, "ignoring extra data starting with '%s' on line %d of %s", (char *)VECTOR_SLOT(strvec, 2), line_nr, file); - return 0; - } - str = VECTOR_SLOT(strvec, 1); - if (str == NULL) { + return 0; + } + str = VECTOR_SLOT(strvec, 1); + if (str == NULL) { - condlog(0, "missing value for option '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, 0), line_nr); + condlog(0, "missing value for option '%s' on line %d of %s", + (char *)VECTOR_SLOT(strvec, 0), line_nr, file); - return -1; - } - if (*str != '"') { - if (VECTOR_SIZE(strvec) > 2) + return -1; + } + if (*str != '"') { + if (VECTOR_SIZE(strvec) > 2) - condlog(0, "ignoring extra data starting with '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, 2), line_nr); + condlog(0, "ignoring extra data starting with '%s' on line %d of %s", (char *)VECTOR_SLOT(strvec, 2), line_nr, file); - return 0; - } - for (i = 2; i < VECTOR_SIZE(strvec); i++) { - str = VECTOR_SLOT(strvec, i); - if (str == NULL) { + return 0; + } + for (i = 2; i < VECTOR_SIZE(strvec); i++) { + str = VECTOR_SLOT(strvec, i); + if (str == NULL) { - condlog(0, "can't parse value on line %d of config file", line_nr); + condlog(0, "can't parse value on line %d of %s", + line_nr, file); - return -1; - } - if (*str == '"') { - if (VECTOR_SIZE(strvec) > i + 1) + return -1; + } + if (*str == '"') { + if (VECTOR_SIZE(strvec) > i + 1) - condlog(0, "ignoring extra data starting with '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, (i + 1)), line_nr); + condlog(0, "ignoring extra data starting with '%s' on line %d of %s", (char *)VECTOR_SLOT(strvec, (i + 1)), line_nr, file); - return 0; - } - } + return 0; + } + } - condlog(0, "missing closing quotes on line %d of config file", - line_nr); + condlog(0, "missing closing quotes on line %d of %s", + line_nr, file); - return 0; + return 0; } - + -int -process_stream(vector keywords) +static int +process_stream(vector keywords, char *file) { - int i; - int r = 0; + int i; + int r = 0; @@ -583,7 +590,7 @@ process_stream(vector keywords) - if (!strvec) - continue; - + if (!strvec) + continue; + - if (validate_config_strvec(strvec) != 0) { + if (validate_config_strvec(strvec, file) != 0) { - free_strvec(strvec); - continue; - } + free_strvec(strvec); + continue; + } @@ -595,8 +602,8 @@ process_stream(vector keywords) - free_strvec(strvec); - break; - } + free_strvec(strvec); + break; + } - condlog(0, "unmatched '%s' at line %d of config file", - EOB, line_nr); + condlog(0, "unmatched '%s' at line %d of %s", + EOB, line_nr, file); - } - - for (i = 0; i < VECTOR_SIZE(keywords); i++) { + } + + for (i = 0; i < VECTOR_SIZE(keywords); i++) { @@ -604,7 +611,7 @@ process_stream(vector keywords) - - if (!strcmp(keyword->string, str)) { - if (keyword->unique && + + if (!strcmp(keyword->string, str)) { + if (keyword->unique && - warn_on_duplicates(uniques, str)) { + warn_on_duplicates(uniques, str, file)) { - r = 1; - free_strvec(strvec); - goto out; + r = 1; + free_strvec(strvec); + goto out; @@ -614,15 +621,15 @@ process_stream(vector keywords) - - if (keyword->sub) { - kw_level++; + + if (keyword->sub) { + kw_level++; - r += process_stream(keyword->sub); + r += process_stream(keyword->sub, file); - kw_level--; - } - break; - } - } - if (i >= VECTOR_SIZE(keywords)) + kw_level--; + } + break; + } + } + if (i >= VECTOR_SIZE(keywords)) - condlog(1, "multipath.conf +%d, invalid keyword: %s", - line_nr, str); + condlog(1, "%s line %d, invalid keyword: %s", + file, line_nr, str); - - free_strvec(strvec); - } + + free_strvec(strvec); + } @@ -646,27 +653,24 @@ int alloc_keywords(void) - + /* Data initialization */ int -init_data(char *conf_file, void (*init_keywords) (void)) +process_file(char *file) { - int r; - + int r; + - stream = fopen(conf_file, "r"); + if (!keywords) { + condlog(0, "No keywords alocated"); + return 1; + } + stream = fopen(file, "r"); - if (!stream) { + if (!stream) { - syslog(LOG_WARNING, "Configuration file open problem"); + condlog(0, "couldn't open configuration file '%s': %s", + file, strerror(errno)); - return 1; - } - + return 1; + } + - /* Init Keywords structure */ - (*init_keywords) (); - @@ -205,13 +205,13 @@ Index: multipath-tools-130222/libmultipath/parser.c - dump_keywords(keywords, 0); -*/ - - /* Stream handling */ - line_nr = 0; + /* Stream handling */ + line_nr = 0; - r = process_stream(keywords); + r = process_stream(keywords, file); - fclose(stream); - //free_keywords(keywords); - + fclose(stream); + //free_keywords(keywords); + Index: multipath-tools-130222/libmultipath/dict.c =================================================================== --- multipath-tools-130222.orig/libmultipath/dict.c @@ -222,76 +222,76 @@ Index: multipath-tools-130222/libmultipath/dict.c { + if (conf->multipath_dir) + FREE(conf->multipath_dir); - conf->multipath_dir = set_value(strvec); - - if (!conf->multipath_dir) + conf->multipath_dir = set_value(strvec); + + if (!conf->multipath_dir) @@ -128,6 +130,8 @@ multipath_dir_handler(vector strvec) static int def_selector_handler(vector strvec) { + if (conf->selector) + FREE(conf->selector); - conf->selector = set_value(strvec); - - if (!conf->selector) + conf->selector = set_value(strvec); + + if (!conf->selector) @@ -155,6 +159,8 @@ def_pgpolicy_handler(vector strvec) static int def_uid_attribute_handler(vector strvec) { + if (conf->uid_attribute) + FREE(conf->uid_attribute); - conf->uid_attribute = set_value(strvec); - - if (!conf->uid_attribute) + conf->uid_attribute = set_value(strvec); + + if (!conf->uid_attribute) @@ -166,6 +172,8 @@ def_uid_attribute_handler(vector strvec) static int def_prio_handler(vector strvec) { + if (conf->prio_name) + FREE(conf->prio_name); - conf->prio_name = set_value(strvec); - - if (!conf->prio_name) + conf->prio_name = set_value(strvec); + + if (!conf->prio_name) @@ -177,6 +185,8 @@ def_prio_handler(vector strvec) static int def_alias_prefix_handler(vector strvec) { + if (conf->alias_prefix) + FREE(conf->alias_prefix); - conf->alias_prefix = set_value(strvec); - - if (!conf->alias_prefix) + conf->alias_prefix = set_value(strvec); + + if (!conf->alias_prefix) @@ -188,6 +198,8 @@ def_alias_prefix_handler(vector strvec) static int def_prio_args_handler(vector strvec) { + if (conf->prio_args) + FREE(conf->prio_args); - conf->prio_args = set_value(strvec); - - if (!conf->prio_args) + conf->prio_args = set_value(strvec); + + if (!conf->prio_args) @@ -199,6 +211,8 @@ def_prio_args_handler(vector strvec) static int def_features_handler(vector strvec) { + if (conf->features) + FREE(conf->features); - conf->features = set_value(strvec); - - if (!conf->features) + conf->features = set_value(strvec); + + if (!conf->features) @@ -210,6 +224,8 @@ def_features_handler(vector strvec) static int def_path_checker_handler(vector strvec) { + if (conf->checker_name) + FREE(conf->checker_name); - conf->checker_name = set_value(strvec); - - if (!conf->checker_name) + conf->checker_name = set_value(strvec); + + if (!conf->checker_name) @@ -432,6 +448,23 @@ def_no_path_retry_handler(vector strvec) - return 0; + return 0; } - + + +static int +def_config_dir_handler(vector strvec) @@ -318,18 +318,18 @@ Index: multipath-tools-130222/libmultipath/dict.c { + if (conf->bindings_file) + FREE(conf->bindings_file); - conf->bindings_file = set_value(strvec); - - if (!conf->bindings_file) + conf->bindings_file = set_value(strvec); + + if (!conf->bindings_file) @@ -622,6 +657,8 @@ bindings_file_handler(vector strvec) static int wwids_file_handler(vector strvec) { + if (conf->wwids_file) + FREE(conf->wwids_file); - conf->wwids_file = set_value(strvec); - - if (!conf->wwids_file) + conf->wwids_file = set_value(strvec); + + if (!conf->wwids_file) @@ -770,9 +807,12 @@ def_ignore_new_boot_devs_handler(vector static int blacklist_handler(vector strvec) @@ -343,9 +343,9 @@ Index: multipath-tools-130222/libmultipath/dict.c + conf->blist_wwid = vector_alloc(); + if (!conf->blist_device) + conf->blist_device = vector_alloc(); - - if (!conf->blist_devnode || !conf->blist_wwid || !conf->blist_device) - return 1; + + if (!conf->blist_devnode || !conf->blist_wwid || !conf->blist_device) + return 1; @@ -783,9 +823,12 @@ blacklist_handler(vector strvec) static int blacklist_exceptions_handler(vector strvec) @@ -359,9 +359,9 @@ Index: multipath-tools-130222/libmultipath/dict.c + conf->elist_wwid = vector_alloc(); + if (!conf->elist_device) + conf->elist_device = vector_alloc(); - - if (!conf->elist_devnode || !conf->elist_wwid || !conf->elist_device) - return 1; + + if (!conf->elist_devnode || !conf->elist_wwid || !conf->elist_device) + return 1; @@ -1480,7 +1523,8 @@ hw_deferred_remove_handler(vector strvec static int multipaths_handler(vector strvec) @@ -369,13 +369,13 @@ Index: multipath-tools-130222/libmultipath/dict.c - conf->mptable = vector_alloc(); + if (!conf->mptable) + conf->mptable = vector_alloc(); - - if (!conf->mptable) - return 1; + + if (!conf->mptable) + return 1; @@ -2945,6 +2989,16 @@ snprint_def_ignore_new_boot_devs(char * - return snprintf(buff, len, "no"); + return snprintf(buff, len, "no"); } - + + +static int +snprint_def_config_dir (char * buff, int len, void * data) @@ -390,13 +390,13 @@ Index: multipath-tools-130222/libmultipath/dict.c snprint_ble_simple (char * buff, int len, void * data) { @@ -3016,6 +3070,7 @@ init_keywords(void) - install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync); - install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove); - install_keyword("ignore_new_boot_devs", &def_ignore_new_boot_devs_handler, &snprint_def_ignore_new_boot_devs); + install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync); + install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove); + install_keyword("ignore_new_boot_devs", &def_ignore_new_boot_devs_handler, &snprint_def_ignore_new_boot_devs); + install_keyword("config_dir", &def_config_dir_handler, &snprint_def_config_dir); - __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); + __deprecated install_keyword("default_selector", &def_selector_handler, NULL); + __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); + __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); Index: multipath-tools-130222/libmultipath/parser.h =================================================================== --- multipath-tools-130222.orig/libmultipath/parser.h @@ -423,32 +423,32 @@ Index: multipath-tools-130222/libmultipath/config.c +#include +#include +#include - + #include "checkers.h" #include "memory.h" @@ -556,6 +559,7 @@ free_config (struct config * conf) - - if (conf->wwids_file) - FREE(conf->wwids_file); + + if (conf->wwids_file) + FREE(conf->wwids_file); + - if (conf->prio_name) - FREE(conf->prio_name); - + if (conf->prio_name) + FREE(conf->prio_name); + @@ -567,6 +571,10 @@ free_config (struct config * conf) - - if (conf->checker_name) - FREE(conf->checker_name); + + if (conf->checker_name) + FREE(conf->checker_name); + + if (conf->config_dir) + FREE(conf->config_dir); + - if (conf->reservation_key) - FREE(conf->reservation_key); - + if (conf->reservation_key) + FREE(conf->reservation_key); + @@ -584,6 +592,43 @@ free_config (struct config * conf) - FREE(conf); + FREE(conf); } - + +/* if multipath fails to process the config directory, it should continue, + * with just a warning message */ +static void @@ -490,68 +490,68 @@ Index: multipath-tools-130222/libmultipath/config.c load_config (char * file, struct udev *udev) { @@ -623,6 +668,7 @@ load_config (char * file, struct udev *u - conf->hw_strmatch = 0; - conf->force_sync = 0; - conf->ignore_new_boot_devs = 0; + conf->hw_strmatch = 0; + conf->force_sync = 0; + conf->ignore_new_boot_devs = 0; + conf->processed_main_config = 0; - - /* - * preload default hwtable + + /* + * preload default hwtable @@ -641,11 +687,12 @@ load_config (char * file, struct udev *u - */ - set_current_keywords(&conf->keywords); - alloc_keywords(); + */ + set_current_keywords(&conf->keywords); + alloc_keywords(); + init_keywords(); - if (filepresent(file)) { - int builtin_hwtable_size; - - builtin_hwtable_size = VECTOR_SIZE(conf->hwtable); + if (filepresent(file)) { + int builtin_hwtable_size; + + builtin_hwtable_size = VECTOR_SIZE(conf->hwtable); - if (init_data(file, init_keywords)) { + if (process_file(file)) { - condlog(0, "error parsing config file"); - goto out; - } + condlog(0, "error parsing config file"); + goto out; + } @@ -658,7 +705,6 @@ load_config (char * file, struct udev *u - } - - } else { + } + + } else { - init_keywords(); - condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices."); - condlog(0, "A default multipath.conf file is located at"); - condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE)); + 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)); @@ -677,6 +723,12 @@ load_config (char * file, struct udev *u - } - } - + } + } + + conf->processed_main_config = 1; + if (conf->config_dir == NULL) + conf->config_dir = set_default(DEFAULT_CONFIG_DIR); + if (conf->config_dir && conf->config_dir[0] != '\0') + process_config_dir(conf->keywords, conf->config_dir); + - /* - * fill the voids left in the config file - */ + /* + * fill the voids left in the config file + */ Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -132,6 +132,7 @@ struct config { - int force_sync; - int deferred_remove; - int ignore_new_boot_devs; + int force_sync; + int deferred_remove; + int ignore_new_boot_devs; + int processed_main_config; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; @@ -147,6 +148,7 @@ struct config { - char * prio_args; - char * checker_name; - char * alias_prefix; + char * prio_args; + char * checker_name; + char * alias_prefix; + char * config_dir; - unsigned char * reservation_key; - - vector keywords; + unsigned char * reservation_key; + + vector keywords; Index: multipath-tools-130222/libmultipath/defaults.h =================================================================== --- multipath-tools-130222.orig/libmultipath/defaults.h @@ -561,7 +561,7 @@ Index: multipath-tools-130222/libmultipath/defaults.h #define DEFAULT_BINDINGS_FILE "/etc/multipath/bindings" #define DEFAULT_WWIDS_FILE "/etc/multipath/wwids" +#define DEFAULT_CONFIG_DIR "/etc/multipath/conf.d" - + char * set_default (char * str); Index: multipath-tools-130222/multipath.conf.annotated =================================================================== @@ -582,7 +582,7 @@ Index: multipath-tools-130222/multipath.conf.annotated +# # values : "" or a fully qualified pathname +# # default : "/etc/multipath/conf.d" #} - # + # ## Index: multipath-tools-130222/multipath.conf.defaults =================================================================== diff --git a/SOURCES/0113-RHBZ-1194917-cleanup.patch b/SOURCES/0113-RHBZ-1194917-cleanup.patch index 7445f95d..cf95c984 100644 --- a/SOURCES/0113-RHBZ-1194917-cleanup.patch +++ b/SOURCES/0113-RHBZ-1194917-cleanup.patch @@ -8,20 +8,20 @@ Index: multipath-tools-130222/libmultipath/parser.c --- multipath-tools-130222.orig/libmultipath/parser.c +++ multipath-tools-130222/libmultipath/parser.c @@ -280,8 +280,8 @@ out: - return NULL; + return NULL; } - + -int -read_line(char *buf, int size) +static int +read_line(FILE *stream, char *buf, int size) { - int ch; - int count = 0; + int ch; + int count = 0; @@ -297,95 +297,6 @@ read_line(char *buf, int size) - return (ch == EOF) ? 0 : 1; + return (ch == EOF) ? 0 : 1; } - + -vector -read_value_block(void) -{ @@ -116,57 +116,57 @@ Index: multipath-tools-130222/libmultipath/parser.c { @@ -561,7 +472,7 @@ validate_config_strvec(vector strvec, ch } - + static int -process_stream(vector keywords, char *file) +process_stream(FILE *stream, vector keywords, char *file) { - int i; - int r = 0; + int i; + int r = 0; @@ -582,7 +493,7 @@ process_stream(vector keywords, char *fi - return 1; - } - + return 1; + } + - while (read_line(buf, MAXBUF)) { + while (read_line(stream, buf, MAXBUF)) { - line_nr++; - strvec = alloc_strvec(buf); - memset(buf,0, MAXBUF); + line_nr++; + strvec = alloc_strvec(buf); + memset(buf,0, MAXBUF); @@ -621,7 +532,8 @@ process_stream(vector keywords, char *fi - - if (keyword->sub) { - kw_level++; + + if (keyword->sub) { + kw_level++; - r += process_stream(keyword->sub, file); + r += process_stream(stream, + keyword->sub, file); - kw_level--; - } - break; + kw_level--; + } + break; @@ -656,6 +568,7 @@ int process_file(char *file) { - int r; + int r; + FILE *stream; - - if (!keywords) { - condlog(0, "No keywords alocated"); + + if (!keywords) { + condlog(0, "No keywords alocated"); @@ -670,7 +583,7 @@ process_file(char *file) - - /* Stream handling */ - line_nr = 0; + + /* Stream handling */ + line_nr = 0; - r = process_stream(keywords, file); + r = process_stream(stream, keywords, file); - fclose(stream); - //free_keywords(keywords); - + fclose(stream); + //free_keywords(keywords); + Index: multipath-tools-130222/libmultipath/parser.h =================================================================== --- multipath-tools-130222.orig/libmultipath/parser.h +++ multipath-tools-130222/libmultipath/parser.h @@ -47,9 +47,6 @@ struct keyword { - int unique; + int unique; }; - + -/* global var exported */ -FILE *stream; - diff --git a/SOURCES/0114-RHBZ-1196394-delayed-reintegration.patch b/SOURCES/0114-RHBZ-1196394-delayed-reintegration.patch index 3556b6fd..b0647a52 100644 --- a/SOURCES/0114-RHBZ-1196394-delayed-reintegration.patch +++ b/SOURCES/0114-RHBZ-1196394-delayed-reintegration.patch @@ -1,17 +1,17 @@ --- - libmultipath/checkers.c | 3 + libmultipath/checkers.c | 3 libmultipath/checkers.h | 9 + - libmultipath/config.c | 4 + libmultipath/config.c | 4 libmultipath/config.h | 6 + - libmultipath/configure.c | 2 - libmultipath/defaults.h | 1 + libmultipath/configure.c | 2 + libmultipath/defaults.h | 1 libmultipath/dict.c | 204 ++++++++++++++++++++++++++++++++++++++++++++- - libmultipath/print.c | 2 + libmultipath/print.c | 2 libmultipath/propsel.c | 52 +++++++++++ - libmultipath/propsel.h | 2 + libmultipath/propsel.h | 2 libmultipath/structs.h | 9 + multipath.conf.annotated | 40 ++++++++ - multipath.conf.defaults | 2 + multipath.conf.defaults | 2 multipath/multipath.conf.5 | 27 +++++ multipathd/main.c | 34 ++++++- 15 files changed, 388 insertions(+), 9 deletions(-) @@ -21,66 +21,66 @@ Index: multipath-tools-130222/libmultipath/config.h --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -62,6 +62,8 @@ struct hwentry { - int retain_hwhandler; - int detect_prio; - int deferred_remove; + int retain_hwhandler; + int detect_prio; + int deferred_remove; + int delay_watch_checks; + int delay_wait_checks; - char * bl_product; + char * bl_product; }; - + @@ -86,6 +88,8 @@ struct mpentry { - int attribute_flags; - int user_friendly_names; - int deferred_remove; + int attribute_flags; + int user_friendly_names; + int deferred_remove; + int delay_watch_checks; + int delay_wait_checks; - uid_t uid; - gid_t gid; - mode_t mode; + uid_t uid; + gid_t gid; + mode_t mode; @@ -133,6 +137,8 @@ struct config { - int deferred_remove; - int ignore_new_boot_devs; - int processed_main_config; + int deferred_remove; + int ignore_new_boot_devs; + int processed_main_config; + int delay_watch_checks; + int delay_wait_checks; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/libmultipath/structs.h =================================================================== --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -134,6 +134,11 @@ enum scsi_protocol { - SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */ + SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */ }; - + +enum delay_checks_states { + DELAY_CHECKS_OFF = -1, + DELAY_CHECKS_UNDEF = 0, +}; + struct sg_id { - int host_no; - int channel; + int host_no; + int channel; @@ -180,6 +185,8 @@ struct path { - int priority; - int pgindex; - int detect_prio; + int priority; + int pgindex; + int detect_prio; + int watch_checks; + int wait_checks; - char * uid_attribute; - struct prio prio; - char * prio_args; + char * uid_attribute; + struct prio prio; + char * prio_args; @@ -215,6 +222,8 @@ struct multipath { - int fast_io_fail; - int retain_hwhandler; - int deferred_remove; + int fast_io_fail; + int retain_hwhandler; + int deferred_remove; + int delay_watch_checks; + int delay_wait_checks; - unsigned int dev_loss; - uid_t uid; - gid_t gid; + unsigned int dev_loss; + uid_t uid; + gid_t gid; Index: multipath-tools-130222/libmultipath/checkers.h =================================================================== --- multipath-tools-130222.orig/libmultipath/checkers.h @@ -99,28 +99,28 @@ Index: multipath-tools-130222/libmultipath/checkers.h + * During this time, it is marked as "delayed" */ enum path_check_state { - PATH_WILD, + PATH_WILD, @@ -55,6 +63,7 @@ enum path_check_state { - PATH_SHAKY, - PATH_GHOST, - PATH_PENDING, + PATH_SHAKY, + PATH_GHOST, + PATH_PENDING, + PATH_DELAYED, - PATH_MAX_STATE + PATH_MAX_STATE }; - + Index: multipath-tools-130222/libmultipath/configure.c =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -291,6 +291,8 @@ setup_map (struct multipath * mpp, char - select_reservation_key(mpp); - select_retain_hwhandler(mpp); - select_deferred_remove(mpp); + select_reservation_key(mpp); + select_retain_hwhandler(mpp); + select_deferred_remove(mpp); + select_delay_watch_checks(mpp); + select_delay_wait_checks(mpp); - - sysfs_set_scsi_tmo(mpp); - /* + + sysfs_set_scsi_tmo(mpp); + /* Index: multipath-tools-130222/libmultipath/defaults.h =================================================================== --- multipath-tools-130222.orig/libmultipath/defaults.h @@ -130,7 +130,7 @@ Index: multipath-tools-130222/libmultipath/defaults.h #define DEFAULT_DETECT_PRIO DETECT_PRIO_OFF #define DEFAULT_DEFERRED_REMOVE DEFERRED_REMOVE_OFF +#define DEFAULT_DELAY_CHECKS DELAY_CHECKS_OFF - + #define DEFAULT_CHECKINT 5 #define MAX_CHECKINT(a) (a << 2) Index: multipath-tools-130222/libmultipath/dict.c @@ -138,9 +138,9 @@ Index: multipath-tools-130222/libmultipath/dict.c --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -801,6 +801,44 @@ def_ignore_new_boot_devs_handler(vector - return 0; + return 0; } - + +static int +def_delay_watch_checks_handler(vector strvec) +{ @@ -183,9 +183,9 @@ Index: multipath-tools-130222/libmultipath/dict.c * blacklist block handlers */ @@ -1517,6 +1555,52 @@ hw_deferred_remove_handler(vector strvec - return 0; + return 0; } - + +static int +hw_delay_watch_checks_handler(vector strvec) +{ @@ -236,9 +236,9 @@ Index: multipath-tools-130222/libmultipath/dict.c * multipaths block handlers */ @@ -1996,6 +2080,52 @@ mp_deferred_remove_handler(vector strvec - return 0; + return 0; } - + +static int +mp_delay_watch_checks_handler(vector strvec) +{ @@ -290,7 +290,7 @@ Index: multipath-tools-130222/libmultipath/dict.c */ @@ -2258,6 +2388,30 @@ snprint_mp_deferred_remove (char * buff, } - + static int +snprint_mp_delay_watch_checks(char * buff, int len, void * data) +{ @@ -318,10 +318,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_hw_fast_io_fail(char * buff, int len, void * data) { - struct hwentry * hwe = (struct hwentry *)data; + struct hwentry * hwe = (struct hwentry *)data; @@ -2586,6 +2740,30 @@ snprint_hw_deferred_remove(char * buff, } - + static int +snprint_hw_delay_watch_checks(char * buff, int len, void * data) +{ @@ -349,26 +349,26 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_detect_prio(char * buff, int len, void * data) { - struct hwentry * hwe = (struct hwentry *)data; + struct hwentry * hwe = (struct hwentry *)data; @@ -2883,7 +3061,6 @@ snprint_def_find_multipaths (char * buff - return snprintf(buff, len, "yes"); + return snprintf(buff, len, "yes"); } - + - static int snprint_def_user_friendly_names (char * buff, int len, void * data) { @@ -2989,7 +3166,6 @@ snprint_def_ignore_new_boot_devs(char * - return snprintf(buff, len, "no"); + return snprintf(buff, len, "no"); } - + - static int snprint_def_config_dir (char * buff, int len, void * data) { @@ -3000,6 +3176,24 @@ snprint_def_config_dir (char * buff, int } - + static int +snprint_def_delay_watch_checks(char * buff, int len, void * data) +{ @@ -390,53 +390,53 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_ble_simple (char * buff, int len, void * data) { - struct blentry * ble = (struct blentry *)data; + struct blentry * ble = (struct blentry *)data; @@ -3071,6 +3265,8 @@ init_keywords(void) - install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove); - install_keyword("ignore_new_boot_devs", &def_ignore_new_boot_devs_handler, &snprint_def_ignore_new_boot_devs); - install_keyword("config_dir", &def_config_dir_handler, &snprint_def_config_dir); + install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove); + install_keyword("ignore_new_boot_devs", &def_ignore_new_boot_devs_handler, &snprint_def_ignore_new_boot_devs); + install_keyword("config_dir", &def_config_dir_handler, &snprint_def_config_dir); + install_keyword("delay_watch_checks", &def_delay_watch_checks_handler, &snprint_def_delay_watch_checks); + install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks); - __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); + __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); @@ -3136,6 +3332,8 @@ init_keywords(void) - install_keyword("retain_attached_hw_handler", &hw_retain_hwhandler_handler, &snprint_hw_retain_hwhandler_handler); - install_keyword("detect_prio", &hw_detect_prio_handler, &snprint_detect_prio); - install_keyword("deferred_remove", &hw_deferred_remove_handler, &snprint_hw_deferred_remove); + install_keyword("retain_attached_hw_handler", &hw_retain_hwhandler_handler, &snprint_hw_retain_hwhandler_handler); + install_keyword("detect_prio", &hw_detect_prio_handler, &snprint_detect_prio); + install_keyword("deferred_remove", &hw_deferred_remove_handler, &snprint_hw_deferred_remove); + install_keyword("delay_watch_checks", &hw_delay_watch_checks_handler, &snprint_hw_delay_watch_checks); + install_keyword("delay_wait_checks", &hw_delay_wait_checks_handler, &snprint_hw_delay_wait_checks); - install_sublevel_end(); - - install_keyword_root("multipaths", &multipaths_handler); + install_sublevel_end(); + + install_keyword_root("multipaths", &multipaths_handler); @@ -3161,5 +3359,7 @@ init_keywords(void) - install_keyword("reservation_key", &mp_reservation_key_handler, &snprint_mp_reservation_key); - install_keyword("user_friendly_names", &mp_names_handler, &snprint_mp_user_friendly_names); - install_keyword("deferred_remove", &mp_deferred_remove_handler, &snprint_mp_deferred_remove); + install_keyword("reservation_key", &mp_reservation_key_handler, &snprint_mp_reservation_key); + install_keyword("user_friendly_names", &mp_names_handler, &snprint_mp_user_friendly_names); + install_keyword("deferred_remove", &mp_deferred_remove_handler, &snprint_mp_deferred_remove); + install_keyword("delay_watch_checks", &mp_delay_watch_checks_handler, &snprint_mp_delay_watch_checks); + install_keyword("delay_wait_checks", &mp_delay_wait_checks_handler, &snprint_mp_delay_wait_checks); - install_sublevel_end(); + install_sublevel_end(); } Index: multipath-tools-130222/libmultipath/print.c =================================================================== --- multipath-tools-130222.orig/libmultipath/print.c +++ multipath-tools-130222/libmultipath/print.c @@ -336,6 +336,8 @@ snprint_chk_state (char * buff, size_t l - return snprintf(buff, len, "shaky"); - case PATH_GHOST: - return snprintf(buff, len, "ghost"); + return snprintf(buff, len, "shaky"); + case PATH_GHOST: + return snprintf(buff, len, "ghost"); + case PATH_DELAYED: + return snprintf(buff, len, "delayed"); - default: - return snprintf(buff, len, "undef"); - } + default: + return snprintf(buff, len, "undef"); + } Index: multipath-tools-130222/libmultipath/propsel.c =================================================================== --- multipath-tools-130222.orig/libmultipath/propsel.c +++ multipath-tools-130222/libmultipath/propsel.c @@ -788,3 +788,55 @@ select_detect_prio (struct path * pp) - condlog(3, "%s: detect_prio = %d (compiled in default)", pp->dev, pp->detect_prio); - return 0; + condlog(3, "%s: detect_prio = %d (compiled in default)", pp->dev, pp->detect_prio); + return 0; } + +extern int @@ -505,19 +505,19 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -188,7 +188,8 @@ sync_map_state(struct multipath *mpp) - vector_foreach_slot (mpp->pg, pgp, i){ - vector_foreach_slot (pgp->paths, pp, j){ - if (pp->state == PATH_UNCHECKED || + vector_foreach_slot (mpp->pg, pgp, i){ + vector_foreach_slot (pgp->paths, pp, j){ + if (pp->state == PATH_UNCHECKED || - pp->state == PATH_WILD) + pp->state == PATH_WILD || + pp->state == PATH_DELAYED) - continue; - if ((pp->dmstate == PSTATE_FAILED || - pp->dmstate == PSTATE_UNDEF) && + continue; + if ((pp->dmstate == PSTATE_FAILED || + pp->dmstate == PSTATE_UNDEF) && @@ -1165,6 +1166,16 @@ check_path (struct vectors * vecs, struc - if (!pp->mpp) - return; - + if (!pp->mpp) + return; + + if ((newstate == PATH_UP || newstate == PATH_GHOST) && + pp->wait_checks > 0) { + if (pp->mpp && pp->mpp->nr_active > 0) { @@ -528,16 +528,16 @@ Index: multipath-tools-130222/multipathd/main.c + pp->wait_checks = 0; + } + - pp->chkrstate = newstate; - if (newstate != pp->state) { - int oldstate = pp->state; + pp->chkrstate = newstate; + if (newstate != pp->state) { + int oldstate = pp->state; @@ -1182,9 +1193,14 @@ check_path (struct vectors * vecs, struc - * proactively fail path in the DM - */ - if (oldstate == PATH_UP || + * proactively fail path in the DM + */ + if (oldstate == PATH_UP || - oldstate == PATH_GHOST) + oldstate == PATH_GHOST) { - fail_path(pp, 1); + fail_path(pp, 1); - else + if (pp->mpp->delay_wait_checks > 0 && + pp->watch_checks > 0) { @@ -545,37 +545,37 @@ Index: multipath-tools-130222/multipathd/main.c + pp->watch_checks = 0; + } + }else - fail_path(pp, 0); - - /* + fail_path(pp, 0); + + /* @@ -1211,11 +1227,15 @@ check_path (struct vectors * vecs, struc - * reinstate this path - */ - if (oldstate != PATH_UP && + * reinstate this path + */ + if (oldstate != PATH_UP && - oldstate != PATH_GHOST) + oldstate != PATH_GHOST) { + if (pp->mpp->delay_watch_checks > 0) + pp->watch_checks = pp->mpp->delay_watch_checks; - reinstate_path(pp, 1); + reinstate_path(pp, 1); - else + } else { + if (pp->watch_checks > 0) + pp->watch_checks--; - reinstate_path(pp, 0); + reinstate_path(pp, 0); - + } - new_path_up = 1; - - if (oldchkrstate != PATH_UP && oldchkrstate != PATH_GHOST) + new_path_up = 1; + + if (oldchkrstate != PATH_UP && oldchkrstate != PATH_GHOST) @@ -1245,6 +1265,8 @@ check_path (struct vectors * vecs, struc - else - pp->checkint = conf->max_checkint; - } + else + pp->checkint = conf->max_checkint; + } + if (pp->watch_checks > 0) + pp->watch_checks--; - pp->tick = pp->checkint; - condlog(4, "%s: delay next check %is", - pp->dev_t, pp->tick); + pp->tick = pp->checkint; + condlog(4, "%s: delay next check %is", + pp->dev_t, pp->tick); Index: multipath-tools-130222/multipath.conf.annotated =================================================================== --- multipath-tools-130222.orig/multipath.conf.annotated @@ -609,7 +609,7 @@ Index: multipath-tools-130222/multipath.conf.annotated +# # default : no +# delay_wait_checks 12 #} - # + # ## @@ -383,6 +407,13 @@ # # @@ -718,27 +718,27 @@ Index: multipath-tools-130222/libmultipath/checkers.c + "pending", + "delayed" }; - + static LIST_HEAD(checkers); Index: multipath-tools-130222/libmultipath/config.c =================================================================== --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -341,6 +341,8 @@ merge_hwe (struct hwentry * dst, struct - merge_num(retain_hwhandler); - merge_num(detect_prio); - merge_num(deferred_remove); + merge_num(retain_hwhandler); + merge_num(detect_prio); + merge_num(deferred_remove); + merge_num(delay_watch_checks); + merge_num(delay_wait_checks); - - /* - * Make sure features is consistent with + + /* + * Make sure features is consistent with @@ -399,6 +401,8 @@ overwrite_hwe (struct hwentry * dst, str - overwrite_num(retain_hwhandler); - overwrite_num(detect_prio); - overwrite_num(deferred_remove); + overwrite_num(retain_hwhandler); + overwrite_num(detect_prio); + overwrite_num(deferred_remove); + overwrite_num(delay_watch_checks); + overwrite_num(delay_wait_checks); - - /* - * Make sure features is consistent with + + /* + * Make sure features is consistent with diff --git a/SOURCES/0115-RHBZ-1198418-fix-double-free.patch b/SOURCES/0115-RHBZ-1198418-fix-double-free.patch index 8cf0895e..a4037605 100644 --- a/SOURCES/0115-RHBZ-1198418-fix-double-free.patch +++ b/SOURCES/0115-RHBZ-1198418-fix-double-free.patch @@ -7,9 +7,9 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -310,10 +310,15 @@ ev_add_map (char * dev, char * alias, st - /* - * now we can register the map - */ + /* + * now we can register the map + */ - if (map_present && (mpp = add_map_without_path(vecs, alias))) { - sync_map_state(mpp); - condlog(2, "%s: devmap %s registered", alias, dev); @@ -23,5 +23,6 @@ Index: multipath-tools-130222/multipathd/main.c + condlog(2, "%s: uev_add_map failed", dev); + return 1; + } - } - r = get_refwwid(dev, DEV_DEVMAP, vecs->pathvec, &refwwid); + } + r = get_refwwid(dev, DEV_DEVMAP, vecs->pathvec, &refwwid); + diff --git a/SOURCES/0116-UPBZ-1188179-dell-36xxi.patch b/SOURCES/0116-UPBZ-1188179-dell-36xxi.patch index 33016f4f..e32118b4 100644 --- a/SOURCES/0116-UPBZ-1188179-dell-36xxi.patch +++ b/SOURCES/0116-UPBZ-1188179-dell-36xxi.patch @@ -8,9 +8,9 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -772,6 +772,36 @@ static struct hwentry default_hw[] = { - .prio_name = PRIO_RDAC, - .prio_args = NULL, - }, + .prio_name = PRIO_RDAC, + .prio_args = NULL, + }, + { + /* DELL MD36xxi */ + .vendor = "DELL", @@ -41,9 +41,9 @@ Index: multipath-tools-130222/libmultipath/hwtable.c + .prio_name = PRIO_RDAC, + .prio_args = NULL, + }, - /* - * NETAPP controller family - * + /* + * NETAPP controller family + * Index: multipath-tools-130222/multipath.conf.defaults =================================================================== --- multipath-tools-130222.orig/multipath.conf.defaults diff --git a/SOURCES/0117-RHBZ-1198424-autodetect-clariion-alua.patch b/SOURCES/0117-RHBZ-1198424-autodetect-clariion-alua.patch index 555f403f..64a302d5 100644 --- a/SOURCES/0117-RHBZ-1198424-autodetect-clariion-alua.patch +++ b/SOURCES/0117-RHBZ-1198424-autodetect-clariion-alua.patch @@ -8,14 +8,14 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -272,6 +272,8 @@ static struct hwentry default_hw[] = { - .checker_name = EMC_CLARIION, - .prio_name = PRIO_EMC, - .prio_args = NULL, + .checker_name = EMC_CLARIION, + .prio_name = PRIO_EMC, + .prio_args = NULL, + .retain_hwhandler = RETAIN_HWHANDLER_ON, + .detect_prio = DETECT_PRIO_ON, - }, - { - .vendor = "EMC", + }, + { + .vendor = "EMC", Index: multipath-tools-130222/multipath.conf.defaults =================================================================== --- multipath-tools-130222.orig/multipath.conf.defaults diff --git a/SOURCES/0118-UPBZ-1200738-update-eternus-config.patch b/SOURCES/0118-UPBZ-1200738-update-eternus-config.patch index b4159ac4..10e96e34 100644 --- a/SOURCES/0118-UPBZ-1200738-update-eternus-config.patch +++ b/SOURCES/0118-UPBZ-1200738-update-eternus-config.patch @@ -8,14 +8,14 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -310,7 +310,7 @@ static struct hwentry default_hw[] = { - }, - { - .vendor = "FUJITSU", + }, + { + .vendor = "FUJITSU", - .product = "ETERNUS_DX(L|400|8000)", + .product = "ETERNUS_DX(H|L|M|400|8000)", - .features = "1 queue_if_no_path", - .hwhandler = DEFAULT_HWHANDLER, - .pgpolicy = GROUP_BY_PRIO, + .features = "1 queue_if_no_path", + .hwhandler = DEFAULT_HWHANDLER, + .pgpolicy = GROUP_BY_PRIO, Index: multipath-tools-130222/multipath.conf.defaults =================================================================== --- multipath-tools-130222.orig/multipath.conf.defaults diff --git a/SOURCES/0119-RHBZ-1081397-save-alua-info.patch b/SOURCES/0119-RHBZ-1081397-save-alua-info.patch index d6e5a56e..c9913f35 100644 --- a/SOURCES/0119-RHBZ-1081397-save-alua-info.patch +++ b/SOURCES/0119-RHBZ-1081397-save-alua-info.patch @@ -24,13 +24,13 @@ Index: multipath-tools-130222/libmultipath/prio.c --- multipath-tools-130222.orig/libmultipath/prio.c +++ multipath-tools-130222/libmultipath/prio.c @@ -112,9 +112,24 @@ struct prio * add_prio (char * name) - p->getprio = (int (*)(struct path *, char *)) dlsym(p->handle, "getprio"); - errstr = dlerror(); - if (errstr != NULL) + p->getprio = (int (*)(struct path *, char *)) dlsym(p->handle, "getprio"); + errstr = dlerror(); + if (errstr != NULL) - condlog(0, "A dynamic linking error occurred: (%s)", errstr); + condlog(0, "A dynamic linking error occurred with getprio: (%s)", errstr); - if (!p->getprio) - goto out; + if (!p->getprio) + goto out; + + p->initprio = (int (*)(struct prio *)) dlsym(p->handle, "initprio"); + errstr = dlerror(); @@ -46,13 +46,13 @@ Index: multipath-tools-130222/libmultipath/prio.c + if (!p->freeprio) + goto out; + - list_add(&p->node, &prioritizers); - return p; + list_add(&p->node, &prioritizers); + return p; out: @@ -122,6 +137,13 @@ out: - return NULL; + return NULL; } - + +int prio_init (struct prio * p) +{ + if (!p || !p->initprio) @@ -62,52 +62,52 @@ Index: multipath-tools-130222/libmultipath/prio.c + int prio_getprio (struct prio * p, struct path * pp) { - return p->getprio(pp, p->args); + return p->getprio(pp, p->args); @@ -156,8 +178,16 @@ void prio_get (struct prio * dst, char * - strncpy(dst->name, src->name, PRIO_NAME_LEN); - if (args) - strncpy(dst->args, args, PRIO_ARGS_LEN); + strncpy(dst->name, src->name, PRIO_NAME_LEN); + if (args) + strncpy(dst->args, args, PRIO_ARGS_LEN); + dst->initprio = src->initprio; - dst->getprio = src->getprio; + dst->getprio = src->getprio; + dst->freeprio = src->freeprio; - dst->handle = NULL; + dst->handle = NULL; + dst->context = NULL; + + if (dst->initprio(dst) != 0){ + memset(dst, 0x0, sizeof(struct prio)); + return; + } - - src->refcount++; + + src->refcount++; } @@ -173,6 +203,8 @@ void prio_put (struct prio * dst) - src = NULL; - else - src = prio_lookup(dst->name); + src = NULL; + else + src = prio_lookup(dst->name); + if (dst->freeprio) + dst->freeprio(dst); - memset(dst, 0x0, sizeof(struct prio)); - free_prio(src); + memset(dst, 0x0, sizeof(struct prio)); + free_prio(src); } Index: multipath-tools-130222/libmultipath/prio.h =================================================================== --- multipath-tools-130222.orig/libmultipath/prio.h +++ multipath-tools-130222/libmultipath/prio.h @@ -46,9 +46,15 @@ struct prio { - void *handle; - int refcount; - struct list_head node; + void *handle; + int refcount; + struct list_head node; + void * context; - char name[PRIO_NAME_LEN]; - char args[PRIO_ARGS_LEN]; + char name[PRIO_NAME_LEN]; + char args[PRIO_ARGS_LEN]; + int (*initprio)(struct prio * p); + /* You are allowed to call initprio multiple times without calling + * freeprio. Doing so will reinitialize it (possibly skipping + * allocations) */ - int (*getprio)(struct path *, char *); + int (*getprio)(struct path *, char *); + int (*freeprio)(struct prio * p); }; - + unsigned int get_prio_timeout(unsigned int default_timeout); @@ -57,6 +63,7 @@ void cleanup_prio (void); struct prio * add_prio (char *); @@ -122,9 +122,9 @@ Index: multipath-tools-130222/libmultipath/prioritizers/alua.c --- multipath-tools-130222.orig/libmultipath/prioritizers/alua.c +++ multipath-tools-130222/libmultipath/prioritizers/alua.c @@ -37,6 +37,12 @@ static const char * aas_string[] = { - [AAS_TRANSITIONING] = "transitioning between states", + [AAS_TRANSITIONING] = "transitioning between states", }; - + +struct alua_context { + int tpg_support; + int tpg; @@ -133,18 +133,18 @@ Index: multipath-tools-130222/libmultipath/prioritizers/alua.c + static const char *aas_print_string(int rc) { - rc &= 0x7f; + rc &= 0x7f; @@ -51,25 +57,26 @@ static const char *aas_print_string(int } - + int -get_alua_info(int fd) +get_alua_info(int fd, struct alua_context *ct) { - int rc; + int rc; - int tpg; - int aas; - + int aas; + - rc = get_target_port_group_support(fd); - if (rc < 0) - return -ALUA_PRIO_TPGS_FAILED; @@ -167,26 +167,26 @@ Index: multipath-tools-130222/libmultipath/prioritizers/alua.c + if (ct->tpg < 0) + return -ALUA_PRIO_RTPG_FAILED; + } - + - condlog(3, "reported target port group is %i", tpg); - rc = get_asymmetric_access_state(fd, tpg); + condlog(3, "reported target port group is %i", ct->tpg); + rc = get_asymmetric_access_state(fd, ct->tpg, &ct->buflen); - if (rc < 0) - return -ALUA_PRIO_GETAAS_FAILED; - aas = (rc & 0x0f); + if (rc < 0) + return -ALUA_PRIO_GETAAS_FAILED; + aas = (rc & 0x0f); @@ -88,7 +95,7 @@ int getprio (struct path * pp, char * ar - if (pp->fd < 0) - return -ALUA_PRIO_NO_INFORMATION; - + if (pp->fd < 0) + return -ALUA_PRIO_NO_INFORMATION; + - rc = get_alua_info(pp->fd); + rc = get_alua_info(pp->fd, pp->prio.context); - if (rc >= 0) { - aas = (rc & 0x0f); - priopath = (rc & 0x80); + if (rc >= 0) { + aas = (rc & 0x0f); + priopath = (rc & 0x80); @@ -128,3 +135,28 @@ int getprio (struct path * pp, char * ar - } - return rc; + } + return rc; } + +int initprio(struct prio *p) @@ -219,17 +219,17 @@ Index: multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.c +++ multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.c @@ -171,7 +171,7 @@ get_target_port_group_support(int fd) } - + int -get_target_port_group(int fd) +get_target_port_group(int fd, int *buflen_ptr) { - unsigned char *buf; - struct vpd83_data * vpd83; + unsigned char *buf; + struct vpd83_data * vpd83; @@ -179,7 +179,12 @@ get_target_port_group(int fd) - int rc; - int buflen, scsi_buflen; - + int rc; + int buflen, scsi_buflen; + - buflen = 128; /* Lets start from 128 */ + if (!buflen_ptr || *buflen_ptr == 0) { + buflen = 128; /* Lets start from 128 */ @@ -237,31 +237,31 @@ Index: multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.c + *buflen_ptr = 128; + } else + buflen = *buflen_ptr; - buf = (unsigned char *)malloc(buflen); - if (!buf) { - PRINT_DEBUG("malloc failed: could not allocate" + buf = (unsigned char *)malloc(buflen); + if (!buf) { + PRINT_DEBUG("malloc failed: could not allocate" @@ -202,6 +207,8 @@ get_target_port_group(int fd) - return -RTPG_RTPG_FAILED; - } - buflen = scsi_buflen; + return -RTPG_RTPG_FAILED; + } + buflen = scsi_buflen; + if (buflen_ptr) + *buflen_ptr = buflen; - memset(buf, 0, buflen); - rc = do_inquiry(fd, 1, 0x83, buf, buflen); - if (rc < 0) + memset(buf, 0, buflen); + rc = do_inquiry(fd, 1, 0x83, buf, buflen); + if (rc < 0) @@ -269,7 +276,7 @@ do_rtpg(int fd, void* resp, long resplen } - + int -get_asymmetric_access_state(int fd, unsigned int tpg) +get_asymmetric_access_state(int fd, unsigned int tpg, int *buflen_ptr) { - unsigned char *buf; - struct rtpg_data * tpgd; + unsigned char *buf; + struct rtpg_data * tpgd; @@ -278,7 +285,12 @@ get_asymmetric_access_state(int fd, unsi - int buflen; - uint32_t scsi_buflen; - + int buflen; + uint32_t scsi_buflen; + - buflen = 128; /* Initial value from old code */ + if (!buflen_ptr || *buflen_ptr == 0) { + buflen = 128; /* Initial value from old code */ @@ -269,46 +269,46 @@ Index: multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.c + *buflen_ptr = 128; + } else + buflen = *buflen_ptr; - buf = (unsigned char *)malloc(buflen); - if (!buf) { - PRINT_DEBUG ("malloc failed: could not allocate" + buf = (unsigned char *)malloc(buflen); + if (!buf) { + PRINT_DEBUG ("malloc failed: could not allocate" @@ -299,6 +311,8 @@ get_asymmetric_access_state(int fd, unsi - return -RTPG_RTPG_FAILED; - } - buflen = scsi_buflen; + return -RTPG_RTPG_FAILED; + } + buflen = scsi_buflen; + if (buflen_ptr) + *buflen_ptr = buflen; - memset(buf, 0, buflen); - rc = do_rtpg(fd, buf, buflen); - if (rc < 0) + memset(buf, 0, buflen); + rc = do_rtpg(fd, buf, buflen); + if (rc < 0) Index: multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.h =================================================================== --- multipath-tools-130222.orig/libmultipath/prioritizers/alua_rtpg.h +++ multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.h @@ -23,8 +23,8 @@ #define RTPG_TPG_NOT_FOUND 4 - + int get_target_port_group_support(int fd); -int get_target_port_group(int fd); -int get_asymmetric_access_state(int fd, unsigned int tpg); +int get_target_port_group(int fd, int *buflen_ptr); +int get_asymmetric_access_state(int fd, unsigned int tpg, int *buflen_ptr); - + #endif /* __RTPG_H__ */ - + Index: multipath-tools-130222/libmultipath/prioritizers/const.c =================================================================== --- multipath-tools-130222.orig/libmultipath/prioritizers/const.c +++ multipath-tools-130222/libmultipath/prioritizers/const.c @@ -1,8 +1,12 @@ #include - + #include +#include "def_func.h" - + int getprio (struct path * pp, char * args) { - return 1; + return 1; } + +declare_nop_prio(initprio) @@ -322,13 +322,13 @@ Index: multipath-tools-130222/libmultipath/prioritizers/datacore.c #include #include +#include "def_func.h" - + #define INQ_REPLY_LEN 255 #define INQ_CMD_CODE 0x12 @@ -111,3 +112,5 @@ int getprio (struct path * pp, char * ar return datacore_prio(pp->dev, pp->fd, args); } - + +declare_nop_prio(initprio) +declare_nop_prio(freeprio) Index: multipath-tools-130222/libmultipath/prioritizers/def_func.h @@ -356,12 +356,12 @@ Index: multipath-tools-130222/libmultipath/prioritizers/emc.c #include #include +#include "def_func.h" - + #define INQUIRY_CMD 0x12 #define INQUIRY_CMDLEN 6 @@ -85,3 +86,6 @@ int getprio (struct path * pp, char * ar { - return emc_clariion_prio(pp->dev, pp->fd); + return emc_clariion_prio(pp->dev, pp->fd); } + +declare_nop_prio(initprio) @@ -375,12 +375,12 @@ Index: multipath-tools-130222/libmultipath/prioritizers/hds.c #include #include +#include "def_func.h" - + #define INQ_REPLY_LEN 255 #define INQ_CMD_CODE 0x12 @@ -170,3 +171,6 @@ int getprio (struct path * pp, char * ar { - return hds_modular_prio(pp->dev, pp->fd); + return hds_modular_prio(pp->dev, pp->fd); } + +declare_nop_prio(initprio) @@ -394,12 +394,12 @@ Index: multipath-tools-130222/libmultipath/prioritizers/hp_sw.c #include #include +#include "def_func.h" - + #define TUR_CMD_LEN 6 #define SCSI_CHECK_CONDITION 0x2 @@ -99,3 +100,6 @@ int getprio (struct path * pp, char * ar { - return hp_sw_prio(pp->dev, pp->fd); + return hp_sw_prio(pp->dev, pp->fd); } + +declare_nop_prio(initprio) @@ -413,12 +413,12 @@ Index: multipath-tools-130222/libmultipath/prioritizers/iet.c #include #include +#include "def_func.h" - + // // This prioritizer suits iSCSI needs, makes it possible to prefer one path. @@ -141,3 +142,6 @@ int getprio(struct path * pp, char * arg { - return iet_prio(pp->dev, args); + return iet_prio(pp->dev, args); } + +declare_nop_prio(initprio) @@ -432,12 +432,12 @@ Index: multipath-tools-130222/libmultipath/prioritizers/ontap.c #include #include +#include "def_func.h" - + #define INQUIRY_CMD 0x12 #define INQUIRY_CMDLEN 6 @@ -245,3 +246,6 @@ int getprio (struct path * pp, char * ar { - return ontap_prio(pp->dev, pp->fd); + return ontap_prio(pp->dev, pp->fd); } + +declare_nop_prio(initprio) @@ -448,15 +448,15 @@ Index: multipath-tools-130222/libmultipath/prioritizers/random.c +++ multipath-tools-130222/libmultipath/prioritizers/random.c @@ -4,6 +4,7 @@ #include - + #include +#include "def_func.h" - + int getprio (struct path * pp, char * args) { @@ -13,3 +14,6 @@ int getprio (struct path * pp, char * ar - srand((unsigned int)tv.tv_usec); - return 1+(int) (10.0*rand()/(RAND_MAX+1.0)); + srand((unsigned int)tv.tv_usec); + return 1+(int) (10.0*rand()/(RAND_MAX+1.0)); } + +declare_nop_prio(initprio) @@ -470,12 +470,12 @@ Index: multipath-tools-130222/libmultipath/prioritizers/rdac.c #include #include +#include "def_func.h" - + #define INQUIRY_CMD 0x12 #define INQUIRY_CMDLEN 6 @@ -95,3 +96,6 @@ int getprio (struct path * pp, char * ar { - return rdac_prio(pp->dev, pp->fd); + return rdac_prio(pp->dev, pp->fd); } + +declare_nop_prio(initprio) @@ -489,13 +489,13 @@ Index: multipath-tools-130222/libmultipath/prioritizers/weightedpath.c #include #include +#include "def_func.h" - + char *get_next_string(char **temp, char *split_char) { @@ -104,3 +105,5 @@ int getprio(struct path *pp, char *args) - return prio_path_weight(pp, args); + return prio_path_weight(pp, args); } - + +declare_nop_prio(initprio) +declare_nop_prio(freeprio) Index: multipath-tools-130222/libmultipath/propsel.c @@ -503,17 +503,17 @@ Index: multipath-tools-130222/libmultipath/propsel.c --- multipath-tools-130222.orig/libmultipath/propsel.c +++ multipath-tools-130222/libmultipath/propsel.c @@ -401,10 +401,10 @@ detect_prio(struct path * pp) - - if (get_target_port_group_support(pp->fd) <= 0) - return; + + if (get_target_port_group_support(pp->fd) <= 0) + return; - ret = get_target_port_group(pp->fd); + ret = get_target_port_group(pp->fd, NULL); - if (ret < 0) - return; + if (ret < 0) + return; - if (get_asymmetric_access_state(pp->fd, ret) < 0) + if (get_asymmetric_access_state(pp->fd, ret, NULL) < 0) - return; - prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS); + return; + prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS); } Index: multipath-tools-130222/multipathd/main.c =================================================================== @@ -522,7 +522,7 @@ Index: multipath-tools-130222/multipathd/main.c @@ -700,20 +700,23 @@ static int uev_update_path (struct uevent *uev, struct vectors * vecs) { - int ro, retval = 0; + int ro, retval = 0; + struct path * pp; + + pp = find_path_by_dev(vecs->pathvec, uev->kernel); @@ -534,32 +534,32 @@ Index: multipath-tools-130222/multipathd/main.c + /* reinit the prio values on change event, in case something is + * different */ + prio_init(&pp->prio); - - ro = uevent_get_disk_ro(uev); - - if (ro >= 0) { + + ro = uevent_get_disk_ro(uev); + + if (ro >= 0) { - struct path * pp; - - condlog(2, "%s: update path write_protect to '%d' (uevent)", - uev->kernel, ro); + condlog(2, "%s: update path write_protect to '%d' (uevent)", + uev->kernel, ro); - pp = find_path_by_dev(vecs->pathvec, uev->kernel); - if (!pp) { - condlog(0, "%s: spurious uevent, path not found", - uev->kernel); - return 1; - } - if (pp->mpp) { - retval = reload_map(vecs, pp->mpp, 0); - + if (pp->mpp) { + retval = reload_map(vecs, pp->mpp, 0); + @@ -1218,6 +1221,11 @@ check_path (struct vectors * vecs, struc - } - - if(newstate == PATH_UP || newstate == PATH_GHOST){ + } + + if(newstate == PATH_UP || newstate == PATH_GHOST){ + /* + * Reinitialize the prioritizer, in case something + * changed. + */ + prio_init(&pp->prio); - if ( pp->mpp && pp->mpp->prflag ){ - /* - * Check Persistent Reservation. + if ( pp->mpp && pp->mpp->prflag ){ + /* + * Check Persistent Reservation. diff --git a/SOURCES/0120-RHBZ-1043093-realloc-fix.patch b/SOURCES/0120-RHBZ-1043093-realloc-fix.patch index 56f3a0ce..96b812ab 100644 --- a/SOURCES/0120-RHBZ-1043093-realloc-fix.patch +++ b/SOURCES/0120-RHBZ-1043093-realloc-fix.patch @@ -16,25 +16,25 @@ Index: multipath-tools-130222/libmultipath/dmparser.c { - char * p; + char * p = *dst; - int len; - - len = strlen(*dst) + strlen(word) + space; - *dst = REALLOC(*dst, len + 1); - + int len; + + len = strlen(*dst) + strlen(word) + space; + *dst = REALLOC(*dst, len + 1); + - if (!*dst) + if (!*dst) { + free(p); - return 1; + return 1; + } - - p = *dst; - + + p = *dst; + Index: multipath-tools-130222/libmultipath/regex.c =================================================================== --- multipath-tools-130222.orig/libmultipath/regex.c +++ multipath-tools-130222/libmultipath/regex.c @@ -123,7 +123,14 @@ static void init_syntax_once(void) - + /* (Re)Allocate N items of type T using malloc, or fail. */ #define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t))) -#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t))) @@ -47,7 +47,7 @@ Index: multipath-tools-130222/libmultipath/regex.c +} while(0) + #define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t))) - + #define BYTEWIDTH 8 /* In bits. */ Index: multipath-tools-130222/multipath/main.c =================================================================== @@ -59,56 +59,56 @@ Index: multipath-tools-130222/multipath/main.c { - char * c; + char * c, * tmp = NULL; - char * reply; - unsigned int maxlen = 256; - int again = 1; + char * reply; + unsigned int maxlen = 256; + int again = 1; @@ -402,9 +402,12 @@ dump_config (void) - reply = MALLOC(maxlen); - - while (again) { + reply = MALLOC(maxlen); + + while (again) { - if (!reply) + if (!reply) { + if (tmp) + free(tmp); - return 1; + return 1; - c = reply; + } + c = tmp = reply; - c += snprint_defaults(c, reply + maxlen - c); - again = ((c - reply) == maxlen); - if (again) { + c += snprint_defaults(c, reply + maxlen - c); + again = ((c - reply) == maxlen); + if (again) { Index: multipath-tools-130222/multipathd/cli_handlers.c =================================================================== --- multipath-tools-130222.orig/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -26,11 +26,14 @@ #define REALLOC_REPLY(r, a, m) \ - do { \ - if ((a)) { \ + do { \ + if ((a)) { \ + char *tmp = (r); \ - (r) = REALLOC((r), (m) * 2); \ - if ((r)) { \ - memset((r) + (m), 0, (m)); \ - (m) *= 2; \ - } \ + (r) = REALLOC((r), (m) * 2); \ + if ((r)) { \ + memset((r) + (m), 0, (m)); \ + (m) *= 2; \ + } \ + else \ + free(tmp); \ - } \ - } while (0) - + } \ + } while (0) + @@ -144,7 +147,7 @@ show_config (char ** r, int * len) - unsigned int maxlen = INITIAL_REPLY_LEN; - int again = 1; - + unsigned int maxlen = INITIAL_REPLY_LEN; + int again = 1; + - reply = MALLOC(maxlen); + c = reply = MALLOC(maxlen); - - while (again) { - if (!reply) + + while (again) { + if (!reply) @@ -152,44 +155,24 @@ show_config (char ** r, int * len) - c = reply; - c += snprint_defaults(c, reply + maxlen - c); - again = ((c - reply) == maxlen); + c = reply; + c += snprint_defaults(c, reply + maxlen - c); + again = ((c - reply) == maxlen); - if (again) { - reply = REALLOC(reply, maxlen * 2); - if (!reply) @@ -117,10 +117,10 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c - maxlen *= 2; + REALLOC_REPLY(reply, again, maxlen); + if (again) - continue; + continue; - } - c += snprint_blacklist(c, reply + maxlen - c); - again = ((c - reply) == maxlen); + c += snprint_blacklist(c, reply + maxlen - c); + again = ((c - reply) == maxlen); - if (again) { - reply = REALLOC(reply, maxlen * 2); - if (!reply) @@ -129,10 +129,10 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c - maxlen *= 2; + REALLOC_REPLY(reply, again, maxlen); + if (again) - continue; + continue; - } - c += snprint_blacklist_except(c, reply + maxlen - c); - again = ((c - reply) == maxlen); + c += snprint_blacklist_except(c, reply + maxlen - c); + again = ((c - reply) == maxlen); - if (again) { - reply = REALLOC(reply, maxlen * 2); - if (!reply) @@ -141,10 +141,10 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c - maxlen *= 2; + REALLOC_REPLY(reply, again, maxlen); + if (again) - continue; + continue; - } - c += snprint_hwtable(c, reply + maxlen - c, conf->hwtable); - again = ((c - reply) == maxlen); + c += snprint_hwtable(c, reply + maxlen - c, conf->hwtable); + again = ((c - reply) == maxlen); - if (again) { - reply = REALLOC(reply, maxlen * 2); - if (!reply) @@ -153,35 +153,35 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c - maxlen *= 2; + REALLOC_REPLY(reply, again, maxlen); + if (again) - continue; + continue; - } - c += snprint_mptable(c, reply + maxlen - c, conf->mptable); - again = ((c - reply) == maxlen); - REALLOC_REPLY(reply, again, maxlen); + c += snprint_mptable(c, reply + maxlen - c, conf->mptable); + again = ((c - reply) == maxlen); + REALLOC_REPLY(reply, again, maxlen); Index: multipath-tools-130222/multipathd/uxlsnr.c =================================================================== --- multipath-tools-130222.orig/multipathd/uxlsnr.c +++ multipath-tools-130222/multipathd/uxlsnr.c @@ -64,6 +64,10 @@ static void new_client(int ux_sock) - - /* put it in our linked list */ - c = (struct client *)MALLOC(sizeof(*c)); + + /* put it in our linked list */ + c = (struct client *)MALLOC(sizeof(*c)); + if (!c) { + close(fd); + return; + } - memset(c, 0, sizeof(*c)); - c->fd = fd; - c->next = clients; + memset(c, 0, sizeof(*c)); + c->fd = fd; + c->next = clients; @@ -124,11 +128,18 @@ void * uxsock_listen(int (*uxsock_trigge - sigdelset(&mask, SIGHUP); - sigdelset(&mask, SIGUSR1); - while (1) { + sigdelset(&mask, SIGHUP); + sigdelset(&mask, SIGUSR1); + while (1) { + struct pollfd *tmp; - struct client *c; - int i, poll_count; - - /* setup for a poll */ + struct client *c; + int i, poll_count; + + /* setup for a poll */ - polls = REALLOC(polls, (1+num_clients) * sizeof(*polls)); + tmp = REALLOC(polls, (1+num_clients) * sizeof(*polls)); + /* If we can't allocate poliing space for the new client, @@ -190,5 +190,6 @@ Index: multipath-tools-130222/multipathd/uxlsnr.c + dead_client(clients); + else + polls = tmp; - polls[0].fd = ux_sock; - polls[0].events = POLLIN; + polls[0].fd = ux_sock; + polls[0].events = POLLIN; + diff --git a/SOURCES/0122-RHBZ-1212590-dont-use-var.patch b/SOURCES/0122-RHBZ-1212590-dont-use-var.patch index de69ea64..52d743a7 100644 --- a/SOURCES/0122-RHBZ-1212590-dont-use-var.patch +++ b/SOURCES/0122-RHBZ-1212590-dont-use-var.patch @@ -9,7 +9,7 @@ Index: multipath-tools-130222/libmultipath/defaults.h +++ multipath-tools-130222/libmultipath/defaults.h @@ -26,8 +26,8 @@ #define MAX_CHECKINT(a) (a << 2) - + #define MAX_DEV_LOSS_TMO 0x7FFFFFFF -#define DEFAULT_PIDFILE "/var/run/multipathd/multipathd.pid" -#define DEFAULT_TIMESTAMP_FILE "/var/run/multipathd/timestamp" @@ -23,7 +23,7 @@ Index: multipath-tools-130222/multipathd/multipathd.service --- multipath-tools-130222.orig/multipathd/multipathd.service +++ multipath-tools-130222/multipathd/multipathd.service @@ -9,7 +9,7 @@ Conflicts=shutdown.target - + [Service] Type=forking -PIDFile=/var/run/multipathd/multipathd.pid diff --git a/SOURCES/0123-UPBZ-1166072-fix-path-offline.patch b/SOURCES/0123-UPBZ-1166072-fix-path-offline.patch index 5078b881..0f1a9129 100644 --- a/SOURCES/0123-UPBZ-1166072-fix-path-offline.patch +++ b/SOURCES/0123-UPBZ-1166072-fix-path-offline.patch @@ -7,13 +7,13 @@ Index: multipath-tools-130222/libmultipath/discovery.c --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -946,9 +946,7 @@ path_offline (struct path * pp) - - condlog(3, "%s: path state = %s", pp->dev, buff); - + + condlog(3, "%s: path state = %s", pp->dev, buff); + - if (!strncmp(buff, "offline", 7) || - !strncmp(buff, "quiesce", 7) || - !strncmp(buff, "transport-offline", 17)) { + if (!strncmp(buff, "offline", 7)) { - pp->offline = 1; - return PATH_DOWN; - } + pp->offline = 1; + return PATH_DOWN; + } diff --git a/SOURCES/0124-RHBZ-1209275-retrigger-uevents.patch b/SOURCES/0124-RHBZ-1209275-retrigger-uevents.patch index a23bfaa7..e0b1886e 100644 --- a/SOURCES/0124-RHBZ-1209275-retrigger-uevents.patch +++ b/SOURCES/0124-RHBZ-1209275-retrigger-uevents.patch @@ -13,27 +13,27 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -673,6 +673,8 @@ load_config (char * file, struct udev *u - conf->force_sync = 0; - conf->ignore_new_boot_devs = 0; - conf->processed_main_config = 0; + conf->force_sync = 0; + conf->ignore_new_boot_devs = 0; + conf->processed_main_config = 0; + conf->retrigger_tries = DEFAULT_RETRIGGER_TRIES; + conf->retrigger_delay = DEFAULT_RETRIGGER_DELAY; - - /* - * preload default hwtable + + /* + * preload default hwtable Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -139,6 +139,8 @@ struct config { - int processed_main_config; - int delay_watch_checks; - int delay_wait_checks; + int processed_main_config; + int delay_watch_checks; + int delay_wait_checks; + int retrigger_tries; + int retrigger_delay; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/libmultipath/defaults.h =================================================================== --- multipath-tools-130222.orig/libmultipath/defaults.h @@ -44,7 +44,7 @@ Index: multipath-tools-130222/libmultipath/defaults.h #define DEFAULT_DELAY_CHECKS DELAY_CHECKS_OFF +#define DEFAULT_RETRIGGER_DELAY 10 +#define DEFAULT_RETRIGGER_TRIES 3 - + #define DEFAULT_CHECKINT 5 #define MAX_CHECKINT(a) (a << 2) Index: multipath-tools-130222/libmultipath/dict.c @@ -52,9 +52,9 @@ Index: multipath-tools-130222/libmultipath/dict.c --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -839,6 +839,38 @@ def_delay_wait_checks_handler(vector str - return 0; + return 0; } - + +static int +def_retrigger_tries_handler(vector strvec) +{ @@ -92,7 +92,7 @@ Index: multipath-tools-130222/libmultipath/dict.c */ @@ -3194,6 +3226,18 @@ snprint_def_delay_wait_checks(char * buf } - + static int +snprint_def_retrigger_tries (char * buff, int len, void * data) +{ @@ -108,54 +108,54 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_ble_simple (char * buff, int len, void * data) { - struct blentry * ble = (struct blentry *)data; + struct blentry * ble = (struct blentry *)data; @@ -3267,6 +3311,8 @@ init_keywords(void) - install_keyword("config_dir", &def_config_dir_handler, &snprint_def_config_dir); - install_keyword("delay_watch_checks", &def_delay_watch_checks_handler, &snprint_def_delay_watch_checks); - install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks); + install_keyword("config_dir", &def_config_dir_handler, &snprint_def_config_dir); + install_keyword("delay_watch_checks", &def_delay_watch_checks_handler, &snprint_def_delay_watch_checks); + install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks); + install_keyword("retrigger_tries", &def_retrigger_tries_handler, &snprint_def_retrigger_tries); + install_keyword("retrigger_delay", &def_retrigger_delay_handler, &snprint_def_retrigger_delay); - __deprecated install_keyword("default_selector", &def_selector_handler, NULL); - __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); - __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); + __deprecated install_keyword("default_selector", &def_selector_handler, NULL); + __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); + __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); Index: multipath-tools-130222/libmultipath/discovery.c =================================================================== --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -1111,9 +1111,13 @@ get_uid (struct path * pp) - len = strlen(value); - } - strncpy(pp->wwid, value, len); + len = strlen(value); + } + strncpy(pp->wwid, value, len); + pp->missing_udev_info = INFO_OK; + pp->tick = 0; - } else { - condlog(3, "%s: no %s attribute", pp->dev, - pp->uid_attribute); + } else { + condlog(3, "%s: no %s attribute", pp->dev, + pp->uid_attribute); + pp->missing_udev_info = INFO_MISSING; + pp->tick = conf->retrigger_delay; - } - - /* Strip any trailing blanks */ + } + + /* Strip any trailing blanks */ @@ -1201,10 +1205,8 @@ pathinfo (struct path *pp, vector hwtabl - * Retrieve path priority, even for PATH_DOWN paths if it has never - * been successfully obtained before. - */ + * Retrieve path priority, even for PATH_DOWN paths if it has never + * been successfully obtained before. + */ - if ((mask & DI_PRIO) && path_state == PATH_UP) { + if ((mask & DI_PRIO) && path_state == PATH_UP && strlen(pp->wwid)) { - if (pp->state != PATH_DOWN || pp->priority == PRIO_UNDEF) { + if (pp->state != PATH_DOWN || pp->priority == PRIO_UNDEF) { - if (!strlen(pp->wwid)) - get_uid(pp); - get_prio(pp); - } - } + get_prio(pp); + } + } Index: multipath-tools-130222/libmultipath/structs.h =================================================================== --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -139,6 +139,12 @@ enum delay_checks_states { - DELAY_CHECKS_UNDEF = 0, + DELAY_CHECKS_UNDEF = 0, }; - + +enum missing_udev_info_states { + INFO_OK, + INFO_MISSING, @@ -163,44 +163,44 @@ Index: multipath-tools-130222/libmultipath/structs.h +}; + struct sg_id { - int host_no; - int channel; + int host_no; + int channel; @@ -193,6 +199,8 @@ struct path { - struct checker checker; - struct multipath * mpp; - int fd; + struct checker checker; + struct multipath * mpp; + int fd; + int missing_udev_info; + int retriggers; - - /* configlet pointers */ - struct hwentry * hwe; + + /* configlet pointers */ + struct hwentry * hwe; Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -708,6 +708,10 @@ uev_update_path (struct uevent *uev, str - uev->kernel); - return 1; - } + uev->kernel); + return 1; + } + + if (pp->missing_udev_info == INFO_REQUESTED) + return uev_add_path(uev, vecs); + - /* reinit the prio values on change event, in case something is - * different */ - prio_init(&pp->prio); + /* reinit the prio values on change event, in case something is + * different */ + prio_init(&pp->prio); @@ -1133,12 +1137,21 @@ check_path (struct vectors * vecs, struc - int chkr_new_path_up = 0; - int oldchkrstate = pp->chkrstate; - + int chkr_new_path_up = 0; + int oldchkrstate = pp->chkrstate; + - if (!pp->mpp) + if (!pp->mpp && (pp->missing_udev_info != INFO_MISSING || + pp->retriggers >= conf->retrigger_tries)) - return; - - if (pp->tick && --pp->tick) - return; /* don't check this path yet */ - + return; + + if (pp->tick && --pp->tick) + return; /* don't check this path yet */ + + if (!pp->mpp) { + pp->missing_udev_info = INFO_REQUESTED; + pp->retriggers++; @@ -209,6 +209,6 @@ Index: multipath-tools-130222/multipathd/main.c + return; + } + - /* - * provision a next check soonest, - * in case we exit abnormaly from here + /* + * provision a next check soonest, + * in case we exit abnormaly from here diff --git a/SOURCES/0125-RHBZ-1153832-kpartx-delete.patch b/SOURCES/0125-RHBZ-1153832-kpartx-delete.patch index ac30851a..329bc442 100644 --- a/SOURCES/0125-RHBZ-1153832-kpartx-delete.patch +++ b/SOURCES/0125-RHBZ-1153832-kpartx-delete.patch @@ -7,20 +7,20 @@ Index: multipath-tools-130222/kpartx/kpartx.c --- multipath-tools-130222.orig/kpartx/kpartx.c +++ multipath-tools-130222/kpartx/kpartx.c @@ -409,7 +409,7 @@ main(int argc, char **argv){ - break; - - case DELETE: + break; + + case DELETE: - for (j = n-1; j >= 0; j--) { + for (j = MAXSLICES-1; j >= 0; j--) { - if (safe_sprintf(partname, "%s%s%d", - mapname, delim, j+1)) { - fprintf(stderr, "partname too small\n"); + if (safe_sprintf(partname, "%s%s%d", + mapname, delim, j+1)) { + fprintf(stderr, "partname too small\n"); @@ -417,7 +417,7 @@ main(int argc, char **argv){ - } - strip_slash(partname); - + } + strip_slash(partname); + - if (!slices[j].size || !dm_map_present(partname)) + if (!dm_map_present(partname)) - continue; - - if (!dm_simplecmd(DM_DEVICE_REMOVE, partname, + continue; + + if (!dm_simplecmd(DM_DEVICE_REMOVE, partname, diff --git a/SOURCES/0126-RHBZ-1211383-alias-collision.patch b/SOURCES/0126-RHBZ-1211383-alias-collision.patch index ff7b88b1..965bf538 100644 --- a/SOURCES/0126-RHBZ-1211383-alias-collision.patch +++ b/SOURCES/0126-RHBZ-1211383-alias-collision.patch @@ -10,57 +10,57 @@ Index: multipath-tools-130222/libmultipath/configure.c --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -422,6 +422,9 @@ select_action (struct multipath * mpp, v - condlog(2, "%s: unable to rename %s to %s (%s is used by %s)", - mpp->wwid, cmpp->alias, mpp->alias, - mpp->alias, cmpp_by_name->wwid); + condlog(2, "%s: unable to rename %s to %s (%s is used by %s)", + mpp->wwid, cmpp->alias, mpp->alias, + mpp->alias, cmpp_by_name->wwid); + /* reset alias to existing alias */ + FREE(mpp->alias); + mpp->alias = STRDUP(cmpp->alias); - mpp->action = ACT_NOTHING; - return; - } + mpp->action = ACT_NOTHING; + return; + } Index: multipath-tools-130222/libmultipath/config.c =================================================================== --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -675,6 +675,7 @@ load_config (char * file, struct udev *u - conf->processed_main_config = 0; - conf->retrigger_tries = DEFAULT_RETRIGGER_TRIES; - conf->retrigger_delay = DEFAULT_RETRIGGER_DELAY; + conf->processed_main_config = 0; + conf->retrigger_tries = DEFAULT_RETRIGGER_TRIES; + conf->retrigger_delay = DEFAULT_RETRIGGER_DELAY; + conf->new_bindings_in_boot = 0; - - /* - * preload default hwtable + + /* + * preload default hwtable @@ -794,6 +795,9 @@ load_config (char * file, struct udev *u - if (conf->ignore_new_boot_devs) - in_initrd(); - + if (conf->ignore_new_boot_devs) + in_initrd(); + + if (conf->new_bindings_in_boot == 0 && in_initrd()) + conf->bindings_read_only = 1; + - return 0; + return 0; out: - free_config(conf); + free_config(conf); Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -141,6 +141,7 @@ struct config { - int delay_wait_checks; - int retrigger_tries; - int retrigger_delay; + int delay_wait_checks; + int retrigger_tries; + int retrigger_delay; + int new_bindings_in_boot; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/libmultipath/dict.c =================================================================== --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -871,6 +871,29 @@ def_retrigger_delay_handler(vector strve - return 0; + return 0; } - + +static int +def_new_bindings_in_boot_handler(vector strvec) +{ @@ -89,7 +89,7 @@ Index: multipath-tools-130222/libmultipath/dict.c */ @@ -3238,6 +3261,15 @@ snprint_def_retrigger_delay (char * buff } - + static int +snprint_def_new_bindings_in_boot(char * buff, int len, void * data) +{ @@ -102,12 +102,12 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_ble_simple (char * buff, int len, void * data) { - struct blentry * ble = (struct blentry *)data; + struct blentry * ble = (struct blentry *)data; @@ -3313,6 +3345,7 @@ init_keywords(void) - install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks); - install_keyword("retrigger_tries", &def_retrigger_tries_handler, &snprint_def_retrigger_tries); - install_keyword("retrigger_delay", &def_retrigger_delay_handler, &snprint_def_retrigger_delay); + install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks); + install_keyword("retrigger_tries", &def_retrigger_tries_handler, &snprint_def_retrigger_tries); + install_keyword("retrigger_delay", &def_retrigger_delay_handler, &snprint_def_retrigger_delay); + install_keyword("new_bindings_in_boot", &def_new_bindings_in_boot_handler, &snprint_def_new_bindings_in_boot); - __deprecated install_keyword("default_selector", &def_selector_handler, NULL); - __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); - __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); + __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); diff --git a/SOURCES/0128-RHBZ-1222123-mpathconf-allow.patch b/SOURCES/0128-RHBZ-1222123-mpathconf-allow.patch index fd2d982c..a48d8ae2 100644 --- a/SOURCES/0128-RHBZ-1222123-mpathconf-allow.patch +++ b/SOURCES/0128-RHBZ-1222123-mpathconf-allow.patch @@ -15,32 +15,32 @@ Index: multipath-tools-130222/multipath/mpathconf @@ -17,12 +17,14 @@ # This program was largely ripped off from lvmconf # - + -unset ENABLE FIND FRIENDLY MODULE MULTIPATHD HAVE_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_DEFAULTS HAVE_FRIENDLY HAVE_MULTIPATHD HAVE_MODULE SHOW_STATUS CHANGED_CONFIG +unset ENABLE FIND FRIENDLY MODULE MULTIPATHD HAVE_DISABLE HAVE_WWID_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_EXCEPTIONS HAVE_DEFAULTS HAVE_FRIENDLY HAVE_MULTIPATHD HAVE_MODULE HAVE_OUTFILE SHOW_STATUS CHANGED_CONFIG WWID_LIST - + DEFAULT_CONFIGFILE="/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf" CONFIGFILE="/etc/multipath.conf" +OUTPUTFILE="/etc/multipath.conf" MULTIPATHDIR="/etc/multipath" TMPFILE=/etc/multipath/.multipath.conf.tmp +WWIDS=0 - + function usage { @@ -31,13 +33,60 @@ function usage - echo "Commands:" - echo "Enable: --enable " - echo "Disable: --disable" + echo "Commands:" + echo "Enable: --enable " + echo "Disable: --disable" + echo "Only allow certain wwids (instead of enable): --allow " - echo "Set user_friendly_names (Default y): --user_friendly_names " - echo "Set find_multipaths (Default y): --find_multipaths " - echo "Load the dm-multipath modules on enable (Default y): --with_module " - echo "start/stop/reload multipathd (Default n): --with_multipathd " + echo "Set user_friendly_names (Default y): --user_friendly_names " + echo "Set find_multipaths (Default y): --find_multipaths " + echo "Load the dm-multipath modules on enable (Default y): --with_module " + echo "start/stop/reload multipathd (Default n): --with_multipathd " + echo "select output file (Default /etc/multipath.conf): --outfile " - echo "" + echo "" } - + +function get_dm_deps +{ + shift 3 @@ -88,11 +88,11 @@ Index: multipath-tools-130222/multipath/mpathconf + function parse_args { - while [ -n "$1" ]; do + while [ -n "$1" ]; do @@ -50,6 +99,16 @@ function parse_args - ENABLE=0 - shift - ;; + ENABLE=0 + shift + ;; + --allow) + ENABLE=2 + if [ -n "$2" ]; then @@ -103,13 +103,13 @@ Index: multipath-tools-130222/multipath/mpathconf + exit 1 + fi + ;; - --user_friendly_names) - if [ -n "$2" ]; then - FRIENDLY=$2 + --user_friendly_names) + if [ -n "$2" ]; then + FRIENDLY=$2 @@ -86,6 +145,16 @@ function parse_args - exit 1 - fi - ;; + exit 1 + fi + ;; + --outfile) + if [ -n "$2" ]; then + OUTPUTFILE=$2 @@ -120,13 +120,13 @@ Index: multipath-tools-130222/multipath/mpathconf + exit 1 + fi + ;; - *) - usage - exit + *) + usage + exit @@ -120,6 +189,22 @@ function validate_args - echo "--with_multipathd must be either 'y' or 'n'" - exit 1 - fi + echo "--with_multipathd must be either 'y' or 'n'" + exit 1 + fi + if [ "$ENABLE" = 2 -a -z "$HAVE_OUTFILE" ]; then + echo "Because --allow makes changes that cannot be automatically reversed," + echo "you must set --outfile when you set --allow" @@ -144,29 +144,29 @@ Index: multipath-tools-130222/multipath/mpathconf + done + echo "}" >> $TMPFILE } - + umask 0077 @@ -146,6 +231,10 @@ if grep -q "^blacklist[[:space:]]*{" $TM - HAVE_BLACKLIST=1 + HAVE_BLACKLIST=1 fi - + +if grep -q "^blacklist_exceptions[[:space:]]*{" $TMPFILE ; then + HAVE_EXCEPTIONS=1 +fi + if grep -q "^defaults[[:space:]]*{" $TMPFILE ; then - HAVE_DEFAULTS=1 + HAVE_DEFAULTS=1 fi @@ -169,11 +258,19 @@ fi if [ "$HAVE_BLACKLIST" = "1" ]; then - if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode \"\.\?\*\"" ; then - HAVE_DISABLE=1 + if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode \"\.\?\*\"" ; then + HAVE_DISABLE=1 - elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[#[:space:]]*devnode \"\.\?\*\"" ; then + elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"" ; then - HAVE_DISABLE=0 - fi + HAVE_DISABLE=0 + fi fi - + +if [ "$HAVE_BLACKLIST" = "1" ]; then + if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*wwid \"\.\?\*\"" ; then + HAVE_WWID_DISABLE=1 @@ -176,12 +176,12 @@ Index: multipath-tools-130222/multipath/mpathconf +fi + if [ "$HAVE_DEFAULTS" = "1" ]; then - if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)" ; then - HAVE_FIND=1 + if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)" ; then + HAVE_FIND=1 @@ -241,17 +338,33 @@ defaults { _EOF_ fi - + -if [ "$ENABLE" = 1 ]; then +if [ "$ENABLE" = 2 ]; then + if [ "$HAVE_DISABLE" = 1 ]; then @@ -200,40 +200,41 @@ Index: multipath-tools-130222/multipath/mpathconf + echo $HAVE_WWID_DISABLE + add_blacklist_exceptions +elif [ "$ENABLE" = 1 ]; then - if [ "$HAVE_DISABLE" = 1 ]; then - sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE - fi + if [ "$HAVE_DISABLE" = 1 ]; then + sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE + fi elif [ "$ENABLE" = 0 ]; then - if [ -z "$HAVE_DISABLE" ]; then - sed -i '/^blacklist[[:space:]]*{/ a\ + if [ -z "$HAVE_DISABLE" ]; then + sed -i '/^blacklist[[:space:]]*{/ a\ - devnode "*" + devnode ".*" ' $TMPFILE - elif [ "$HAVE_DISABLE" = 0 ]; then + elif [ "$HAVE_DISABLE" = 0 ]; then - sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[#[:space:]]*devnode \"\.\?\*\"/ devnode ".*"/' $TMPFILE + sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"/ devnode ".*"/' $TMPFILE - fi + fi fi - + @@ -289,17 +402,17 @@ elif [ "$FRIENDLY" = "y" ]; then - fi + fi fi - + -if [ -f "$CONFIGFILE" ]; then - cp $CONFIGFILE $CONFIGFILE.old +if [ -f "$OUTPUTFILE" ]; then + cp $OUTPUTFILE $OUTPUTFILE.old - if [ $? != 0 ]; then + if [ $? != 0 ]; then - echo "failed to backup old config file, $CONFIGFILE not updated" + echo "failed to backup old config file, $OUTPUTFILE not updated" - exit 1 - fi + exit 1 + fi fi - + -cp $TMPFILE $CONFIGFILE +cp $TMPFILE $OUTPUTFILE if [ $? != 0 ]; then - echo "failed to copy new config file into place, check $CONFIGFILE is still OK" + echo "failed to copy new config file into place, check $OUTPUTFILE is still OK" - exit 1 + exit 1 fi + diff --git a/SOURCES/0129-UPBZ-1254292-iscsi-targetname.patch b/SOURCES/0129-UPBZ-1254292-iscsi-targetname.patch index 9e7f4157..26a68310 100644 --- a/SOURCES/0129-UPBZ-1254292-iscsi-targetname.patch +++ b/SOURCES/0129-UPBZ-1254292-iscsi-targetname.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/libmultipath/discovery.c --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -280,6 +280,8 @@ sysfs_get_tgt_nodename (struct path *pp, - const char *value; - - value = udev_device_get_sysattr_value(tgtdev, "tgtname"); + const char *value; + + value = udev_device_get_sysattr_value(tgtdev, "tgtname"); + if (!value) + value = udev_device_get_sysattr_value(tgtdev, "targetname"); - if (value) { - pp->sg_id.proto_id = SCSI_PROTOCOL_ISCSI; - pp->sg_id.transport_id = tgtid; + if (value) { + pp->sg_id.proto_id = SCSI_PROTOCOL_ISCSI; + pp->sg_id.transport_id = tgtid; diff --git a/SOURCES/0130-RHBZ-1259523-host_name_len.patch b/SOURCES/0130-RHBZ-1259523-host_name_len.patch index ce76a704..1460550f 100644 --- a/SOURCES/0130-RHBZ-1259523-host_name_len.patch +++ b/SOURCES/0130-RHBZ-1259523-host_name_len.patch @@ -13,5 +13,5 @@ Index: multipath-tools-130222/libmultipath/structs.h -#define HOST_NAME_LEN 8 +#define HOST_NAME_LEN 16 #define SLOT_NAME_SIZE 40 - + #define SCSI_VENDOR_SIZE 9 diff --git a/SOURCES/0131-UPBZ-1259831-lock-retry.patch b/SOURCES/0131-UPBZ-1259831-lock-retry.patch index 2be97fc5..3f5bd4da 100644 --- a/SOURCES/0131-UPBZ-1259831-lock-retry.patch +++ b/SOURCES/0131-UPBZ-1259831-lock-retry.patch @@ -7,17 +7,17 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -462,6 +462,7 @@ ev_add_path (struct path * pp, struct ve - char params[PARAMS_SIZE] = {0}; - int retries = 3; - int start_waiter = 0; + char params[PARAMS_SIZE] = {0}; + int retries = 3; + int start_waiter = 0; + int ret; - - /* - * need path UID to go any further + + /* + * need path UID to go any further @@ -540,7 +541,15 @@ rescan: - /* - * reload the map for the multipath mapped device - */ + /* + * reload the map for the multipath mapped device + */ - if (domap(mpp, params) <= 0) { +retry: + ret = domap(mpp, params); @@ -28,6 +28,6 @@ Index: multipath-tools-130222/multipathd/main.c + sleep(1); + goto retry; + } - condlog(0, "%s: failed in domap for addition of new " - "path %s", mpp->alias, pp->dev); - /* + condlog(0, "%s: failed in domap for addition of new " + "path %s", mpp->alias, pp->dev); + /* diff --git a/SOURCES/0132-RHBZ-1296979-fix-define.patch b/SOURCES/0132-RHBZ-1296979-fix-define.patch index 3d91a9da..cc507228 100644 --- a/SOURCES/0132-RHBZ-1296979-fix-define.patch +++ b/SOURCES/0132-RHBZ-1296979-fix-define.patch @@ -7,11 +7,11 @@ Index: multipath-bz1296979/libmultipath/Makefile --- multipath-bz1296979.orig/libmultipath/Makefile +++ multipath-bz1296979/libmultipath/Makefile @@ -30,7 +30,7 @@ ifneq ($(strip $(LIBDM_API_COOKIE)),0) - CFLAGS += -DLIBDM_API_COOKIE + CFLAGS += -DLIBDM_API_COOKIE endif - + -LIBUDEV_API_RECVBUF = $(shell grep -Ecs '^[a-z]*[[:space:]]+udev_monitor_set_resolve_buffer_size' /usr/include/libudev.h) +LIBUDEV_API_RECVBUF = $(shell grep -Ecs '^[a-z]*[[:space:]]+udev_monitor_set_receive_buffer_size' /usr/include/libudev.h) - + ifneq ($(strip $(LIBUDEV_API_RECVBUF)),0) - CFLAGS += -DLIBUDEV_API_RECVBUF + CFLAGS += -DLIBUDEV_API_RECVBUF diff --git a/SOURCES/0133-RHBZ-1241774-sun-partition-numbering.patch b/SOURCES/0133-RHBZ-1241774-sun-partition-numbering.patch index 458efb39..1cf555f1 100644 --- a/SOURCES/0133-RHBZ-1241774-sun-partition-numbering.patch +++ b/SOURCES/0133-RHBZ-1241774-sun-partition-numbering.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/kpartx/sun.c --- multipath-tools-130222.orig/kpartx/sun.c +++ multipath-tools-130222/kpartx/sun.c @@ -82,8 +82,6 @@ read_sun_pt(int fd, struct slice all, st - for(i=0, n=0; ipartitions[i]; - + for(i=0, n=0; ipartitions[i]; + - if (s->num_sectors == 0) - continue; - if (n < ns) { - sp[n].start = offset + - be32_to_cpu(s->start_cylinder) * be16_to_cpu(l->nsect) * be16_to_cpu(l->ntrks); + if (n < ns) { + sp[n].start = offset + + be32_to_cpu(s->start_cylinder) * be16_to_cpu(l->nsect) * be16_to_cpu(l->ntrks); diff --git a/SOURCES/0134-RHBZ-1241528-check-mpath-prefix.patch b/SOURCES/0134-RHBZ-1241528-check-mpath-prefix.patch index 6824b191..9701a365 100644 --- a/SOURCES/0134-RHBZ-1241528-check-mpath-prefix.patch +++ b/SOURCES/0134-RHBZ-1241528-check-mpath-prefix.patch @@ -1,7 +1,7 @@ --- libmpathpersist/mpath_persist.c | 4 +- libmultipath/devmapper.c | 67 +++++++++++++++++++++++++++++----------- - libmultipath/devmapper.h | 1 + libmultipath/devmapper.h | 1 multipathd/main.c | 2 - 4 files changed, 53 insertions(+), 21 deletions(-) @@ -10,31 +10,31 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c --- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c +++ multipath-tools-130222/libmpathpersist/mpath_persist.c @@ -160,7 +160,7 @@ int mpath_persistent_reserve_in (int fd, - - condlog(3, "alias = %s", alias); - map_present = dm_map_present(alias); + + condlog(3, "alias = %s", alias); + map_present = dm_map_present(alias); - if (map_present && dm_type(alias, TGT_MPATH) <= 0){ + if (map_present && !dm_is_mpath(alias)){ - condlog( 0, "%s: not a multipath device.", alias); - ret = MPATH_PR_DMMP_ERROR; - goto out; + condlog( 0, "%s: not a multipath device.", alias); + ret = MPATH_PR_DMMP_ERROR; + goto out; @@ -250,7 +250,7 @@ int mpath_persistent_reserve_out ( int f - condlog(3, "alias = %s", alias); - map_present = dm_map_present(alias); - + condlog(3, "alias = %s", alias); + map_present = dm_map_present(alias); + - if (map_present && dm_type(alias, TGT_MPATH) <= 0){ + if (map_present && !dm_is_mpath(alias)){ - condlog(3, "%s: not a multipath device.", alias); - ret = MPATH_PR_DMMP_ERROR; - goto out; + condlog(3, "%s: not a multipath device.", alias); + ret = MPATH_PR_DMMP_ERROR; + goto out; Index: multipath-tools-130222/libmultipath/devmapper.c =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -564,6 +564,48 @@ out: - return r; + return r; } - + +extern int +dm_is_mpath(const char * name) +{ @@ -82,65 +82,65 @@ Index: multipath-tools-130222/libmultipath/devmapper.c { @@ -672,10 +714,7 @@ _dm_flush_map (const char * mapname, int { - int r; - + int r; + - if (!dm_map_present(mapname)) - return 0; - - if (dm_type(mapname, TGT_MPATH) <= 0) + if (!dm_is_mpath(mapname)) - return 0; /* nothing to do */ - - if (dm_remove_partmaps(mapname, need_sync, deferred_remove)) + return 0; /* nothing to do */ + + if (dm_remove_partmaps(mapname, need_sync, deferred_remove)) @@ -725,10 +764,7 @@ dm_suspend_and_flush_map (const char * m - unsigned long long mapsize; - char params[PARAMS_SIZE] = {0}; - + unsigned long long mapsize; + char params[PARAMS_SIZE] = {0}; + - if (!dm_map_present(mapname)) - return 0; - - if (dm_type(mapname, TGT_MPATH) <= 0) + if (!dm_is_mpath(mapname)) - return 0; /* nothing to do */ - - if (!dm_get_map(mapname, &mapsize, params)) { + return 0; /* nothing to do */ + + if (!dm_get_map(mapname, &mapsize, params)) { @@ -899,7 +935,6 @@ dm_get_maps (vector mp) { - struct multipath * mpp; - int r = 1; + struct multipath * mpp; + int r = 1; - int info; - struct dm_task *dmt; - struct dm_names *names; - unsigned next = 0; + struct dm_task *dmt; + struct dm_names *names; + unsigned next = 0; @@ -924,9 +959,7 @@ dm_get_maps (vector mp) - } - - do { + } + + do { - info = dm_type(names->name, TGT_MPATH); - - if (info <= 0) + if (!dm_is_mpath(names->name)) - goto next; - - mpp = alloc_multipath(); + goto next; + + mpp = alloc_multipath(); @@ -939,13 +972,11 @@ dm_get_maps (vector mp) - if (!mpp->alias) - goto out1; - + if (!mpp->alias) + goto out1; + - if (info > 0) { - if (dm_get_map(names->name, &mpp->size, NULL)) - goto out1; + if (dm_get_map(names->name, &mpp->size, NULL)) + goto out1; - + - dm_get_uuid(names->name, mpp->wwid); - dm_get_info(names->name, &mpp->dmi); - } + dm_get_uuid(names->name, mpp->wwid); + dm_get_info(names->name, &mpp->dmi); - - if (!vector_alloc_slot(mp)) - goto out1; + + if (!vector_alloc_slot(mp)) + goto out1; Index: multipath-tools-130222/libmultipath/devmapper.h =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.h @@ -158,11 +158,11 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -285,7 +285,7 @@ ev_add_map (char * dev, char * alias, st - - map_present = dm_map_present(alias); - + + map_present = dm_map_present(alias); + - if (map_present && dm_type(alias, TGT_MPATH) <= 0) { + if (map_present && !dm_is_mpath(alias)) { - condlog(4, "%s: not a multipath map", alias); - return 0; - } + condlog(4, "%s: not a multipath map", alias); + return 0; + } diff --git a/SOURCES/0135-RHBZ-1299600-path-dev-uevents.patch b/SOURCES/0135-RHBZ-1299600-path-dev-uevents.patch index bd85cbae..2de58a4e 100644 --- a/SOURCES/0135-RHBZ-1299600-path-dev-uevents.patch +++ b/SOURCES/0135-RHBZ-1299600-path-dev-uevents.patch @@ -15,13 +15,13 @@ Index: multipath-tools-130222/libmultipath/configure.c #include "uxsock.h" #include "wwids.h" +#include "sysfs.h" - + /* group paths in pg by host adapter */ @@ -569,6 +570,29 @@ fail: - return 1; + return 1; } - + +void +trigger_uevents (struct multipath *mpp) +{ @@ -49,53 +49,53 @@ Index: multipath-tools-130222/libmultipath/configure.c * Return value: */ @@ -658,8 +682,10 @@ domap (struct multipath * mpp, char * pa - * DM_DEVICE_CREATE, DM_DEVICE_RENAME, or DM_DEVICE_RELOAD - * succeeded - */ + * DM_DEVICE_CREATE, DM_DEVICE_RENAME, or DM_DEVICE_RELOAD + * succeeded + */ - if (mpp->action == ACT_CREATE) - remember_wwid(mpp->wwid); + if (mpp->action == ACT_CREATE) { + if (remember_wwid(mpp->wwid) == 1) + trigger_uevents(mpp); + } - if (!conf->daemon) { - /* multipath client mode */ - dm_switchgroup(mpp->alias, mpp->bestpg); + if (!conf->daemon) { + /* multipath client mode */ + dm_switchgroup(mpp->alias, mpp->bestpg); Index: multipath-tools-130222/libmultipath/wwids.c =================================================================== --- multipath-tools-130222.orig/libmultipath/wwids.c +++ multipath-tools-130222/libmultipath/wwids.c @@ -310,7 +310,7 @@ remember_wwid(char *wwid) - } - else - condlog(4, "wwid %s already in wwids file", wwid); + } + else + condlog(4, "wwid %s already in wwids file", wwid); - return 0; + return ret; } - + int remember_cmdline_wwid(void) @@ -344,7 +344,7 @@ int remember_cmdline_wwid(void) - next++; - } - if (strlen(ptr)) { + next++; + } + if (strlen(ptr)) { - if (remember_wwid(ptr) != 0) + if (remember_wwid(ptr) < 0) - ret = -1; - } - else { + ret = -1; + } + else { Index: multipath-tools-130222/multipath/main.c =================================================================== --- multipath-tools-130222.orig/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -303,7 +303,7 @@ configure (void) - } - if (conf->cmd == CMD_ADD_WWID) { - r = remember_wwid(refwwid); + } + if (conf->cmd == CMD_ADD_WWID) { + r = remember_wwid(refwwid); - if (r == 0) + if (r >= 0) - printf("wwid '%s' added\n", refwwid); - else - printf("failed adding '%s' to wwids file\n", + printf("wwid '%s' added\n", refwwid); + else + printf("failed adding '%s' to wwids file\n", Index: multipath-tools-130222/libmultipath/configure.h =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.h @@ -110,11 +110,12 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -1435,7 +1435,8 @@ configure (struct vectors * vecs, int st - - sync_maps_state(mpvec); - vector_foreach_slot(mpvec, mpp, i){ + + sync_maps_state(mpvec); + vector_foreach_slot(mpvec, mpp, i){ - remember_wwid(mpp->wwid); + if (remember_wwid(mpp->wwid) > 0) + trigger_uevents(mpp); - update_map_pr(mpp); - } + update_map_pr(mpp); + } + diff --git a/SOURCES/0136-RHBZ-1304687-wait-for-map-add.patch b/SOURCES/0136-RHBZ-1304687-wait-for-map-add.patch index 5796dcc0..dbada980 100644 --- a/SOURCES/0136-RHBZ-1304687-wait-for-map-add.patch +++ b/SOURCES/0136-RHBZ-1304687-wait-for-map-add.patch @@ -1,15 +1,15 @@ --- - libmultipath/config.c | 1 - libmultipath/config.h | 2 + libmultipath/config.c | 1 + libmultipath/config.h | 2 libmultipath/configure.c | 4 + - libmultipath/defaults.h | 1 + libmultipath/defaults.h | 1 libmultipath/dict.c | 25 ++++++++ - libmultipath/structs.h | 2 - multipath.conf.defaults | 1 + libmultipath/structs.h | 2 + multipath.conf.defaults | 1 multipath/multipath.conf.5 | 8 ++ multipathd/cli_handlers.c | 65 ++++++++++++++++++---- multipathd/main.c | 132 +++++++++++++++++++++++++++++++++++++++++++-- - multipathd/main.h | 1 + multipathd/main.h | 1 11 files changed, 229 insertions(+), 13 deletions(-) Index: multipath-tools-130222/libmultipath/configure.c @@ -17,142 +17,142 @@ Index: multipath-tools-130222/libmultipath/configure.c --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -701,6 +701,10 @@ domap (struct multipath * mpp, char * pa - */ - if (mpp->action != ACT_CREATE) - mpp->action = ACT_NOTHING; + */ + if (mpp->action != ACT_CREATE) + mpp->action = ACT_NOTHING; + else { + mpp->wait_for_udev = 1; + mpp->uev_wait_tick = conf->uev_wait_timeout; + } - } - dm_setgeometry(mpp); - return DOMAP_OK; + } + dm_setgeometry(mpp); + return DOMAP_OK; Index: multipath-tools-130222/libmultipath/structs.h =================================================================== --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -217,6 +217,8 @@ struct multipath { - int bestpg; - int queuedio; - int action; + int bestpg; + int queuedio; + int action; + int wait_for_udev; + int uev_wait_tick; - int pgfailback; - int failback_tick; - int rr_weight; + int pgfailback; + int failback_tick; + int rr_weight; Index: multipath-tools-130222/multipathd/cli_handlers.c =================================================================== --- multipath-tools-130222.orig/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -548,6 +548,11 @@ cli_reload(void *v, char **reply, int *l - condlog(0, "%s: invalid map name. cannot reload", mapname); - return 1; - } + condlog(0, "%s: invalid map name. cannot reload", mapname); + return 1; + } + if (mpp->wait_for_udev) { + condlog(2, "%s: device not fully created, failing reload", + mpp->alias); + return 1; + } - - return reload_map(vecs, mpp, 0); + + return reload_map(vecs, mpp, 0); } @@ -592,6 +597,12 @@ cli_resize(void *v, char **reply, int *l - return 1; - } - + return 1; + } + + if (mpp->wait_for_udev) { + condlog(2, "%s: device not fully created, failing resize", + mpp->alias); + return 1; + } + - pgp = VECTOR_SLOT(mpp->pg, 0); - - if (!pgp){ + pgp = VECTOR_SLOT(mpp->pg, 0); + + if (!pgp){ @@ -756,6 +767,12 @@ cli_reconfigure(void * v, char ** reply, { - struct vectors * vecs = (struct vectors *)data; - + struct vectors * vecs = (struct vectors *)data; + + if (need_to_delay_reconfig(vecs)) { + conf->delayed_reconfig = 1; + condlog(2, "delaying reconfigure (operator)"); + return 0; + } + - condlog(2, "reconfigure (operator)"); - - return reconfigure(vecs); + condlog(2, "reconfigure (operator)"); + + return reconfigure(vecs); @@ -766,17 +783,25 @@ cli_suspend(void * v, char ** reply, int { - struct vectors * vecs = (struct vectors *)data; - char * param = get_keyparam(v, MAP); + struct vectors * vecs = (struct vectors *)data; + char * param = get_keyparam(v, MAP); - int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param, 0); + int r; + struct multipath * mpp; - - param = convert_dev(param, 0); + + param = convert_dev(param, 0); - condlog(2, "%s: suspend (operator)", param); + mpp = find_mp_by_alias(vecs->mpvec, param); + if (!mpp) + return 1; - + - if (!r) /* error */ + if (mpp->wait_for_udev) { + condlog(2, "%s: device not fully created, failing suspend", + mpp->alias); - return 1; + return 1; + } - + - struct multipath * mpp = find_mp_by_alias(vecs->mpvec, param); + r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param, 0); - + - if (!mpp) + condlog(2, "%s: suspend (operator)", param); + + if (!r) /* error */ - return 1; - - dm_get_info(param, &mpp->dmi); + return 1; + + dm_get_info(param, &mpp->dmi); @@ -788,17 +813,25 @@ cli_resume(void * v, char ** reply, int { - struct vectors * vecs = (struct vectors *)data; - char * param = get_keyparam(v, MAP); + struct vectors * vecs = (struct vectors *)data; + char * param = get_keyparam(v, MAP); - int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param, 0); + int r; + struct multipath * mpp; - - param = convert_dev(param, 0); + + param = convert_dev(param, 0); - condlog(2, "%s: resume (operator)", param); + mpp = find_mp_by_alias(vecs->mpvec, param); + if (!mpp) + return 1; - + - if (!r) /* error */ + if (mpp->wait_for_udev) { + condlog(2, "%s: device not fully created, failing resume", + mpp->alias); - return 1; + return 1; + } - + - struct multipath * mpp = find_mp_by_alias(vecs->mpvec, param); + r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param, 0); - + - if (!mpp) + condlog(2, "%s: resume (operator)", param); + + if (!r) /* error */ - return 1; - - dm_get_info(param, &mpp->dmi); + return 1; + + dm_get_info(param, &mpp->dmi); @@ -831,9 +864,21 @@ cli_reinstate(void * v, char ** reply, i int cli_reassign (void * v, char ** reply, int * len, void * data) { + struct vectors * vecs = (struct vectors *)data; - char * param = get_keyparam(v, MAP); + char * param = get_keyparam(v, MAP); + struct multipath *mpp; - - param = convert_dev(param, 0); + + param = convert_dev(param, 0); + mpp = find_mp_by_alias(vecs->mpvec, param); + if (!mpp) + return 1; @@ -163,30 +163,30 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c + return 1; + } + - condlog(3, "%s: reset devices (operator)", param); - - dm_reassign(param); + condlog(3, "%s: reset devices (operator)", param); + + dm_reassign(param); Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -142,6 +142,8 @@ struct config { - int retrigger_tries; - int retrigger_delay; - int new_bindings_in_boot; + int retrigger_tries; + int retrigger_delay; + int new_bindings_in_boot; + int delayed_reconfig; + int uev_wait_timeout; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -251,6 +251,47 @@ flush_map(struct multipath * mpp, struct - return 0; + return 0; } - + +int +update_map (struct multipath *mpp, struct vectors *vecs) +{ @@ -232,9 +232,9 @@ Index: multipath-tools-130222/multipathd/main.c uev_add_map (struct uevent * uev, struct vectors * vecs) { @@ -293,6 +334,20 @@ ev_add_map (char * dev, char * alias, st - mpp = find_mp_by_alias(vecs->mpvec, alias); - - if (mpp) { + mpp = find_mp_by_alias(vecs->mpvec, alias); + + if (mpp) { + if (mpp->wait_for_udev > 1) { + if (update_map(mpp, vecs)) + /* setup multipathd removed the map */ @@ -249,13 +249,13 @@ Index: multipath-tools-130222/multipathd/main.c + return 0; + } + } - /* - * Not really an error -- we generate our own uevent - * if we create a multipath mapped device as a result + /* + * Not really an error -- we generate our own uevent + * if we create a multipath mapped device as a result @@ -471,7 +526,14 @@ ev_add_path (struct path * pp, struct ve - condlog(0, "%s: failed to get path uid", pp->dev); - goto fail; /* leave path added to pathvec */ - } + condlog(0, "%s: failed to get path uid", pp->dev); + goto fail; /* leave path added to pathvec */ + } - mpp = pp->mpp = find_mp_by_wwid(vecs->mpvec, pp->wwid); + mpp = find_mp_by_wwid(vecs->mpvec, pp->wwid); + if (mpp && mpp->wait_for_udev) { @@ -266,36 +266,36 @@ Index: multipath-tools-130222/multipathd/main.c + + pp->mpp = mpp; rescan: - if (mpp) { - if ((!pp->size) || (mpp->size != pp->size)) { + if (mpp) { + if ((!pp->size) || (mpp->size != pp->size)) { @@ -670,6 +732,12 @@ ev_remove_path (struct path *pp, struct - " removal of path %s", mpp->alias, pp->dev); - goto fail; - } + " removal of path %s", mpp->alias, pp->dev); + goto fail; + } + + if (mpp->wait_for_udev) { + mpp->wait_for_udev = 2; + goto out; + } + - /* - * reload the map - */ + /* + * reload the map + */ @@ -731,6 +799,11 @@ uev_update_path (struct uevent *uev, str - condlog(2, "%s: update path write_protect to '%d' (uevent)", - uev->kernel, ro); - if (pp->mpp) { + condlog(2, "%s: update path write_protect to '%d' (uevent)", + uev->kernel, ro); + if (pp->mpp) { + if (pp->mpp->wait_for_udev) { + pp->mpp->wait_for_udev = 2; + return 0; + } + - retval = reload_map(vecs, pp->mpp, 0); - - condlog(2, "%s: map %s reloaded (retval %d)", + retval = reload_map(vecs, pp->mpp, 0); + + condlog(2, "%s: map %s reloaded (retval %d)", @@ -1063,6 +1136,33 @@ followover_should_failback(struct path * } - + static void +missing_uev_wait_tick(struct vectors *vecs) +{ @@ -326,28 +326,28 @@ Index: multipath-tools-130222/multipathd/main.c +static void defered_failback_tick (vector mpvec) { - struct multipath * mpp; + struct multipath * mpp; @@ -1316,6 +1416,9 @@ check_path (struct vectors * vecs, struc - - pp->state = newstate; - + + pp->state = newstate; + + + if (pp->mpp->wait_for_udev) + return; - /* - * path prio refreshing - */ + /* + * path prio refreshing + */ @@ -1369,6 +1472,7 @@ checkerloop (void *ap) - if (vecs->mpvec) { - defered_failback_tick(vecs->mpvec); - retry_count_tick(vecs->mpvec); + if (vecs->mpvec) { + defered_failback_tick(vecs->mpvec); + retry_count_tick(vecs->mpvec); + missing_uev_wait_tick(vecs); - } - if (count) - count--; + } + if (count) + count--; @@ -1465,6 +1569,22 @@ configure (struct vectors * vecs, int st } - + int +need_to_delay_reconfig(struct vectors * vecs) +{ @@ -367,16 +367,16 @@ Index: multipath-tools-130222/multipathd/main.c +int reconfigure (struct vectors * vecs) { - struct config * old = conf; + struct config * old = conf; @@ -1544,12 +1664,18 @@ void handle_signals(void) { - if (reconfig_sig && running_state == DAEMON_RUNNING) { + if (reconfig_sig && running_state == DAEMON_RUNNING) { - condlog(2, "reconfigure (signal)"); - pthread_cleanup_push(cleanup_lock, - &gvecs->lock); - lock(gvecs->lock); - pthread_testcancel(); + pthread_cleanup_push(cleanup_lock, + &gvecs->lock); + lock(gvecs->lock); + pthread_testcancel(); - reconfigure(gvecs); + if (need_to_delay_reconfig(gvecs)) { + conf->delayed_reconfig = 1; @@ -386,15 +386,15 @@ Index: multipath-tools-130222/multipathd/main.c + condlog(2, "reconfigure (signal)"); + reconfigure(gvecs); + } - lock_cleanup_pop(gvecs->lock); - } - if (log_reset_sig) { + lock_cleanup_pop(gvecs->lock); + } + if (log_reset_sig) { Index: multipath-tools-130222/multipathd/main.h =================================================================== --- multipath-tools-130222.orig/multipathd/main.h +++ multipath-tools-130222/multipathd/main.h @@ -18,6 +18,7 @@ extern pid_t daemon_pid; - + void exit_daemon(void); const char * daemon_status(void); +int need_to_delay_reconfig (struct vectors *); @@ -406,13 +406,13 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -676,6 +676,7 @@ load_config (char * file, struct udev *u - conf->retrigger_tries = DEFAULT_RETRIGGER_TRIES; - conf->retrigger_delay = DEFAULT_RETRIGGER_DELAY; - conf->new_bindings_in_boot = 0; + conf->retrigger_tries = DEFAULT_RETRIGGER_TRIES; + conf->retrigger_delay = DEFAULT_RETRIGGER_DELAY; + conf->new_bindings_in_boot = 0; + conf->uev_wait_timeout = DEFAULT_UEV_WAIT_TIMEOUT; - - /* - * preload default hwtable + + /* + * preload default hwtable Index: multipath-tools-130222/libmultipath/defaults.h =================================================================== --- multipath-tools-130222.orig/libmultipath/defaults.h @@ -422,7 +422,7 @@ Index: multipath-tools-130222/libmultipath/defaults.h #define DEFAULT_RETRIGGER_DELAY 10 #define DEFAULT_RETRIGGER_TRIES 3 +#define DEFAULT_UEV_WAIT_TIMEOUT 30 - + #define DEFAULT_CHECKINT 5 #define MAX_CHECKINT(a) (a << 2) Index: multipath-tools-130222/libmultipath/dict.c @@ -431,7 +431,7 @@ Index: multipath-tools-130222/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -872,6 +872,24 @@ def_retrigger_delay_handler(vector strve } - + static int +def_uev_wait_timeout_handler(vector strvec) +{ @@ -453,10 +453,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int def_new_bindings_in_boot_handler(vector strvec) { - char * buff; + char * buff; @@ -3261,6 +3279,12 @@ snprint_def_retrigger_delay (char * buff } - + static int +snprint_def_uev_wait_timeout (char * buff, int len, void * data) +{ @@ -466,15 +466,15 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_def_new_bindings_in_boot(char * buff, int len, void * data) { - if (conf->new_bindings_in_boot == 1) + if (conf->new_bindings_in_boot == 1) @@ -3345,6 +3369,7 @@ init_keywords(void) - install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks); - install_keyword("retrigger_tries", &def_retrigger_tries_handler, &snprint_def_retrigger_tries); - install_keyword("retrigger_delay", &def_retrigger_delay_handler, &snprint_def_retrigger_delay); + install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks); + install_keyword("retrigger_tries", &def_retrigger_tries_handler, &snprint_def_retrigger_tries); + install_keyword("retrigger_delay", &def_retrigger_delay_handler, &snprint_def_retrigger_delay); + install_keyword("missing_uev_wait_timeout", &def_uev_wait_timeout_handler, &snprint_def_uev_wait_timeout); - install_keyword("new_bindings_in_boot", &def_new_bindings_in_boot_handler, &snprint_def_new_bindings_in_boot); - __deprecated install_keyword("default_selector", &def_selector_handler, NULL); - __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); + install_keyword("new_bindings_in_boot", &def_new_bindings_in_boot_handler, &snprint_def_new_bindings_in_boot); + __deprecated install_keyword("default_selector", &def_selector_handler, NULL); + __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); Index: multipath-tools-130222/multipath.conf.defaults =================================================================== --- multipath-tools-130222.orig/multipath.conf.defaults diff --git a/SOURCES/0137-RHBZ-1280524-clear-chkr-msg.patch b/SOURCES/0137-RHBZ-1280524-clear-chkr-msg.patch index d7f656cb..c05e28e3 100644 --- a/SOURCES/0137-RHBZ-1280524-clear-chkr-msg.patch +++ b/SOURCES/0137-RHBZ-1280524-clear-chkr-msg.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -1270,6 +1270,8 @@ check_path (struct vectors * vecs, struc - newstate = path_offline(pp); - if (newstate == PATH_UP) - newstate = get_state(pp, 1); + newstate = path_offline(pp); + if (newstate == PATH_UP) + newstate = get_state(pp, 1); + else + checker_clear_message(&pp->checker); - - if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) { - condlog(2, "%s: unusable path", pp->dev); + + if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) { + condlog(2, "%s: unusable path", pp->dev); diff --git a/SOURCES/0138-RHBZ-1288660-fix-mpathconf-allow.patch b/SOURCES/0138-RHBZ-1288660-fix-mpathconf-allow.patch index fa64f9ae..9050fc7d 100644 --- a/SOURCES/0138-RHBZ-1288660-fix-mpathconf-allow.patch +++ b/SOURCES/0138-RHBZ-1288660-fix-mpathconf-allow.patch @@ -7,9 +7,9 @@ Index: multipath-tools-130222/multipath/mpathconf --- multipath-tools-130222.orig/multipath/mpathconf +++ multipath-tools-130222/multipath/mpathconf @@ -42,6 +42,19 @@ function usage - echo "" + echo "" } - + +function add_wwid +{ + INDEX=0 @@ -25,52 +25,52 @@ Index: multipath-tools-130222/multipath/mpathconf + function get_dm_deps { - shift 3 + shift 3 @@ -59,11 +72,9 @@ function get_dm_deps function set_dm_wwid { - if [[ "$1" =~ ^part[[:digit:]]+-mpath- ]] ; then + if [[ "$1" =~ ^part[[:digit:]]+-mpath- ]] ; then - WWID_LIST[$WWIDS]="${1##part*-mpath-}" - ((WWIDS++)) + add_wwid "${1##part*-mpath-}" - elif [[ "$1" =~ ^mpath- ]] ; then + elif [[ "$1" =~ ^mpath- ]] ; then - WWID_LIST[$WWIDS]="${1##mpath-}" - ((WWIDS++)) + add_wwid "${1##mpath-}" - else - get_dm_deps `dmsetup deps -u $1` - fi + else + get_dm_deps `dmsetup deps -u $1` + fi @@ -82,8 +93,7 @@ function set_wwid - if [ -n "$UUID" ] ; then - set_dm_wwid $UUID - else + if [ -n "$UUID" ] ; then + set_dm_wwid $UUID + else - WWID_LIST[$WWIDS]="$1" - ((WWIDS++)) + add_wwid "$1" - fi + fi } - + @@ -198,13 +208,13 @@ function validate_args - + function add_blacklist_exceptions { - echo "blacklist_exceptions {" >> $TMPFILE - INDEX=0 - while [ "$INDEX" -lt "$WWIDS" ] ; do + INDEX=0 + while [ "$INDEX" -lt "$WWIDS" ] ; do - echo " wwid \"${WWID_LIST[$INDEX]}\"" >> $TMPFILE + sed -i '/^blacklist_exceptions[[:space:]]*{/ a\ + wwid '"\"${WWID_LIST[$INDEX]}\""' +' $TMPFILE - ((INDEX++)) - done + ((INDEX++)) + done - echo "}" >> $TMPFILE } - + umask 0077 @@ -350,9 +360,14 @@ if [ "$ENABLE" = 2 ]; then - sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"/ wwid ".*"/' $TMPFILE - fi - if [ "$HAVE_EXCEPTIONS" = 1 ]; then + sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"/ wwid ".*"/' $TMPFILE + fi + if [ "$HAVE_EXCEPTIONS" = 1 ]; then - sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/d' $TMPFILE + sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ {/^[[:space:]]*wwid/ d}' $TMPFILE + else @@ -79,8 +79,8 @@ Index: multipath-tools-130222/multipath/mpathconf +blacklist_exceptions { +} +_EOF_ - fi + fi - echo $HAVE_WWID_DISABLE - add_blacklist_exceptions + add_blacklist_exceptions elif [ "$ENABLE" = 1 ]; then - if [ "$HAVE_DISABLE" = 1 ]; then + if [ "$HAVE_DISABLE" = 1 ]; then diff --git a/SOURCES/0140-RHBZ-1299647-fix-help.patch b/SOURCES/0140-RHBZ-1299647-fix-help.patch index ce978fca..c504974e 100644 --- a/SOURCES/0140-RHBZ-1299647-fix-help.patch +++ b/SOURCES/0140-RHBZ-1299647-fix-help.patch @@ -7,10 +7,10 @@ Index: multipath-tools-130222/multipath/main.c --- multipath-tools-130222.orig/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -111,7 +111,6 @@ usage (char * progname) - " -r force devmap reload\n" \ - " -i ignore wwids file\n" \ - " -B treat the bindings file as read only\n" \ + " -r force devmap reload\n" \ + " -i ignore wwids file\n" \ + " -B treat the bindings file as read only\n" \ - " -p policy failover|multibus|group_by_serial|group_by_prio\n" \ - " -b fil bindings file location\n" \ - " -w remove a device from the wwids file\n" \ - " -W reset the wwids file include only the current devices\n" \ + " -b fil bindings file location\n" \ + " -w remove a device from the wwids file\n" \ + " -W reset the wwids file include only the current devices\n" \ diff --git a/SOURCES/0141-RHBZ-1303953-mpathpersist-typo.patch b/SOURCES/0141-RHBZ-1303953-mpathpersist-typo.patch index 2b5ca56b..75259022 100644 --- a/SOURCES/0141-RHBZ-1303953-mpathpersist-typo.patch +++ b/SOURCES/0141-RHBZ-1303953-mpathpersist-typo.patch @@ -7,10 +7,11 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c --- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c +++ multipath-tools-130222/libmpathpersist/mpath_persist.c @@ -822,7 +822,7 @@ int update_map_pr(struct multipath *mpp) - if (!mpp->reservation_key) - { - /* Nothing to do. Assuming pr mgmt feature is disabled*/ + if (!mpp->reservation_key) + { + /* Nothing to do. Assuming pr mgmt feature is disabled*/ - condlog(3, "%s: reservation_key not set in multiapth.conf", mpp->alias); + condlog(3, "%s: reservation_key not set in multipath.conf", mpp->alias); - return MPATH_PR_SUCCESS; - } + return MPATH_PR_SUCCESS; + } + diff --git a/SOURCES/0142-RHBZ-1283750-kpartx-fix.patch b/SOURCES/0142-RHBZ-1283750-kpartx-fix.patch index 49b3b76b..0bc21b8e 100644 --- a/SOURCES/0142-RHBZ-1283750-kpartx-fix.patch +++ b/SOURCES/0142-RHBZ-1283750-kpartx-fix.patch @@ -10,26 +10,26 @@ Index: multipath-tools-130222/kpartx/devmapper.c +++ multipath-tools-130222/kpartx/devmapper.c @@ -140,12 +140,16 @@ addout: } - + extern int -dm_map_present (char * str) +dm_map_present (char * str, char **uuid) { - int r = 0; - struct dm_task *dmt; + int r = 0; + struct dm_task *dmt; + const char *uuidtmp; - struct dm_info info; - + struct dm_info info; + + if (uuid) + *uuid = NULL; + - if (!(dmt = dm_task_create(DM_DEVICE_INFO))) - return 0; - + if (!(dmt = dm_task_create(DM_DEVICE_INFO))) + return 0; + @@ -160,8 +164,15 @@ dm_map_present (char * str) - if (!dm_task_get_info(dmt, &info)) - goto out; - + if (!dm_task_get_info(dmt, &info)) + goto out; + - if (info.exists) - r = 1; + if (!info.exists) @@ -42,8 +42,8 @@ Index: multipath-tools-130222/kpartx/devmapper.c + *uuid = strdup(uuidtmp); + } out: - dm_task_destroy(dmt); - return r; + dm_task_destroy(dmt); + return r; Index: multipath-tools-130222/kpartx/devmapper.h =================================================================== --- multipath-tools-130222.orig/kpartx/devmapper.h @@ -51,7 +51,7 @@ Index: multipath-tools-130222/kpartx/devmapper.h @@ -14,7 +14,7 @@ int dm_prereq (char *, int, int, int); int dm_simplecmd (int, const char *, int, uint32_t *, uint16_t); int dm_addmap (int, const char *, const char *, const char *, uint64_t, - int, const char *, int, mode_t, uid_t, gid_t, uint32_t *); + int, const char *, int, mode_t, uid_t, gid_t, uint32_t *); -int dm_map_present (char *); +int dm_map_present (char *, char **); char * dm_mapname(int major, int minor); @@ -62,9 +62,9 @@ Index: multipath-tools-130222/kpartx/kpartx.c --- multipath-tools-130222.orig/kpartx/kpartx.c +++ multipath-tools-130222/kpartx/kpartx.c @@ -191,6 +191,21 @@ get_hotplug_device(void) - return device; + return device; } - + +static int +check_uuid(char *uuid, char *part_uuid, char **err_msg) { + char *map_uuid = strchr(part_uuid, '-'); @@ -82,24 +82,24 @@ Index: multipath-tools-130222/kpartx/kpartx.c + int main(int argc, char **argv){ - int i, j, m, n, op, off, arg, ro=0; + int i, j, m, n, op, off, arg, ro=0; @@ -410,6 +425,8 @@ main(int argc, char **argv){ - - case DELETE: - for (j = MAXSLICES-1; j >= 0; j--) { + + case DELETE: + for (j = MAXSLICES-1; j >= 0; j--) { + char *part_uuid, *reason; + - if (safe_sprintf(partname, "%s%s%d", - mapname, delim, j+1)) { - fprintf(stderr, "partname too small\n"); + if (safe_sprintf(partname, "%s%s%d", + mapname, delim, j+1)) { + fprintf(stderr, "partname too small\n"); @@ -417,9 +434,18 @@ main(int argc, char **argv){ - } - strip_slash(partname); - + } + strip_slash(partname); + - if (!dm_map_present(partname)) + if (!dm_map_present(partname, &part_uuid)) - continue; - + continue; + + if (part_uuid && uuid) { + if (check_uuid(uuid, part_uuid, &reason) != 0) { + fprintf(stderr, "%s is %s. Not removing\n", partname, reason); @@ -109,26 +109,26 @@ Index: multipath-tools-130222/kpartx/kpartx.c + free(part_uuid); + } + - if (!dm_simplecmd(DM_DEVICE_REMOVE, partname, - 0, &cookie, 0)) { - r++; + if (!dm_simplecmd(DM_DEVICE_REMOVE, partname, + 0, &cookie, 0)) { + r++; @@ -444,6 +470,8 @@ main(int argc, char **argv){ - case UPDATE: - /* ADD and UPDATE share the same code that adds new partitions. */ - for (j = 0; j < n; j++) { + case UPDATE: + /* ADD and UPDATE share the same code that adds new partitions. */ + for (j = 0; j < n; j++) { + char *part_uuid, *reason; + - if (slices[j].size == 0) - continue; - + if (slices[j].size == 0) + continue; + @@ -460,9 +488,19 @@ main(int argc, char **argv){ - exit(1); - } - + exit(1); + } + - op = (dm_map_present(partname) ? + op = (dm_map_present(partname, &part_uuid) ? - DM_DEVICE_RELOAD : DM_DEVICE_CREATE); - + DM_DEVICE_RELOAD : DM_DEVICE_CREATE); + + if (part_uuid && uuid) { + if (check_uuid(uuid, part_uuid, &reason) != 0) { + fprintf(stderr, "%s is already in use, and %s\n", partname, reason); @@ -139,42 +139,42 @@ Index: multipath-tools-130222/kpartx/kpartx.c + free(part_uuid); + } + - if (!dm_addmap(op, partname, DM_TARGET, params, - slices[j].size, ro, uuid, j+1, - buf.st_mode & 0777, buf.st_uid, + if (!dm_addmap(op, partname, DM_TARGET, params, + slices[j].size, ro, uuid, j+1, + buf.st_mode & 0777, buf.st_uid, @@ -470,6 +508,7 @@ main(int argc, char **argv){ - fprintf(stderr, "create/reload failed on %s\n", - partname); - r++; + fprintf(stderr, "create/reload failed on %s\n", + partname); + r++; + continue; - } - if (op == DM_DEVICE_RELOAD && - !dm_simplecmd(DM_DEVICE_RESUME, partname, + } + if (op == DM_DEVICE_RELOAD && + !dm_simplecmd(DM_DEVICE_RESUME, partname, @@ -477,6 +516,7 @@ main(int argc, char **argv){ - fprintf(stderr, "resume failed on %s\n", - partname); - r++; + fprintf(stderr, "resume failed on %s\n", + partname); + r++; + continue; - } - dm_devn(partname, &slices[j].major, - &slices[j].minor); + } + dm_devn(partname, &slices[j].major, + &slices[j].minor); @@ -494,6 +534,7 @@ main(int argc, char **argv){ - } - - for (j = MAXSLICES-1; j >= 0; j--) { + } + + for (j = MAXSLICES-1; j >= 0; j--) { + char *part_uuid, *reason; - if (safe_sprintf(partname, "%s%s%d", - mapname, delim, j+1)) { - fprintf(stderr, "partname too small\n"); + if (safe_sprintf(partname, "%s%s%d", + mapname, delim, j+1)) { + fprintf(stderr, "partname too small\n"); @@ -501,9 +542,19 @@ main(int argc, char **argv){ - } - strip_slash(partname); - + } + strip_slash(partname); + - if (slices[j].size || !dm_map_present(partname)) + if (slices[j].size || + !dm_map_present(partname, &part_uuid)) - continue; - + continue; + + if (part_uuid && uuid) { + if (check_uuid(uuid, part_uuid, &reason) != 0) { + fprintf(stderr, "%s is %s. Not removing\n", partname, reason); @@ -184,6 +184,6 @@ Index: multipath-tools-130222/kpartx/kpartx.c + free(part_uuid); + } + - if (!dm_simplecmd(DM_DEVICE_REMOVE, - partname, 1, &cookie, 0)) { - r++; + if (!dm_simplecmd(DM_DEVICE_REMOVE, + partname, 1, &cookie, 0)) { + r++; diff --git a/SOURCES/0143-RHBZ-1299648-kpartx-sync.patch b/SOURCES/0143-RHBZ-1299648-kpartx-sync.patch index 75b3f3a0..5e9928d9 100644 --- a/SOURCES/0143-RHBZ-1299648-kpartx-sync.patch +++ b/SOURCES/0143-RHBZ-1299648-kpartx-sync.patch @@ -9,42 +9,42 @@ Index: multipath-tools-130222/kpartx/kpartx.c +++ multipath-tools-130222/kpartx/kpartx.c @@ -57,7 +57,7 @@ struct pt { } pts[MAXTYPES]; - + int ptct = 0; -int udev_sync = 0; +int udev_sync = 1; - + static void addpts(char *t, ptreader f) @@ -85,7 +85,7 @@ initpts(void) - addpts("ps3", read_ps3_pt); + addpts("ps3", read_ps3_pt); } - + -static char short_opts[] = "rladfgvp:t:su"; +static char short_opts[] = "rladfgvp:t:snu"; - + /* Used in gpt.c */ int force_gpt=0; @@ -104,7 +104,8 @@ usage(void) { - printf("\t-g force GUID partition table (GPT)\n"); - printf("\t-f force devmap create\n"); - printf("\t-v verbose\n"); + printf("\t-g force GUID partition table (GPT)\n"); + printf("\t-f force devmap create\n"); + printf("\t-v verbose\n"); - printf("\t-s sync mode. Don't return until the partitions are created\n"); + printf("\t-n nosync mode. Return before the partitions are created\n"); + printf("\t-s sync mode. Don't return until the partitions are created. Default.\n"); - return 1; + return 1; } - + @@ -285,6 +286,9 @@ main(int argc, char **argv){ - case 's': - udev_sync = 1; - break; + case 's': + udev_sync = 1; + break; + case 'n': + udev_sync = 0; + break; - case 'u': - what = UPDATE; - break; + case 'u': + what = UPDATE; + break; Index: multipath-tools-130222/multipath/multipath.rules =================================================================== --- multipath-tools-130222.orig/multipath/multipath.rules @@ -55,5 +55,5 @@ Index: multipath-tools-130222/multipath/multipath.rules ENV{DM_ACTIVATION}!="1", ENV{DM_MULTIPATH_NEED_KPARTX}!="1", GOTO="end_mpath" -RUN+="$env{MPATH_SBIN_PATH}/kpartx -a $tempnode", \ +RUN+="$env{MPATH_SBIN_PATH}/kpartx -an $tempnode", \ - ENV{DM_MULTIPATH_NEED_KPARTX}="" + ENV{DM_MULTIPATH_NEED_KPARTX}="" LABEL="end_mpath" diff --git a/SOURCES/0144-RHBZ-1299652-alua-pref-arg.patch b/SOURCES/0144-RHBZ-1299652-alua-pref-arg.patch index 734cb8b3..9ae0b405 100644 --- a/SOURCES/0144-RHBZ-1299652-alua-pref-arg.patch +++ b/SOURCES/0144-RHBZ-1299652-alua-pref-arg.patch @@ -9,9 +9,9 @@ Index: multipath-tools-130222/libmultipath/prioritizers/alua.c --- multipath-tools-130222.orig/libmultipath/prioritizers/alua.c +++ multipath-tools-130222/libmultipath/prioritizers/alua.c @@ -86,15 +86,33 @@ get_alua_info(int fd, struct alua_contex - return rc; + return rc; } - + +int get_exclusive_perf_arg(char *args) +{ + char *ptr; @@ -30,41 +30,41 @@ Index: multipath-tools-130222/libmultipath/prioritizers/alua.c + int getprio (struct path * pp, char * args) { - int rc; - int aas; - int priopath; + int rc; + int aas; + int priopath; + int exclusive_perf; - - if (pp->fd < 0) - return -ALUA_PRIO_NO_INFORMATION; - + + if (pp->fd < 0) + return -ALUA_PRIO_NO_INFORMATION; + + exclusive_perf = get_exclusive_perf_arg(args); - rc = get_alua_info(pp->fd, pp->prio.context); - if (rc >= 0) { - aas = (rc & 0x0f); + rc = get_alua_info(pp->fd, pp->prio.context); + if (rc >= 0) { + aas = (rc & 0x0f); @@ -115,7 +133,7 @@ int getprio (struct path * pp, char * ar - default: - rc = 0; - } + default: + rc = 0; + } - if (priopath && aas != AAS_OPTIMIZED) + if (priopath && (aas != AAS_OPTIMIZED || exclusive_perf)) - rc += 80; - } else { - switch(-rc) { + rc += 80; + } else { + switch(-rc) { Index: multipath-tools-130222/libmultipath/propsel.c =================================================================== --- multipath-tools-130222.orig/libmultipath/propsel.c +++ multipath-tools-130222/libmultipath/propsel.c @@ -420,17 +420,19 @@ select_prio (struct path * pp) - if (prio_selected(p)) { - condlog(3, "%s: prio = %s (detected setting)", - pp->dev, prio_name(p)); + if (prio_selected(p)) { + condlog(3, "%s: prio = %s (detected setting)", + pp->dev, prio_name(p)); + condlog(3, "%s: prio args = %s (detected setting)", + pp->dev, prio_args(p)); - return 0; - } - } - + return 0; + } + } + - if ((mpe = find_mpe(pp->wwid))) { - if (mpe->prio_name) { - prio_get(p, mpe->prio_name, mpe->prio_args); @@ -79,17 +79,17 @@ Index: multipath-tools-130222/libmultipath/propsel.c + condlog(3, "%s: prio args = %s (LUN setting)", + pp->dev, prio_args(p)); + return 0; - } - - if (pp->hwe && pp->hwe->prio_name) { + } + + if (pp->hwe && pp->hwe->prio_name) { @@ -452,7 +454,7 @@ select_prio (struct path * pp) - prio_get(p, DEFAULT_PRIO, DEFAULT_PRIO_ARGS); - condlog(3, "%s: prio = %s (internal default)", - pp->dev, DEFAULT_PRIO); + prio_get(p, DEFAULT_PRIO, DEFAULT_PRIO_ARGS); + condlog(3, "%s: prio = %s (internal default)", + pp->dev, DEFAULT_PRIO); - condlog(3, "%s: prio = %s (internal default)", + condlog(3, "%s: prio args = %s (internal default)", - pp->dev, DEFAULT_PRIO_ARGS); - return 0; + pp->dev, DEFAULT_PRIO_ARGS); + return 0; } Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== diff --git a/SOURCES/0145-UP-resize-help-msg.patch b/SOURCES/0145-UP-resize-help-msg.patch index c61e97b6..33ca0f6b 100644 --- a/SOURCES/0145-UP-resize-help-msg.patch +++ b/SOURCES/0145-UP-resize-help-msg.patch @@ -4,7 +4,7 @@ index acc4249..8d26956 100644 +++ b/multipathd/cli.c @@ -320,52 +320,90 @@ alloc_handlers (void) } - + static int -genhelp_sprint_aliases (char * reply, vector keys, struct key * refkw) +genhelp_sprint_aliases (char * reply, int maxlen, vector keys, @@ -12,8 +12,8 @@ index acc4249..8d26956 100644 { - int i, fwd = 0; + int i, len = 0; - struct key * kw; - + struct key * kw; + - vector_foreach_slot (keys, kw, i) - if (kw->code == refkw->code && kw != refkw) - fwd += sprintf(reply, "|%s", kw->str); @@ -25,26 +25,26 @@ index acc4249..8d26956 100644 + return len; + } + } - + - return fwd; + return len; } - + -static char * -genhelp_handler (void) -{ +static int +do_genhelp(char *reply, int maxlen) { + int len = 0; - int i, j; - unsigned long fp; - struct handler * h; - struct key * kw; + int i, j; + unsigned long fp; + struct handler * h; + struct key * kw; - char * reply; - char * p; - - reply = MALLOC(INITIAL_REPLY_LEN); - + - if (!reply) - return NULL; - @@ -57,12 +57,12 @@ index acc4249..8d26956 100644 + len += snprintf(reply + len, maxlen - len, "CLI commands reference:\n"); + if (len >= maxlen) + goto out; - - vector_foreach_slot (handlers, h, i) { - fp = h->fingerprint; - vector_foreach_slot (keys, kw, j) { - if ((kw->code & fp)) { - fp -= kw->code; + + vector_foreach_slot (handlers, h, i) { + fp = h->fingerprint; + vector_foreach_slot (keys, kw, j) { + if ((kw->code & fp)) { + fp -= kw->code; - p += sprintf(p, " %s", kw->str); - p += genhelp_sprint_aliases(p, keys, kw); - @@ -85,18 +85,18 @@ index acc4249..8d26956 100644 + if (len >= maxlen) + goto out; + } - } - } + } + } - p += sprintf(p, "\n"); + len += snprintf(reply + len, maxlen - len, "\n"); + if (len >= maxlen) + goto out; - } + } +out: + return len; +} + - + +static char * +genhelp_handler (void) +{ @@ -115,9 +115,9 @@ index acc4249..8d26956 100644 + again = ((p - reply) >= maxlen); + REALLOC_REPLY(reply, again, maxlen); + } - return reply; + return reply; } - + diff --git a/multipathd/cli.h b/multipathd/cli.h index 09fdc68..2e0e1da 100644 --- a/multipathd/cli.h @@ -125,7 +125,7 @@ index 09fdc68..2e0e1da 100644 @@ -71,7 +71,21 @@ enum { #define SETPRSTATUS (1UL << __SETPRSTATUS) #define UNSETPRSTATUS (1UL << __UNSETPRSTATUS) - + -#define INITIAL_REPLY_LEN 1100 +#define INITIAL_REPLY_LEN 1200 + @@ -142,9 +142,9 @@ index 09fdc68..2e0e1da 100644 + free(tmp); \ + } \ + } while (0) - + struct key { - char * str; + char * str; diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index e47899a..23683f2 100644 --- a/multipathd/cli_handlers.c @@ -152,7 +152,7 @@ index e47899a..23683f2 100644 @@ -23,20 +23,6 @@ #include "cli.h" #include "uevent.h" - + -#define REALLOC_REPLY(r, a, m) \ - do { \ - if ((a)) { \ diff --git a/SOURCES/0146-UPBZ-1299651-raw-output.patch b/SOURCES/0146-UPBZ-1299651-raw-output.patch index 3ccef2c7..93a171e8 100644 --- a/SOURCES/0146-UPBZ-1299651-raw-output.patch +++ b/SOURCES/0146-UPBZ-1299651-raw-output.patch @@ -26,8 +26,8 @@ Index: multipath-tools-130222/libmultipath/print.c +} while (0) + #define ENDLINE \ - if (c > line) \ - line[c - line - 1] = '\n' + if (c > line) \ + line[c - line - 1] = '\n' -#define PRINT(var, size, format, args...) \ - fwd = snprintf(var, size, format, ##args); \ - c += (fwd >= size) ? size : fwd; @@ -36,106 +36,106 @@ Index: multipath-tools-130222/libmultipath/print.c + fwd = snprintf(var, size, format, ##args); \ + c += (fwd >= size) ? size : fwd; \ +} while (0) - + /* * information printing helpers @@ -720,7 +727,7 @@ snprint_multipath_header (char * line, i - + int snprint_multipath (char * line, int len, char * format, - struct multipath * mpp) + struct multipath * mpp, int pad) { - char * c = line; /* line cursor */ - char * s = line; /* for padding */ + char * c = line; /* line cursor */ + char * s = line; /* for padding */ @@ -747,7 +754,8 @@ snprint_multipath (char * line, int len, - - data->snprint(buff, MAX_FIELD_LEN, mpp); - PRINT(c, TAIL, "%s", buff); + + data->snprint(buff, MAX_FIELD_LEN, mpp); + PRINT(c, TAIL, "%s", buff); - PAD(data->width); + if (pad) + PAD(data->width); - buff[0] = '\0'; - } while (*f++); - + buff[0] = '\0'; + } while (*f++); + @@ -790,7 +798,7 @@ snprint_path_header (char * line, int le - + int snprint_path (char * line, int len, char * format, - struct path * pp) + struct path * pp, int pad) { - char * c = line; /* line cursor */ - char * s = line; /* for padding */ + char * c = line; /* line cursor */ + char * s = line; /* for padding */ @@ -817,7 +825,8 @@ snprint_path (char * line, int len, char - - data->snprint(buff, MAX_FIELD_LEN, pp); - PRINT(c, TAIL, "%s", buff); + + data->snprint(buff, MAX_FIELD_LEN, pp); + PRINT(c, TAIL, "%s", buff); - PAD(data->width); + if (pad) + PAD(data->width); - } while (*f++); - - ENDLINE; + } while (*f++); + + ENDLINE; @@ -909,7 +918,7 @@ snprint_multipath_topology (char * buff, - reset_multipath_layout(); - - if (verbosity == 1) + reset_multipath_layout(); + + if (verbosity == 1) - return snprint_multipath(buff, len, "%n", mpp); + return snprint_multipath(buff, len, "%n", mpp, 1); - - if(isatty(1)) - c += sprintf(c, "%c[%dm", 0x1B, 1); /* bold on */ + + if(isatty(1)) + c += sprintf(c, "%c[%dm", 0x1B, 1); /* bold on */ @@ -928,10 +937,11 @@ snprint_multipath_topology (char * buff, - if(isatty(1)) - c += sprintf(c, "%c[%dm", 0x1B, 0); /* bold off */ - + if(isatty(1)) + c += sprintf(c, "%c[%dm", 0x1B, 0); /* bold off */ + - fwd += snprint_multipath(buff + fwd, len - fwd, style, mpp); + fwd += snprint_multipath(buff + fwd, len - fwd, style, mpp, 1); - if (fwd > len) - return len; + if (fwd > len) + return len; - fwd += snprint_multipath(buff + fwd, len - fwd, PRINT_MAP_PROPS, mpp); + fwd += snprint_multipath(buff + fwd, len - fwd, PRINT_MAP_PROPS, mpp, + 1); - if (fwd > len) - return len; - + if (fwd > len) + return len; + @@ -958,7 +968,7 @@ snprint_multipath_topology (char * buff, - strcpy(f, " |- " PRINT_PATH_INDENT); - else - strcpy(f, " `- " PRINT_PATH_INDENT); + strcpy(f, " |- " PRINT_PATH_INDENT); + else + strcpy(f, " `- " PRINT_PATH_INDENT); - fwd += snprint_path(buff + fwd, len - fwd, fmt, pp); + fwd += snprint_path(buff + fwd, len - fwd, fmt, pp, 1); - if (fwd > len) - return len; - } + if (fwd > len) + return len; + } @@ -1425,7 +1435,7 @@ snprint_devices (char * buff, int len, s - if (r > 0) - fwd += snprintf(buff + fwd, len - fwd, - " devnode blacklisted, unmonitored"); + if (r > 0) + fwd += snprintf(buff + fwd, len - fwd, + " devnode blacklisted, unmonitored"); - else if (r < 0) + else if (r <= 0) - fwd += snprintf(buff + fwd, len - fwd, - " devnode whitelisted, unmonitored"); - } else + fwd += snprintf(buff + fwd, len - fwd, + " devnode whitelisted, unmonitored"); + } else @@ -1455,7 +1465,7 @@ print_path (struct path * pp, char * sty - char line[MAX_LINE_LEN]; - - memset(&line[0], 0, MAX_LINE_LEN); + char line[MAX_LINE_LEN]; + + memset(&line[0], 0, MAX_LINE_LEN); - snprint_path(&line[0], MAX_LINE_LEN, style, pp); + snprint_path(&line[0], MAX_LINE_LEN, style, pp, 1); - printf("%s", line); + printf("%s", line); } - + @@ -1465,7 +1475,7 @@ print_multipath (struct multipath * mpp, - char line[MAX_LINE_LEN]; - - memset(&line[0], 0, MAX_LINE_LEN); + char line[MAX_LINE_LEN]; + + memset(&line[0], 0, MAX_LINE_LEN); - snprint_multipath(&line[0], MAX_LINE_LEN, style, mpp); + snprint_multipath(&line[0], MAX_LINE_LEN, style, mpp, 1); - printf("%s", line); + printf("%s", line); } - + Index: multipath-tools-130222/libmultipath/print.h =================================================================== --- multipath-tools-130222.orig/libmultipath/print.h @@ -149,63 +149,63 @@ Index: multipath-tools-130222/libmultipath/print.h +int snprint_path (char *, int, char *, struct path *, int); +int snprint_multipath (char *, int, char *, struct multipath *, int); int snprint_multipath_topology (char *, int, struct multipath * mpp, - int verbosity); + int verbosity); int snprint_defaults (char *, int); Index: multipath-tools-130222/multipathd/cli.c =================================================================== --- multipath-tools-130222.orig/multipathd/cli.c +++ multipath-tools-130222/multipathd/cli.c @@ -180,7 +180,7 @@ load_keys (void) - r += add_key(keys, "config", CONFIG, 0); - r += add_key(keys, "blacklist", BLACKLIST, 0); - r += add_key(keys, "devices", DEVICES, 0); + r += add_key(keys, "config", CONFIG, 0); + r += add_key(keys, "blacklist", BLACKLIST, 0); + r += add_key(keys, "devices", DEVICES, 0); - r += add_key(keys, "format", FMT, 1); + r += add_key(keys, "raw", RAW, 0); - r += add_key(keys, "wildcards", WILDCARDS, 0); - r += add_key(keys, "quit", QUIT, 0); - r += add_key(keys, "exit", QUIT, 0); + r += add_key(keys, "wildcards", WILDCARDS, 0); + r += add_key(keys, "quit", QUIT, 0); + r += add_key(keys, "exit", QUIT, 0); @@ -188,6 +188,7 @@ load_keys (void) - r += add_key(keys, "getprstatus", GETPRSTATUS, 0); - r += add_key(keys, "setprstatus", SETPRSTATUS, 0); - r += add_key(keys, "unsetprstatus", UNSETPRSTATUS, 0); + r += add_key(keys, "getprstatus", GETPRSTATUS, 0); + r += add_key(keys, "setprstatus", SETPRSTATUS, 0); + r += add_key(keys, "unsetprstatus", UNSETPRSTATUS, 0); + r += add_key(keys, "format", FMT, 1); - - if (r) { - free_keys(keys); + + if (r) { + free_keys(keys); @@ -463,12 +464,14 @@ cli_init (void) { - - add_handler(LIST+PATHS, NULL); - add_handler(LIST+PATHS+FMT, NULL); + + add_handler(LIST+PATHS, NULL); + add_handler(LIST+PATHS+FMT, NULL); + add_handler(LIST+PATHS+RAW+FMT, NULL); - add_handler(LIST+STATUS, NULL); - add_handler(LIST+DAEMON, NULL); - add_handler(LIST+MAPS, NULL); - add_handler(LIST+MAPS+STATUS, NULL); - add_handler(LIST+MAPS+STATS, NULL); - add_handler(LIST+MAPS+FMT, NULL); + add_handler(LIST+STATUS, NULL); + add_handler(LIST+DAEMON, NULL); + add_handler(LIST+MAPS, NULL); + add_handler(LIST+MAPS+STATUS, NULL); + add_handler(LIST+MAPS+STATS, NULL); + add_handler(LIST+MAPS+FMT, NULL); + add_handler(LIST+MAPS+RAW+FMT, NULL); - add_handler(LIST+MAPS+TOPOLOGY, NULL); - add_handler(LIST+TOPOLOGY, NULL); - add_handler(LIST+MAP+TOPOLOGY, NULL); + add_handler(LIST+MAPS+TOPOLOGY, NULL); + add_handler(LIST+TOPOLOGY, NULL); + add_handler(LIST+MAP+TOPOLOGY, NULL); Index: multipath-tools-130222/multipathd/cli.h =================================================================== --- multipath-tools-130222.orig/multipathd/cli.h +++ multipath-tools-130222/multipathd/cli.h @@ -26,13 +26,14 @@ enum { - __CONFIG, - __BLACKLIST, - __DEVICES, + __CONFIG, + __BLACKLIST, + __DEVICES, - __FMT, + __RAW, - __WILDCARDS, - __QUIT, - __SHUTDOWN, - __GETPRSTATUS, - __SETPRSTATUS, - __UNSETPRSTATUS, + __WILDCARDS, + __QUIT, + __SHUTDOWN, + __GETPRSTATUS, + __SETPRSTATUS, + __UNSETPRSTATUS, + __FMT, }; - + #define LIST (1 << __LIST) @@ -62,7 +63,7 @@ enum { #define CONFIG (1 << __CONFIG) @@ -221,52 +221,52 @@ Index: multipath-tools-130222/multipathd/cli.h #define SETPRSTATUS (1UL << __SETPRSTATUS) #define UNSETPRSTATUS (1UL << __UNSETPRSTATUS) +#define FMT (1UL << __FMT) - + #define INITIAL_REPLY_LEN 1200 - + Index: multipath-tools-130222/multipathd/cli_handlers.c =================================================================== --- multipath-tools-130222.orig/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -24,7 +24,8 @@ #include "uevent.h" - + int -show_paths (char ** r, int * len, struct vectors * vecs, char * style) +show_paths (char ** r, int * len, struct vectors * vecs, char * style, + int pretty) { - int i; - struct path * pp; + int i; + struct path * pp; @@ -42,13 +43,13 @@ show_paths (char ** r, int * len, struct - - c = reply; - + + c = reply; + - if (VECTOR_SIZE(vecs->pathvec) > 0) + if (pretty && VECTOR_SIZE(vecs->pathvec) > 0) - c += snprint_path_header(c, reply + maxlen - c, - style); - - vector_foreach_slot(vecs->pathvec, pp, i) - c += snprint_path(c, reply + maxlen - c, + c += snprint_path_header(c, reply + maxlen - c, + style); + + vector_foreach_slot(vecs->pathvec, pp, i) + c += snprint_path(c, reply + maxlen - c, - style, pp); + style, pp, pretty); - - again = ((c - reply) == (maxlen - 1)); - + + again = ((c - reply) == (maxlen - 1)); + @@ -183,7 +184,7 @@ cli_list_paths (void * v, char ** reply, - - condlog(3, "list paths (operator)"); - + + condlog(3, "list paths (operator)"); + - return show_paths(reply, len, vecs, PRINT_PATH_CHECKER); + return show_paths(reply, len, vecs, PRINT_PATH_CHECKER, 1); } - + int @@ -194,7 +195,18 @@ cli_list_paths_fmt (void * v, char ** re - - condlog(3, "list paths (operator)"); - + + condlog(3, "list paths (operator)"); + - return show_paths(reply, len, vecs, fmt); + return show_paths(reply, len, vecs, fmt, 1); +} @@ -281,38 +281,38 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c + + return show_paths(reply, len, vecs, fmt, 0); } - + int @@ -285,7 +297,8 @@ show_daemon (char ** r, int *len) } - + int -show_maps (char ** r, int *len, struct vectors * vecs, char * style) +show_maps (char ** r, int *len, struct vectors * vecs, char * style, + int pretty) { - int i; - struct multipath * mpp; + int i; + struct multipath * mpp; @@ -302,13 +315,13 @@ show_maps (char ** r, int *len, struct v - return 1; - - c = reply; + return 1; + + c = reply; - if (VECTOR_SIZE(vecs->mpvec) > 0) + if (pretty && VECTOR_SIZE(vecs->mpvec) > 0) - c += snprint_multipath_header(c, reply + maxlen - c, - style); - - vector_foreach_slot(vecs->mpvec, mpp, i) - c += snprint_multipath(c, reply + maxlen - c, + c += snprint_multipath_header(c, reply + maxlen - c, + style); + + vector_foreach_slot(vecs->mpvec, mpp, i) + c += snprint_multipath(c, reply + maxlen - c, - style, mpp); + style, mpp, pretty); - - again = ((c - reply) == (maxlen - 1)); - + + again = ((c - reply) == (maxlen - 1)); + @@ -327,7 +340,18 @@ cli_list_maps_fmt (void * v, char ** rep - - condlog(3, "list maps (operator)"); - + + condlog(3, "list maps (operator)"); + - return show_maps(reply, len, vecs, fmt); + return show_maps(reply, len, vecs, fmt, 1); +} @@ -327,34 +327,34 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c + + return show_maps(reply, len, vecs, fmt, 0); } - + int @@ -337,7 +361,7 @@ cli_list_maps (void * v, char ** reply, - - condlog(3, "list maps (operator)"); - + + condlog(3, "list maps (operator)"); + - return show_maps(reply, len, vecs, PRINT_MAP_NAMES); + return show_maps(reply, len, vecs, PRINT_MAP_NAMES, 1); } - + int @@ -357,7 +381,7 @@ cli_list_maps_status (void * v, char ** - - condlog(3, "list maps status (operator)"); - + + condlog(3, "list maps status (operator)"); + - return show_maps(reply, len, vecs, PRINT_MAP_STATUS); + return show_maps(reply, len, vecs, PRINT_MAP_STATUS, 1); } - + int @@ -367,7 +391,7 @@ cli_list_maps_stats (void * v, char ** r - - condlog(3, "list maps stats (operator)"); - + + condlog(3, "list maps stats (operator)"); + - return show_maps(reply, len, vecs, PRINT_MAP_STATS); + return show_maps(reply, len, vecs, PRINT_MAP_STATS, 1); } - + int Index: multipath-tools-130222/multipathd/cli_handlers.h =================================================================== @@ -377,17 +377,17 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -967,12 +967,14 @@ uxlsnrloop (void * ap) - - set_handler_callback(LIST+PATHS, cli_list_paths); - set_handler_callback(LIST+PATHS+FMT, cli_list_paths_fmt); + + set_handler_callback(LIST+PATHS, cli_list_paths); + set_handler_callback(LIST+PATHS+FMT, cli_list_paths_fmt); + set_handler_callback(LIST+PATHS+RAW+FMT, cli_list_paths_raw); - set_handler_callback(LIST+MAPS, cli_list_maps); - set_handler_callback(LIST+STATUS, cli_list_status); - set_handler_callback(LIST+DAEMON, cli_list_daemon); - set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status); - set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats); - set_handler_callback(LIST+MAPS+FMT, cli_list_maps_fmt); + set_handler_callback(LIST+MAPS, cli_list_maps); + set_handler_callback(LIST+STATUS, cli_list_status); + set_handler_callback(LIST+DAEMON, cli_list_daemon); + set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status); + set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats); + set_handler_callback(LIST+MAPS+FMT, cli_list_maps_fmt); + set_handler_callback(LIST+MAPS+RAW+FMT, cli_list_maps_raw); - set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology); - set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology); - set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology); + set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology); + set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology); + set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology); diff --git a/SOURCES/0147-RHBZ-1272620-fail-rm-msg.patch b/SOURCES/0147-RHBZ-1272620-fail-rm-msg.patch index 3fe52c0a..b48ed6b6 100644 --- a/SOURCES/0147-RHBZ-1272620-fail-rm-msg.patch +++ b/SOURCES/0147-RHBZ-1272620-fail-rm-msg.patch @@ -8,53 +8,53 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c --- multipath-tools-130222.orig/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -459,7 +459,7 @@ cli_del_path (void * v, char ** reply, i - pp = find_path_by_dev(vecs->pathvec, param); - if (!pp) { - condlog(0, "%s: path already removed", param); + pp = find_path_by_dev(vecs->pathvec, param); + if (!pp) { + condlog(0, "%s: path already removed", param); - return 0; + return 1; - } - return ev_remove_path(pp, vecs); + } + return ev_remove_path(pp, vecs); } @@ -520,19 +520,19 @@ cli_del_map (void * v, char ** reply, in - minor = dm_get_minor(param); - if (minor < 0) { - condlog(2, "%s: not a device mapper table", param); + minor = dm_get_minor(param); + if (minor < 0) { + condlog(2, "%s: not a device mapper table", param); - return 0; + return 1; - } - major = dm_get_major(param); - if (major < 0) { - condlog(2, "%s: not a device mapper table", param); + } + major = dm_get_major(param); + if (major < 0) { + condlog(2, "%s: not a device mapper table", param); - return 0; + return 1; - } - sprintf(dev_path,"dm-%d", minor); - alias = dm_mapname(major, minor); - if (!alias) { - condlog(2, "%s: mapname not found for %d:%d", - param, major, minor); + } + sprintf(dev_path,"dm-%d", minor); + alias = dm_mapname(major, minor); + if (!alias) { + condlog(2, "%s: mapname not found for %d:%d", + param, major, minor); - return 0; + return 1; - } - rc = ev_remove_map(param, alias, minor, vecs); - FREE(alias); + } + rc = ev_remove_map(param, alias, minor, vecs); + FREE(alias); Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -437,12 +437,12 @@ ev_remove_map (char * devname, char * al - if (!mpp) { - condlog(2, "%s: devmap not registered, can't remove", - devname); + if (!mpp) { + condlog(2, "%s: devmap not registered, can't remove", + devname); - return 0; + return 1; - } - if (strcmp(mpp->alias, alias)) { - condlog(2, "%s: minor number mismatch (map %d, event %d)", - mpp->alias, mpp->dmi->minor, minor); + } + if (strcmp(mpp->alias, alias)) { + condlog(2, "%s: minor number mismatch (map %d, event %d)", + mpp->alias, mpp->dmi->minor, minor); - return 0; + return 1; - } - return flush_map(mpp, vecs, 0); + } + return flush_map(mpp, vecs, 0); } diff --git a/SOURCES/0148-RHBZ-1292599-verify-before-remove.patch b/SOURCES/0148-RHBZ-1292599-verify-before-remove.patch index ab413603..3e33b89e 100644 --- a/SOURCES/0148-RHBZ-1292599-verify-before-remove.patch +++ b/SOURCES/0148-RHBZ-1292599-verify-before-remove.patch @@ -9,18 +9,18 @@ Index: multipath-tools-130222/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -33,6 +33,9 @@ #define UUID_PREFIX_LEN 6 - + static int dm_cancel_remove_partmaps(const char * mapname); +static int do_foreach_partmaps (const char * mapname, + int (*partmap_func)(const char *, void *), + void *data); - + #ifndef LIBDM_API_COOKIE static inline int dm_task_set_cookie(struct dm_task *dmt, uint32_t *c, int a) @@ -709,6 +712,26 @@ out: - return r; + return r; } - + +static int +partmap_in_use(const char *name, void *data) +{ @@ -45,94 +45,94 @@ Index: multipath-tools-130222/libmultipath/devmapper.c _dm_flush_map (const char * mapname, int need_sync, int deferred_remove) { @@ -717,6 +740,11 @@ _dm_flush_map (const char * mapname, int - if (!dm_is_mpath(mapname)) - return 0; /* nothing to do */ - + if (!dm_is_mpath(mapname)) + return 0; /* nothing to do */ + + /* If you aren't doing a deferred remove, make sure that no + * devices are in use */ + if (!do_deferred(deferred_remove) && partmap_in_use(mapname, NULL)) + return 1; + - if (dm_remove_partmaps(mapname, need_sync, deferred_remove)) - return 1; - + if (dm_remove_partmaps(mapname, need_sync, deferred_remove)) + return 1; + @@ -825,7 +853,7 @@ dm_flush_maps (void) } - + int -dm_message(char * mapname, char * message) +dm_message(const char * mapname, char * message) { - int r = 1; - struct dm_task *dmt; + int r = 1; + struct dm_task *dmt; @@ -1076,7 +1104,8 @@ bad: } - + static int -do_foreach_partmaps (const char * mapname, int (*partmap_func)(char *, void *), +do_foreach_partmaps (const char * mapname, + int (*partmap_func)(const char *, void *), - void *data) + void *data) { - struct dm_task *dmt; + struct dm_task *dmt; @@ -1149,7 +1178,7 @@ struct remove_data { }; - + static int -remove_partmap(char *name, void *data) +remove_partmap(const char *name, void *data) { - struct remove_data *rd = (struct remove_data *)data; - + struct remove_data *rd = (struct remove_data *)data; + @@ -1176,7 +1205,7 @@ dm_remove_partmaps (const char * mapname #ifdef LIBDM_API_DEFERRED - + static int -cancel_remove_partmap (char *name, void *unused) +cancel_remove_partmap (const char *name, void *unused) { - if (dm_get_opencount(name)) - dm_cancel_remove_partmaps(name); + if (dm_get_opencount(name)) + dm_cancel_remove_partmaps(name); @@ -1296,13 +1325,13 @@ out: } - + struct rename_data { - char *old; + const char *old; - char *new; - char *delim; + char *new; + char *delim; }; - + static int -rename_partmap (char *name, void *data) +rename_partmap (const char *name, void *data) { - char buff[PARAMS_SIZE]; - int offset; + char buff[PARAMS_SIZE]; + int offset; @@ -1319,7 +1348,7 @@ rename_partmap (char *name, void *data) } - + int -dm_rename_partmaps (char * old, char * new) +dm_rename_partmaps (const char * old, char * new) { - struct rename_data rd; - + struct rename_data rd; + @@ -1333,7 +1362,7 @@ dm_rename_partmaps (char * old, char * n } - + int -dm_rename (char * old, char * new) +dm_rename (const char * old, char * new) { - int r = 0; - struct dm_task *dmt; + int r = 0; + struct dm_task *dmt; Index: multipath-tools-130222/libmultipath/devmapper.h =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.h +++ multipath-tools-130222/libmultipath/devmapper.h @@ -47,7 +47,7 @@ int dm_remove_partmaps (const char * map - int deferred_remove); + int deferred_remove); int dm_get_uuid(char *name, char *uuid); int dm_get_info (char * mapname, struct dm_info ** dmi); -int dm_rename (char * old, char * new); diff --git a/SOURCES/0149-RHBZ-1292599-restore-removed-parts.patch b/SOURCES/0149-RHBZ-1292599-restore-removed-parts.patch index 9d256ed5..62757c4a 100644 --- a/SOURCES/0149-RHBZ-1292599-restore-removed-parts.patch +++ b/SOURCES/0149-RHBZ-1292599-restore-removed-parts.patch @@ -9,73 +9,74 @@ Index: multipath-tools-130222/libmultipath/configure.c --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -398,6 +398,7 @@ select_action (struct multipath * mpp, v - cmpp->alias, mpp->alias); - strncpy(mpp->alias_old, cmpp->alias, WWID_SIZE); - mpp->action = ACT_RENAME; + cmpp->alias, mpp->alias); + strncpy(mpp->alias_old, cmpp->alias, WWID_SIZE); + mpp->action = ACT_RENAME; + mpp->force_udev_reload = force_reload; - if (force_reload) - mpp->action = ACT_RENAME2; - return; + if (force_reload) + mpp->action = ACT_RENAME2; + return; @@ -437,11 +438,13 @@ select_action (struct multipath * mpp, v - return; - } - if (force_reload) { + return; + } + if (force_reload) { + mpp->force_udev_reload = 1; - mpp->action = ACT_RELOAD; - condlog(3, "%s: set ACT_RELOAD (forced by user)", - mpp->alias); - return; - } + mpp->action = ACT_RELOAD; + condlog(3, "%s: set ACT_RELOAD (forced by user)", + mpp->alias); + return; + } + mpp->force_udev_reload = !pathcount(mpp, PATH_WILD); - if (cmpp->size != mpp->size) { - mpp->action = ACT_RESIZE; - condlog(3, "%s: set ACT_RESIZE (size change)", + if (cmpp->size != mpp->size) { + mpp->action = ACT_RESIZE; + condlog(3, "%s: set ACT_RESIZE (size change)", @@ -651,7 +654,7 @@ domap (struct multipath * mpp, char * pa - case ACT_RELOAD: - r = dm_addmap_reload(mpp, params); - if (r) + case ACT_RELOAD: + r = dm_addmap_reload(mpp, params); + if (r) - r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, MPATH_UDEV_RELOAD_FLAG); + r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, (mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG); - break; - - case ACT_RESIZE: + break; + + case ACT_RESIZE: @@ -669,7 +672,7 @@ domap (struct multipath * mpp, char * pa - if (r) { - r = dm_addmap_reload(mpp, params); - if (r) + if (r) { + r = dm_addmap_reload(mpp, params); + if (r) - r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, MPATH_UDEV_RELOAD_FLAG); + r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, (mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG); - } - break; - + } + break; + @@ -682,6 +685,7 @@ domap (struct multipath * mpp, char * pa - * DM_DEVICE_CREATE, DM_DEVICE_RENAME, or DM_DEVICE_RELOAD - * succeeded - */ + * DM_DEVICE_CREATE, DM_DEVICE_RENAME, or DM_DEVICE_RELOAD + * succeeded + */ + mpp->force_udev_reload = 0; - if (mpp->action == ACT_CREATE) { - if (remember_wwid(mpp->wwid) == 1) - trigger_uevents(mpp); + if (mpp->action == ACT_CREATE) { + if (remember_wwid(mpp->wwid) == 1) + trigger_uevents(mpp); Index: multipath-tools-130222/libmultipath/structs.h =================================================================== --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -234,6 +234,7 @@ struct multipath { - int deferred_remove; - int delay_watch_checks; - int delay_wait_checks; + int deferred_remove; + int delay_watch_checks; + int delay_wait_checks; + int force_udev_reload; - unsigned int dev_loss; - uid_t uid; - gid_t gid; + unsigned int dev_loss; + uid_t uid; + gid_t gid; Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -554,6 +554,7 @@ rescan: - - condlog(4,"%s: adopting all paths for path %s", - mpp->alias, pp->dev); + + condlog(4,"%s: adopting all paths for path %s", + mpp->alias, pp->dev); + mpp->force_udev_reload = !pathcount(mpp, PATH_WILD); - if (adopt_paths(vecs->pathvec, mpp, 1)) - goto fail; /* leave path added to pathvec */ + if (adopt_paths(vecs->pathvec, mpp, 1)) + goto fail; /* leave path added to pathvec */ + diff --git a/SOURCES/0150-RHBZ-1253913-fix-startup-msg.patch b/SOURCES/0150-RHBZ-1253913-fix-startup-msg.patch index cf2ae5af..8a020ce6 100644 --- a/SOURCES/0150-RHBZ-1253913-fix-startup-msg.patch +++ b/SOURCES/0150-RHBZ-1253913-fix-startup-msg.patch @@ -11,12 +11,12 @@ Index: multipath-tools-130222/multipathd/main.c enum daemon_status running_state; pid_t daemon_pid; +pid_t parent_pid = -1; - + static sem_t exit_sem; /* @@ -1718,6 +1719,12 @@ sigusr2 (int sig) } - + static void +sigalrm (int sig) +{ @@ -26,103 +26,103 @@ Index: multipath-tools-130222/multipathd/main.c +static void signal_init(void) { - sigset_t set; + sigset_t set; @@ -1820,6 +1827,9 @@ child (void * param) - } - - running_state = DAEMON_START; + } + + running_state = DAEMON_START; + pid_rc = pidfile_create(DEFAULT_PIDFILE, daemon_pid); + if (parent_pid > 0) + kill(parent_pid, SIGALRM); - - condlog(2, "--------start up--------"); - condlog(2, "read " DEFAULT_CONFIGFILE); + + condlog(2, "--------start up--------"); + condlog(2, "read " DEFAULT_CONFIGFILE); @@ -1911,8 +1921,6 @@ child (void * param) - } - pthread_attr_destroy(&misc_attr); - + } + pthread_attr_destroy(&misc_attr); + - /* Startup complete, create logfile */ - pid_rc = pidfile_create(DEFAULT_PIDFILE, daemon_pid); - update_timestamp(1); - /* Ignore errors, we can live without */ - + update_timestamp(1); + /* Ignore errors, we can live without */ + @@ -1992,7 +2000,10 @@ daemonize(void) { - int pid; - int dev_null_fd; + int pid; + int dev_null_fd; + struct sigaction oldsig; - + + oldsig.sa_handler = signal_set(SIGALRM, sigalrm); + parent_pid = getpid(); - if( (pid = fork()) < 0){ - fprintf(stderr, "Failed first fork : %s\n", strerror(errno)); - return -1; + if( (pid = fork()) < 0){ + fprintf(stderr, "Failed first fork : %s\n", strerror(errno)); + return -1; @@ -2000,10 +2011,13 @@ daemonize(void) - else if (pid != 0) - return pid; - + else if (pid != 0) + return pid; + + signal_set(SIGALRM, oldsig.sa_handler); - setsid(); - + setsid(); + - if ( (pid = fork()) < 0) + if ( (pid = fork()) < 0) { - fprintf(stderr, "Failed second fork : %s\n", strerror(errno)); + fprintf(stderr, "Failed second fork : %s\n", strerror(errno)); + goto fail; + } - else if (pid != 0) - _exit(0); - + else if (pid != 0) + _exit(0); + @@ -2014,30 +2028,34 @@ daemonize(void) - if (dev_null_fd < 0){ - fprintf(stderr, "cannot open /dev/null for input & output : %s\n", - strerror(errno)); + if (dev_null_fd < 0){ + fprintf(stderr, "cannot open /dev/null for input & output : %s\n", + strerror(errno)); - _exit(0); + goto fail; - } - - close(STDIN_FILENO); - if (dup(dev_null_fd) < 0) { - fprintf(stderr, "cannot dup /dev/null to stdin : %s\n", - strerror(errno)); + } + + close(STDIN_FILENO); + if (dup(dev_null_fd) < 0) { + fprintf(stderr, "cannot dup /dev/null to stdin : %s\n", + strerror(errno)); - _exit(0); + goto fail; - } - close(STDOUT_FILENO); - if (dup(dev_null_fd) < 0) { - fprintf(stderr, "cannot dup /dev/null to stdout : %s\n", - strerror(errno)); + } + close(STDOUT_FILENO); + if (dup(dev_null_fd) < 0) { + fprintf(stderr, "cannot dup /dev/null to stdout : %s\n", + strerror(errno)); - _exit(0); + goto fail; - } - close(STDERR_FILENO); - if (dup(dev_null_fd) < 0) { - fprintf(stderr, "cannot dup /dev/null to stderr : %s\n", - strerror(errno)); + } + close(STDERR_FILENO); + if (dup(dev_null_fd) < 0) { + fprintf(stderr, "cannot dup /dev/null to stderr : %s\n", + strerror(errno)); - _exit(0); + goto fail; - } - close(dev_null_fd); - daemon_pid = getpid(); - return 0; + } + close(dev_null_fd); + daemon_pid = getpid(); + return 0; + +fail: + kill(parent_pid, SIGALRM); + _exit(0); } - + int @@ -2116,10 +2134,12 @@ main (int argc, char *argv[]) - if (err < 0) - /* error */ - exit(1); + if (err < 0) + /* error */ + exit(1); - else if (err > 0) + else if (err > 0) { + /* wait up to 3 seconds for the child to start */ + sleep(3); - /* parent dies */ - exit(0); + /* parent dies */ + exit(0); - else + } else - /* child lives */ - return (child(NULL)); + /* child lives */ + return (child(NULL)); } diff --git a/SOURCES/0151-RHBZ-1297456-weighted-fix.patch b/SOURCES/0151-RHBZ-1297456-weighted-fix.patch index b94705cf..57b2fed7 100644 --- a/SOURCES/0151-RHBZ-1297456-weighted-fix.patch +++ b/SOURCES/0151-RHBZ-1297456-weighted-fix.patch @@ -2,7 +2,7 @@ libmultipath/print.c | 8 +++--- libmultipath/print.h | 4 +++ libmultipath/prioritizers/weightedpath.c | 37 +++++++++++++++++++++++++++++++ - libmultipath/prioritizers/weightedpath.h | 1 + libmultipath/prioritizers/weightedpath.h | 1 multipath/multipath.conf.5 | 8 +++++- 5 files changed, 53 insertions(+), 5 deletions(-) @@ -11,37 +11,37 @@ Index: multipath-tools-130222/libmultipath/print.c --- multipath-tools-130222.orig/libmultipath/print.c +++ multipath-tools-130222/libmultipath/print.c @@ -468,19 +468,19 @@ out: - return ret; + return ret; } - + -static int +int snprint_host_wwnn (char * buff, size_t len, struct path * pp) { - return snprint_host_attr(buff, len, pp, "node_name"); + return snprint_host_attr(buff, len, pp, "node_name"); } - + -static int +int snprint_host_wwpn (char * buff, size_t len, struct path * pp) { - return snprint_host_attr(buff, len, pp, "port_name"); + return snprint_host_attr(buff, len, pp, "port_name"); } - + -static int +int snprint_tgt_wwpn (char * buff, size_t len, struct path * pp) { - struct udev_device *rport_dev = NULL; + struct udev_device *rport_dev = NULL; @@ -510,7 +510,7 @@ out: } - - + + -static int +int snprint_tgt_wwnn (char * buff, size_t len, struct path * pp) { - if (pp->tgt_node_name[0] == '\0') + if (pp->tgt_node_name[0] == '\0') Index: multipath-tools-130222/libmultipath/print.h =================================================================== --- multipath-tools-130222.orig/libmultipath/print.h @@ -54,7 +54,7 @@ Index: multipath-tools-130222/libmultipath/print.h +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 *); - + void print_multipath_topology (struct multipath * mpp, int verbosity); void print_path (struct path * pp, char * style); Index: multipath-tools-130222/libmultipath/prioritizers/weightedpath.c @@ -68,12 +68,12 @@ Index: multipath-tools-130222/libmultipath/prioritizers/weightedpath.c +#include +#include #include "def_func.h" - + char *get_next_string(char **temp, char *split_char) @@ -43,6 +45,36 @@ char *get_next_string(char **temp, char - return token; + return token; } - + +#define CHECK_LEN \ +do { \ + if ((p - str) >= (len - 1)) { \ @@ -108,17 +108,17 @@ Index: multipath-tools-130222/libmultipath/prioritizers/weightedpath.c int prio_path_weight(struct path *pp, char *prio_args) { @@ -72,6 +104,11 @@ int prio_path_weight(struct path *pp, ch - pp->sg_id.channel, pp->sg_id.scsi_id, pp->sg_id.lun); - } else if (!strcmp(regex, DEV_NAME)) { - strcpy(path, pp->dev); + pp->sg_id.channel, pp->sg_id.scsi_id, pp->sg_id.lun); + } else if (!strcmp(regex, DEV_NAME)) { + strcpy(path, pp->dev); + } else if (!strcmp(regex, WWN)) { + if (build_wwn_path(pp, path, FILE_NAME_SIZE) != 0) { + FREE(arg); + return priority; + } - } else { - condlog(0, "%s: %s - Invalid arguments", pp->dev, - pp->prio.name); + } else { + condlog(0, "%s: %s - Invalid arguments", pp->dev, + pp->prio.name); Index: multipath-tools-130222/libmultipath/prioritizers/weightedpath.h =================================================================== --- multipath-tools-130222.orig/libmultipath/prioritizers/weightedpath.h @@ -129,7 +129,7 @@ Index: multipath-tools-130222/libmultipath/prioritizers/weightedpath.h #define DEV_NAME "devname" +#define WWN "wwn" #define DEFAULT_PRIORITY 0 - + int prio_path_weight(struct path *pp, char *prio_args); Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== diff --git a/SOURCES/0153-RH-fix-i686-size-bug.patch b/SOURCES/0153-RH-fix-i686-size-bug.patch index 8a5aef34..325ec9d2 100644 --- a/SOURCES/0153-RH-fix-i686-size-bug.patch +++ b/SOURCES/0153-RH-fix-i686-size-bug.patch @@ -9,99 +9,99 @@ Index: multipath-tools-130222/multipathd/cli.c +++ multipath-tools-130222/multipathd/cli.c @@ -26,7 +26,7 @@ alloc_handler (void) } - + static int -add_key (vector vec, char * str, unsigned long code, int has_param) +add_key (vector vec, char * str, uint64_t code, int has_param) { - struct key * kw; - + struct key * kw; + @@ -57,7 +57,7 @@ out: } - + int -add_handler (unsigned long fp, int (*fn)(void *, char **, int *, void *)) +add_handler (uint64_t fp, int (*fn)(void *, char **, int *, void *)) { - struct handler * h; - + struct handler * h; + @@ -79,7 +79,7 @@ add_handler (unsigned long fp, int (*fn) } - + static struct handler * -find_handler (unsigned long fp) +find_handler (uint64_t fp) { - int i; - struct handler *h; + int i; + struct handler *h; @@ -92,7 +92,7 @@ find_handler (unsigned long fp) } - + int -set_handler_callback (unsigned long fp, int (*fn)(void *, char **, int *, void *)) +set_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *)) { - struct handler * h = find_handler(fp); - + struct handler * h = find_handler(fp); + @@ -293,11 +293,11 @@ out: - return r; + return r; } - --static unsigned long + +-static unsigned long +static uint64_t fingerprint(vector vec) { - int i; + int i; - unsigned long fp = 0; + uint64_t fp = 0; - struct key * kw; - - if (!vec) + struct key * kw; + + if (!vec) @@ -343,7 +343,7 @@ static int do_genhelp(char *reply, int maxlen) { - int len = 0; - int i, j; + int len = 0; + int i, j; - unsigned long fp; + uint64_t fp; - struct handler * h; - struct key * kw; - + struct handler * h; + struct key * kw; + @@ -442,7 +442,7 @@ parse_cmd (char * cmd, char ** reply, in } - + char * -get_keyparam (vector v, unsigned long code) +get_keyparam (vector v, uint64_t code) { - struct key * kw; - int i; + struct key * kw; + int i; @@ -515,7 +515,7 @@ void cli_exit(void) } - + static int -key_match_fingerprint (struct key * kw, unsigned long fp) +key_match_fingerprint (struct key * kw, uint64_t fp) { - if (!fp) - return 0; + if (!fp) + return 0; @@ -530,7 +530,7 @@ char * key_generator (const char * str, int state) { - static int index, len, has_param; -- static unsigned long rlfp; + static int index, len, has_param; +- static unsigned long rlfp; + static uint64_t rlfp; - struct key * kw; - int i; - struct handler *h; + struct key * kw; + int i; + struct handler *h; @@ -600,7 +600,7 @@ key_generator (const char * str, int sta - * nfp is the candidate fingerprint we try to - * validate against all known command fingerprints. - */ + * nfp is the candidate fingerprint we try to + * validate against all known command fingerprints. + */ - unsigned long nfp = rlfp | kw->code; + uint64_t nfp = rlfp | kw->code; - vector_foreach_slot(handlers, h, i) { - if (!rlfp || ((h->fingerprint & nfp) == nfp)) { - /* + vector_foreach_slot(handlers, h, i) { + if (!rlfp || ((h->fingerprint & nfp) == nfp)) { + /* Index: multipath-tools-130222/multipathd/cli.h =================================================================== --- multipath-tools-130222.orig/multipathd/cli.h @@ -110,8 +110,8 @@ Index: multipath-tools-130222/multipathd/cli.h +#include + enum { - __LIST, - __ADD, + __LIST, + __ADD, @@ -68,10 +70,10 @@ enum { #define WILDCARDS (1 << __WILDCARDS) #define QUIT (1 << __QUIT) @@ -124,24 +124,24 @@ Index: multipath-tools-130222/multipathd/cli.h +#define SETPRSTATUS (1ULL << __SETPRSTATUS) +#define UNSETPRSTATUS (1ULL << __UNSETPRSTATUS) +#define FMT (1ULL << __FMT) - + #define INITIAL_REPLY_LEN 1200 - + @@ -92,21 +94,21 @@ enum { struct key { - char * str; - char * param; + char * str; + char * param; - unsigned long code; + uint64_t code; - int has_param; + int has_param; }; - + struct handler { - unsigned long fingerprint; + uint64_t fingerprint; - int (*fn)(void *, char **, int *, void *); + int (*fn)(void *, char **, int *, void *); }; - + int alloc_handlers (void); -int add_handler (unsigned long fp, int (*fn)(void *, char **, int *, void *)); -int set_handler_callback (unsigned long fp, int (*fn)(void *, char **, int *, void *)); diff --git a/SOURCES/0154-UPBZ-1291406-disable-reinstate.patch b/SOURCES/0154-UPBZ-1291406-disable-reinstate.patch index 3414e898..2da4e3f0 100644 --- a/SOURCES/0154-UPBZ-1291406-disable-reinstate.patch +++ b/SOURCES/0154-UPBZ-1291406-disable-reinstate.patch @@ -10,47 +10,47 @@ Index: multipath-tools-130222/libmultipath/propsel.c +++ multipath-tools-130222/libmultipath/propsel.c @@ -398,9 +398,11 @@ detect_prio(struct path * pp) { - int ret; - struct prio *p = &pp->prio; + int ret; + struct prio *p = &pp->prio; + int tpgs = 0; - + - if (get_target_port_group_support(pp->fd) <= 0) + if ((tpgs = get_target_port_group_support(pp->fd)) <= 0) - return; + return; + pp->tpgs = tpgs; - ret = get_target_port_group(pp->fd, NULL); - if (ret < 0) - return; + ret = get_target_port_group(pp->fd, NULL); + if (ret < 0) + return; @@ -432,7 +434,7 @@ select_prio (struct path * pp) - pp->dev, prio_name(p)); - condlog(3, "%s: prio args = %s (LUN setting)", - pp->dev, prio_args(p)); + pp->dev, prio_name(p)); + condlog(3, "%s: prio args = %s (LUN setting)", + pp->dev, prio_args(p)); - return 0; + goto out; - } - - if (pp->hwe && pp->hwe->prio_name) { + } + + if (pp->hwe && pp->hwe->prio_name) { @@ -441,7 +443,7 @@ select_prio (struct path * pp) - pp->dev, pp->hwe->prio_name); - condlog(3, "%s: prio args = %s (controller setting)", - pp->dev, pp->hwe->prio_args); + pp->dev, pp->hwe->prio_name); + condlog(3, "%s: prio args = %s (controller setting)", + pp->dev, pp->hwe->prio_args); - return 0; + goto out; - } - if (conf->prio_name) { - prio_get(p, conf->prio_name, conf->prio_args); + } + if (conf->prio_name) { + prio_get(p, conf->prio_name, conf->prio_args); @@ -449,13 +451,23 @@ select_prio (struct path * pp) - pp->dev, conf->prio_name); - condlog(3, "%s: prio args = %s (config file default)", - pp->dev, conf->prio_args); + pp->dev, conf->prio_name); + condlog(3, "%s: prio args = %s (config file default)", + pp->dev, conf->prio_args); - return 0; + goto out; - } - prio_get(p, DEFAULT_PRIO, DEFAULT_PRIO_ARGS); - condlog(3, "%s: prio = %s (internal default)", - pp->dev, DEFAULT_PRIO); - condlog(3, "%s: prio args = %s (internal default)", - pp->dev, DEFAULT_PRIO_ARGS); + } + prio_get(p, DEFAULT_PRIO, DEFAULT_PRIO_ARGS); + condlog(3, "%s: prio = %s (internal default)", + pp->dev, DEFAULT_PRIO); + condlog(3, "%s: prio args = %s (internal default)", + pp->dev, DEFAULT_PRIO_ARGS); +out: + /* + * fetch tpgs mode for alua @@ -61,21 +61,21 @@ Index: multipath-tools-130222/libmultipath/propsel.c + (tpgs = get_target_port_group_support(pp->fd)) >= 0) + pp->tpgs = tpgs; + } - return 0; + return 0; } - + Index: multipath-tools-130222/libmultipath/structs.h =================================================================== --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -193,6 +193,7 @@ struct path { - int detect_prio; - int watch_checks; - int wait_checks; + int detect_prio; + int watch_checks; + int wait_checks; + int tpgs; - char * uid_attribute; - struct prio prio; - char * prio_args; + char * uid_attribute; + struct prio prio; + char * prio_args; Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c @@ -85,21 +85,21 @@ Index: multipath-tools-130222/multipathd/main.c #include #include +#include "prioritizers/alua_rtpg.h" - + /* * libcheckers @@ -1248,6 +1249,7 @@ check_path (struct vectors * vecs, struc - int newstate; - int new_path_up = 0; - int chkr_new_path_up = 0; + int newstate; + int new_path_up = 0; + int chkr_new_path_up = 0; + int disable_reinstate = 0; - int oldchkrstate = pp->chkrstate; - - if (!pp->mpp && (pp->missing_udev_info != INFO_MISSING || + int oldchkrstate = pp->chkrstate; + + if (!pp->mpp && (pp->missing_udev_info != INFO_MISSING || @@ -1312,6 +1314,16 @@ check_path (struct vectors * vecs, struc - pp->wait_checks = 0; - } - + pp->wait_checks = 0; + } + + /* + * don't reinstate failed path, if its in stand-by + * and if target supports only implicit tpgs mode. @@ -110,13 +110,13 @@ Index: multipath-tools-130222/multipathd/main.c + pp->mpp->nr_active == 0 && + pp->tpgs == TPGS_IMPLICIT) ? 1 : 0; + - pp->chkrstate = newstate; - if (newstate != pp->state) { - int oldstate = pp->state; + pp->chkrstate = newstate; + if (newstate != pp->state) { + int oldstate = pp->state; @@ -1367,15 +1379,17 @@ check_path (struct vectors * vecs, struc - /* - * reinstate this path - */ + /* + * reinstate this path + */ - if (oldstate != PATH_UP && - oldstate != PATH_GHOST) { - if (pp->mpp->delay_watch_checks > 0) @@ -137,18 +137,18 @@ Index: multipath-tools-130222/multipathd/main.c + pp->watch_checks--; + reinstate_path(pp, 0); + } - } - new_path_up = 1; - + } + new_path_up = 1; + @@ -1390,8 +1404,9 @@ check_path (struct vectors * vecs, struc - enable_group(pp); - } - else if (newstate == PATH_UP || newstate == PATH_GHOST) { + enable_group(pp); + } + else if (newstate == PATH_UP || newstate == PATH_GHOST) { - if (pp->dmstate == PSTATE_FAILED || - pp->dmstate == PSTATE_UNDEF) { + if ((pp->dmstate == PSTATE_FAILED || + pp->dmstate == PSTATE_UNDEF) && + !disable_reinstate) { - /* Clear IO errors */ - reinstate_path(pp, 0); - } else { + /* Clear IO errors */ + reinstate_path(pp, 0); + } else { diff --git a/SOURCES/0155-UPBZ-1300415-PURE-config.patch b/SOURCES/0155-UPBZ-1300415-PURE-config.patch index 8fcf7ad8..9be598cf 100644 --- a/SOURCES/0155-UPBZ-1300415-PURE-config.patch +++ b/SOURCES/0155-UPBZ-1300415-PURE-config.patch @@ -8,9 +8,9 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -1166,6 +1166,22 @@ static struct hwentry default_hw[] = { - .prio_name = DEFAULT_PRIO, - .prio_args = NULL, - }, + .prio_name = DEFAULT_PRIO, + .prio_args = NULL, + }, + { + .vendor = "PURE", + .product = "FlashArray", @@ -27,9 +27,9 @@ Index: multipath-tools-130222/libmultipath/hwtable.c + .dev_loss = 60, + .prio_args = NULL, + }, - /* - * EOL - */ + /* + * EOL + */ Index: multipath-tools-130222/multipath.conf.defaults =================================================================== --- multipath-tools-130222.orig/multipath.conf.defaults diff --git a/SOURCES/0156-UPBZ-1313324-dont-fail-discovery.patch b/SOURCES/0156-UPBZ-1313324-dont-fail-discovery.patch index 7a656812..7e33cfe3 100644 --- a/SOURCES/0156-UPBZ-1313324-dont-fail-discovery.patch +++ b/SOURCES/0156-UPBZ-1313324-dont-fail-discovery.patch @@ -11,18 +11,18 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c --- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c +++ multipath-tools-130222/libmpathpersist/mpath_persist.c @@ -178,7 +178,7 @@ int mpath_persistent_reserve_in (int fd, - goto out; - } - + goto out; + } + - if (path_discovery(pathvec, conf, DI_SYSFS | DI_CHECKER)) { + if (path_discovery(pathvec, conf, DI_SYSFS | DI_CHECKER) < 0) { - ret = MPATH_PR_DMMP_ERROR; - goto out1; - } + ret = MPATH_PR_DMMP_ERROR; + goto out1; + } @@ -262,13 +262,13 @@ int mpath_persistent_reserve_out ( int f - curmp = vector_alloc (); - pathvec = vector_alloc (); - + curmp = vector_alloc (); + pathvec = vector_alloc (); + - if (!curmp || !pathvec){ - condlog (0, "%s: vector allocation failed.", alias); - ret = MPATH_PR_DMMP_ERROR; @@ -33,54 +33,54 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c + ret = MPATH_PR_DMMP_ERROR; + goto out; + } - + - if (path_discovery(pathvec, conf, DI_SYSFS | DI_CHECKER)) { + if (path_discovery(pathvec, conf, DI_SYSFS | DI_CHECKER) < 0) { - ret = MPATH_PR_DMMP_ERROR; - goto out1; - } + ret = MPATH_PR_DMMP_ERROR; + goto out1; + } Index: multipath-tools-130222/libmultipath/discovery.c =================================================================== --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -32,7 +32,7 @@ int store_pathinfo (vector pathvec, vector hwtable, struct udev_device *udevice, - int flag, struct path **pp_ptr) + int flag, struct path **pp_ptr) { - int err = 1; + int err = PATHINFO_FAILED; - struct path * pp; - const char * devname; - + struct path * pp; + const char * devname; + @@ -41,12 +41,12 @@ store_pathinfo (vector pathvec, vector h - - devname = udev_device_get_sysname(udevice); - if (!devname) + + devname = udev_device_get_sysname(udevice); + if (!devname) - return 1; + return PATHINFO_FAILED; - - pp = alloc_path(); - - if (!pp) + + pp = alloc_path(); + + if (!pp) - return 1; + return PATHINFO_FAILED; - - if(safe_sprintf(pp->dev, "%s", devname)) { - condlog(0, "pp->dev too small"); + + if(safe_sprintf(pp->dev, "%s", devname)) { + condlog(0, "pp->dev too small"); @@ -80,19 +80,16 @@ path_discover (vector pathvec, struct co - - devname = udev_device_get_sysname(udevice); - if (!devname) + + devname = udev_device_get_sysname(udevice); + if (!devname) - return 0; + return PATHINFO_FAILED; - - if (filter_devnode(conf->blist_devnode, conf->elist_devnode, - (char *)devname) > 0) + + if (filter_devnode(conf->blist_devnode, conf->elist_devnode, + (char *)devname) > 0) - return 0; + return PATHINFO_SKIPPED; - - pp = find_path_by_dev(pathvec, (char *)devname); - if (!pp) { + + pp = find_path_by_dev(pathvec, (char *)devname); + if (!pp) { - if (store_pathinfo(pathvec, conf->hwtable, - udevice, flag, NULL) != 1) - return 0; @@ -88,31 +88,31 @@ Index: multipath-tools-130222/libmultipath/discovery.c - return 1; + return store_pathinfo(pathvec, conf->hwtable, + udevice, flag, NULL); - } - return pathinfo(pp, conf->hwtable, flag); + } + return pathinfo(pp, conf->hwtable, flag); } @@ -104,11 +101,11 @@ path_discovery (vector pathvec, struct c - struct udev_list_entry *entry; - struct udev_device *udevice; - const char *devpath; + struct udev_list_entry *entry; + struct udev_device *udevice; + const char *devpath; - int r = 0; + int num_paths = 0, total_paths = 0; - - udev_iter = udev_enumerate_new(conf->udev); - if (!udev_iter) + + udev_iter = udev_enumerate_new(conf->udev); + if (!udev_iter) - return 1; + return -ENOMEM; - - udev_enumerate_add_match_subsystem(udev_iter, "block"); - udev_enumerate_scan_devices(udev_iter); + + udev_enumerate_add_match_subsystem(udev_iter, "block"); + udev_enumerate_scan_devices(udev_iter); @@ -121,17 +118,20 @@ path_discovery (vector pathvec, struct c - udevice = udev_device_new_from_syspath(conf->udev, devpath); - if (!udevice) { - condlog(4, "%s: no udev information", devpath); + udevice = udev_device_new_from_syspath(conf->udev, devpath); + if (!udevice) { + condlog(4, "%s: no udev information", devpath); - r++; - continue; - } - devtype = udev_device_get_devtype(udevice); + continue; + } + devtype = udev_device_get_devtype(udevice); - if(devtype && !strncmp(devtype, "disk", 4)) - r += path_discover(pathvec, conf, udevice, flag); + if(devtype && !strncmp(devtype, "disk", 4)) { @@ -121,67 +121,67 @@ Index: multipath-tools-130222/libmultipath/discovery.c + udevice, flag) == PATHINFO_OK) + num_paths++; + } - udev_device_unref(udevice); - } - udev_enumerate_unref(udev_iter); + udev_device_unref(udevice); + } + udev_enumerate_unref(udev_iter); - condlog(4, "Discovery status %d", r); - return r; + condlog(4, "Discovered %d/%d paths", num_paths, total_paths); + return (total_paths - num_paths); } - + #define declare_sysfs_get_str(fname) \ @@ -1021,7 +1021,7 @@ get_state (struct path * pp, int daemon) - - if (!checker_selected(c)) { - if (daemon) { + + if (!checker_selected(c)) { + if (daemon) { - if (pathinfo(pp, conf->hwtable, DI_SYSFS) != 0) { + if (pathinfo(pp, conf->hwtable, DI_SYSFS) != PATHINFO_OK) { - condlog(3, "%s: couldn't get sysfs pathinfo", - pp->dev); - return PATH_UNCHECKED; + condlog(3, "%s: couldn't get sysfs pathinfo", + pp->dev); + return PATH_UNCHECKED; @@ -1140,7 +1140,7 @@ pathinfo (struct path *pp, vector hwtabl - int path_state; - - if (!pp) + int path_state; + + if (!pp) - return 1; + return PATHINFO_FAILED; - - condlog(3, "%s: mask = 0x%x", pp->dev, mask); - + + condlog(3, "%s: mask = 0x%x", pp->dev, mask); + @@ -1148,12 +1148,12 @@ pathinfo (struct path *pp, vector hwtabl - * fetch info available in sysfs - */ - if (mask & DI_SYSFS && sysfs_pathinfo(pp)) + * fetch info available in sysfs + */ + if (mask & DI_SYSFS && sysfs_pathinfo(pp)) - return 1; + return PATHINFO_FAILED; - - if (mask & DI_BLACKLIST && mask & DI_SYSFS) { - if (filter_device(conf->blist_device, conf->elist_device, - pp->vendor_id, pp->product_id) > 0) { + + if (mask & DI_BLACKLIST && mask & DI_SYSFS) { + if (filter_device(conf->blist_device, conf->elist_device, + pp->vendor_id, pp->product_id) > 0) { - return 2; + return PATHINFO_SKIPPED; - } - } - + } + } + @@ -1199,7 +1199,7 @@ pathinfo (struct path *pp, vector hwtabl - if (mask & DI_BLACKLIST && mask & DI_WWID) { - if (filter_wwid(conf->blist_wwid, conf->elist_wwid, - pp->wwid) > 0) { + if (mask & DI_BLACKLIST && mask & DI_WWID) { + if (filter_wwid(conf->blist_wwid, conf->elist_wwid, + pp->wwid) > 0) { - return 2; + return PATHINFO_SKIPPED; - } - } - + } + } + @@ -1213,7 +1213,7 @@ pathinfo (struct path *pp, vector hwtabl - } - } - + } + } + - return 0; + return PATHINFO_OK; - + blank: - /* + /* Index: multipath-tools-130222/libmultipath/discovery.h =================================================================== --- multipath-tools-130222.orig/libmultipath/discovery.h @@ -189,48 +189,48 @@ Index: multipath-tools-130222/libmultipath/discovery.h @@ -24,6 +24,10 @@ #define SCSI_COMMAND_TERMINATED 0x22 #define SG_ERR_DRIVER_SENSE 0x08 - + +#define PATHINFO_OK 0 +#define PATHINFO_FAILED 1 +#define PATHINFO_SKIPPED 2 + struct config; - + int sysfs_get_dev (struct udev_device *udev, char * buff, size_t len); Index: multipath-tools-130222/multipath/main.c =================================================================== --- multipath-tools-130222.orig/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -343,7 +343,7 @@ configure (void) - /* maximum info */ - di_flag = DI_ALL; - + /* maximum info */ + di_flag = DI_ALL; + - if (path_discovery(pathvec, conf, di_flag)) + if (path_discovery(pathvec, conf, di_flag) < 0) - goto out; - - if (conf->verbosity > 2) + goto out; + + if (conf->verbosity > 2) Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -1515,7 +1515,7 @@ configure (struct vectors * vecs, int st - struct multipath * mpp; - struct path * pp; - vector mpvec; + struct multipath * mpp; + struct path * pp; + vector mpvec; - int i; + int i, ret; - - if (!vecs->pathvec && !(vecs->pathvec = vector_alloc())) - return 1; + + if (!vecs->pathvec && !(vecs->pathvec = vector_alloc())) + return 1; @@ -1529,7 +1529,9 @@ configure (struct vectors * vecs, int st - /* - * probe for current path (from sysfs) and map (from dm) sets - */ + /* + * probe for current path (from sysfs) and map (from dm) sets + */ - path_discovery(vecs->pathvec, conf, DI_ALL); + ret = path_discovery(vecs->pathvec, conf, DI_ALL); + if (ret < 0) + return 1; - - vector_foreach_slot (vecs->pathvec, pp, i){ - if (filter_path(conf, pp) > 0){ + + vector_foreach_slot (vecs->pathvec, pp, i){ + if (filter_path(conf, pp) > 0){ diff --git a/SOURCES/0157-RHBZ-1319853-multipath-c-error-msg.patch b/SOURCES/0157-RHBZ-1319853-multipath-c-error-msg.patch index e39bea60..dbf47c7b 100644 --- a/SOURCES/0157-RHBZ-1319853-multipath-c-error-msg.patch +++ b/SOURCES/0157-RHBZ-1319853-multipath-c-error-msg.patch @@ -11,7 +11,7 @@ Index: multipath-tools-130222/libmultipath/alias.c @@ -36,6 +36,14 @@ * See the file COPYING included with this distribution for more details. */ - + +int +valid_alias(char *alias) +{ @@ -20,7 +20,7 @@ Index: multipath-tools-130222/libmultipath/alias.c + return 1; +} + - + static int format_devname(char *name, int id, int len, char *prefix) Index: multipath-tools-130222/libmultipath/alias.h @@ -30,33 +30,34 @@ Index: multipath-tools-130222/libmultipath/alias.h @@ -7,6 +7,7 @@ "# alias wwid\n" \ "#\n" - + +int valid_alias(char *alias); char *get_user_friendly_alias(char *wwid, char *file, char *prefix, - int bindings_readonly); + int bindings_readonly); int get_user_friendly_wwid(char *alias, char *buff, char *file); Index: multipath-tools-130222/multipath/main.c =================================================================== --- multipath-tools-130222.orig/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -454,8 +454,9 @@ get_dev_type(char *dev) { - } - else if (sscanf(dev, "%d:%d", &i, &i) == 2) - return DEV_DEVT; + } + else if (sscanf(dev, "%d:%d", &i, &i) == 2) + return DEV_DEVT; - else + else if (valid_alias(dev)) - return DEV_DEVMAP; + return DEV_DEVMAP; + return DEV_NONE; } - + int @@ -607,6 +608,10 @@ main (int argc, char *argv[]) - - strncpy(conf->dev, argv[optind], FILE_NAME_SIZE); - conf->dev_type = get_dev_type(conf->dev); + + strncpy(conf->dev, argv[optind], FILE_NAME_SIZE); + conf->dev_type = get_dev_type(conf->dev); + if (conf->dev_type == DEV_NONE) { + condlog(0, "'%s' is not a valid argument\n", conf->dev); + goto out; + } - } - conf->daemon = 0; + } + conf->daemon = 0; + diff --git a/SOURCES/0159-UPBZ-1255885-udev-waits.patch b/SOURCES/0159-UPBZ-1255885-udev-waits.patch index 6d428ef4..9e0921b7 100644 --- a/SOURCES/0159-UPBZ-1255885-udev-waits.patch +++ b/SOURCES/0159-UPBZ-1255885-udev-waits.patch @@ -14,7 +14,7 @@ Index: multipath-tools-130222/kpartx/devmapper.c @@ -14,13 +14,6 @@ #define MAX_PREFIX_LEN 8 #define PARAMS_SIZE 1024 - + -#ifndef LIBDM_API_COOKIE -static inline int dm_task_set_cookie(struct dm_task *dmt, uint32_t *c, int a) -{ @@ -27,83 +27,83 @@ Index: multipath-tools-130222/kpartx/devmapper.c { @@ -60,10 +53,13 @@ dm_prereq (char * str, int x, int y, int } - + extern int -dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie, uint16_t udev_flags) { +dm_simplecmd (int task, const char *name, int no_flush, uint16_t udev_flags) { - int r = 0; - int udev_wait_flag = (task == DM_DEVICE_RESUME || - task == DM_DEVICE_REMOVE); + int r = 0; + int udev_wait_flag = (task == DM_DEVICE_RESUME || + task == DM_DEVICE_REMOVE); +#ifdef LIBDM_API_COOKIE + uint32_t cookie = 0; +#endif - struct dm_task *dmt; - - if (!(dmt = dm_task_create(task))) + struct dm_task *dmt; + + if (!(dmt = dm_task_create(task))) @@ -78,10 +74,17 @@ dm_simplecmd (int task, const char *name - if (no_flush) - dm_task_no_flush(dmt); - + if (no_flush) + dm_task_no_flush(dmt); + - if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, ((udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK) | udev_flags)) +#ifdef LIBDM_API_COOKIE + if (!udev_sync) + udev_flags |= DM_UDEV_DISABLE_LIBRARY_FALLBACK; + if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, udev_flags)) - goto out; + goto out; +#endif - r = dm_task_run(dmt); + r = dm_task_run(dmt); - +#ifdef LIBDM_API_COOKIE + if (udev_wait_flag) + dm_udev_wait(cookie); +#endif - out: - dm_task_destroy(dmt); - return r; + out: + dm_task_destroy(dmt); + return r; @@ -90,10 +93,14 @@ dm_simplecmd (int task, const char *name extern int dm_addmap (int task, const char *name, const char *target, - const char *params, uint64_t size, int ro, const char *uuid, int part, + const char *params, uint64_t size, int ro, const char *uuid, int part, - mode_t mode, uid_t uid, gid_t gid, uint32_t *cookie) { + mode_t mode, uid_t uid, gid_t gid) { - int r = 0; - struct dm_task *dmt; - char *prefixed_uuid = NULL; + int r = 0; + struct dm_task *dmt; + char *prefixed_uuid = NULL; +#ifdef LIBDM_API_COOKIE + uint32_t cookie = 0; + uint16_t udev_flags = 0; +#endif - - if (!(dmt = dm_task_create (task))) - return 0; + + if (!(dmt = dm_task_create (task))) + return 0; @@ -128,10 +135,18 @@ dm_addmap (int task, const char *name, c - - dm_task_no_open_count(dmt); - + + dm_task_no_open_count(dmt); + - if (task == DM_DEVICE_CREATE && !dm_task_set_cookie(dmt, cookie, (udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK)) +#ifdef LIBDM_API_COOKIE + if (!udev_sync) + udev_flags = DM_UDEV_DISABLE_LIBRARY_FALLBACK; + if (task == DM_DEVICE_CREATE && + !dm_task_set_cookie(dmt, &cookie, udev_flags)) - goto addout; + goto addout; +#endif - r = dm_task_run (dmt); + r = dm_task_run (dmt); - +#ifdef LIBDM_API_COOKIE + if (task == DM_DEVICE_CREATE) + dm_udev_wait(cookie); +#endif addout: - dm_task_destroy (dmt); - free(prefixed_uuid); + dm_task_destroy (dmt); + free(prefixed_uuid); Index: multipath-tools-130222/kpartx/devmapper.h =================================================================== --- multipath-tools-130222.orig/kpartx/devmapper.h +++ multipath-tools-130222/kpartx/devmapper.h @@ -11,9 +11,9 @@ extern int udev_sync; - + int dm_prereq (char *, int, int, int); -int dm_simplecmd (int, const char *, int, uint32_t *, uint16_t); +int dm_simplecmd (int, const char *, int, uint16_t); @@ -118,169 +118,170 @@ Index: multipath-tools-130222/kpartx/kpartx.c --- multipath-tools-130222.orig/kpartx/kpartx.c +++ multipath-tools-130222/kpartx/kpartx.c @@ -224,7 +224,6 @@ main(int argc, char **argv){ - int hotplug = 0; - int loopcreated = 0; - struct stat buf; + int hotplug = 0; + int loopcreated = 0; + struct stat buf; - uint32_t cookie = 0; - - initpts(); - init_crc32(); + + initpts(); + init_crc32(); @@ -300,6 +299,8 @@ main(int argc, char **argv){ #ifdef LIBDM_API_COOKIE - if (!udev_sync) - dm_udev_set_sync_support(0); + if (!udev_sync) + dm_udev_set_sync_support(0); + else + dm_udev_set_sync_support(1); #endif - - if (dm_prereq(DM_TARGET, 0, 0, 0) && (what == ADD || what == DELETE || what == UPDATE)) { + + if (dm_prereq(DM_TARGET, 0, 0, 0) && (what == ADD || what == DELETE || what == UPDATE)) { @@ -451,7 +452,7 @@ main(int argc, char **argv){ - } - - if (!dm_simplecmd(DM_DEVICE_REMOVE, partname, + } + + if (!dm_simplecmd(DM_DEVICE_REMOVE, partname, - 0, &cookie, 0)) { + 0, 0)) { - r++; - continue; - } + r++; + continue; + } @@ -508,7 +509,7 @@ main(int argc, char **argv){ - if (!dm_addmap(op, partname, DM_TARGET, params, - slices[j].size, ro, uuid, j+1, - buf.st_mode & 0777, buf.st_uid, + if (!dm_addmap(op, partname, DM_TARGET, params, + slices[j].size, ro, uuid, j+1, + buf.st_mode & 0777, buf.st_uid, - buf.st_gid, &cookie)) { + buf.st_gid)) { - fprintf(stderr, "create/reload failed on %s\n", - partname); - r++; + fprintf(stderr, "create/reload failed on %s\n", + partname); + r++; @@ -516,12 +517,13 @@ main(int argc, char **argv){ - } - if (op == DM_DEVICE_RELOAD && - !dm_simplecmd(DM_DEVICE_RESUME, partname, + } + if (op == DM_DEVICE_RELOAD && + !dm_simplecmd(DM_DEVICE_RESUME, partname, - 1, &cookie, MPATH_UDEV_RELOAD_FLAG)) { + 1, MPATH_UDEV_RELOAD_FLAG)) { - fprintf(stderr, "resume failed on %s\n", - partname); - r++; - continue; - } + fprintf(stderr, "resume failed on %s\n", + partname); + r++; + continue; + } + - dm_devn(partname, &slices[j].major, - &slices[j].minor); - + dm_devn(partname, &slices[j].major, + &slices[j].minor); + @@ -560,7 +562,7 @@ main(int argc, char **argv){ - } - - if (!dm_simplecmd(DM_DEVICE_REMOVE, + } + + if (!dm_simplecmd(DM_DEVICE_REMOVE, - partname, 1, &cookie, 0)) { + partname, 1, 0)) { - r++; - continue; - } + r++; + continue; + } @@ -586,9 +588,7 @@ main(int argc, char **argv){ - } - printf("loop deleted : %s\n", device); - } + } + printf("loop deleted : %s\n", device); + } -#ifdef LIBDM_API_COOKIE - dm_udev_wait(cookie); -#endif + - dm_lib_release(); - dm_lib_exit(); - + dm_lib_release(); + dm_lib_exit(); + Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -129,7 +129,6 @@ struct config { - uid_t uid; - gid_t gid; - mode_t mode; + uid_t uid; + gid_t gid; + mode_t mode; - uint32_t cookie; - int reassign_maps; - int retain_hwhandler; - int detect_prio; + int reassign_maps; + int retain_hwhandler; + int detect_prio; Index: multipath-tools-130222/libmultipath/devmapper.c =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -215,6 +215,7 @@ dm_simplecmd (int task, const char *name - int r = 0; - int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME || - task == DM_DEVICE_REMOVE)); + int r = 0; + int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME || + task == DM_DEVICE_REMOVE)); + uint32_t cookie = 0; - struct dm_task *dmt; - - if (!(dmt = dm_task_create (task))) + struct dm_task *dmt; + + if (!(dmt = dm_task_create (task))) @@ -233,10 +234,12 @@ dm_simplecmd (int task, const char *name - if (do_deferred(deferred_remove)) - dm_task_deferred_remove(dmt); + if (do_deferred(deferred_remove)) + dm_task_deferred_remove(dmt); #endif - if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags)) + if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags)) - goto out; - r = dm_task_run (dmt); - + goto out; + r = dm_task_run (dmt); + + if (udev_wait_flag) + udev_wait(cookie); - out: - dm_task_destroy (dmt); - return r; + out: + dm_task_destroy (dmt); + return r; @@ -264,6 +267,7 @@ dm_addmap (int task, const char *target, - int r = 0; - struct dm_task *dmt; - char *prefixed_uuid = NULL; + int r = 0; + struct dm_task *dmt; + char *prefixed_uuid = NULL; + uint32_t cookie = 0; - - if (!(dmt = dm_task_create (task))) - return 0; + + if (!(dmt = dm_task_create (task))) + return 0; @@ -304,10 +308,12 @@ dm_addmap (int task, const char *target, - dm_task_no_open_count(dmt); - - if (task == DM_DEVICE_CREATE && + dm_task_no_open_count(dmt); + + if (task == DM_DEVICE_CREATE && - !dm_task_set_cookie(dmt, &conf->cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0)) + !dm_task_set_cookie(dmt, &cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0)) - goto freeout; - r = dm_task_run (dmt); - + goto freeout; + r = dm_task_run (dmt); + + if (task == DM_DEVICE_CREATE) + udev_wait(cookie); - freeout: - if (prefixed_uuid) - FREE(prefixed_uuid); + freeout: + if (prefixed_uuid) + FREE(prefixed_uuid); @@ -1366,6 +1372,7 @@ dm_rename (const char * old, char * new) { - int r = 0; - struct dm_task *dmt; + int r = 0; + struct dm_task *dmt; + uint32_t cookie; - - if (dm_rename_partmaps(old, new)) - return r; + + if (dm_rename_partmaps(old, new)) + return r; @@ -1381,12 +1388,12 @@ dm_rename (const char * old, char * new) - - dm_task_no_open_count(dmt); - + + dm_task_no_open_count(dmt); + - if (!dm_task_set_cookie(dmt, &conf->cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0)) - goto out; - if (!dm_task_run(dmt)) + if (!dm_task_set_cookie(dmt, &cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0)) - goto out; + goto out; + r = dm_task_run(dmt); + + udev_wait(cookie); - + - r = 1; out: - dm_task_destroy(dmt); - return r; + dm_task_destroy(dmt); + return r; Index: multipath-tools-130222/multipath/main.c =================================================================== --- multipath-tools-130222.orig/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -681,8 +681,6 @@ main (int argc, char *argv[]) - condlog(3, "restart multipath configuration process"); - + condlog(3, "restart multipath configuration process"); + out: - udev_wait(conf->cookie); - - dm_lib_release(); - dm_lib_exit(); + dm_lib_release(); + dm_lib_exit(); + diff --git a/SOURCES/0160-RH-udev-flags.patch b/SOURCES/0160-RH-udev-flags.patch index b7327c11..29a2c9ca 100644 --- a/SOURCES/0160-RH-udev-flags.patch +++ b/SOURCES/0160-RH-udev-flags.patch @@ -9,11 +9,12 @@ Index: multipath-tools-130222/libmultipath/devmapper.c @@ -213,8 +213,9 @@ dm_prereq (void) static int dm_simplecmd (int task, const char *name, int no_flush, int need_sync, uint16_t udev_flags, int deferred_remove) { - int r = 0; + int r = 0; - int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME || - task == DM_DEVICE_REMOVE)); + int udev_wait_flag = ((need_sync && (task == DM_DEVICE_RESUME || + task == DM_DEVICE_REMOVE)) || + udev_flags); - uint32_t cookie = 0; - struct dm_task *dmt; + uint32_t cookie = 0; + struct dm_task *dmt; + diff --git a/SOURCES/0161-RHBZ-1311659-no-kpartx.patch b/SOURCES/0161-RHBZ-1311659-no-kpartx.patch index 77a69bfc..8656548c 100644 --- a/SOURCES/0161-RHBZ-1311659-no-kpartx.patch +++ b/SOURCES/0161-RHBZ-1311659-no-kpartx.patch @@ -2,15 +2,15 @@ libmultipath/config.c | 3 + libmultipath/config.h | 3 + libmultipath/configure.c | 15 +++-- - libmultipath/defaults.h | 1 + libmultipath/defaults.h | 1 libmultipath/devmapper.c | 35 +++++++++---- libmultipath/devmapper.h | 8 ++- libmultipath/dict.c | 114 +++++++++++++++++++++++++++++++++++++++++++++ libmultipath/propsel.c | 26 ++++++++++ - libmultipath/propsel.h | 1 + libmultipath/propsel.h | 1 libmultipath/structs.h | 7 ++ multipath/multipath.conf.5 | 10 +++ - multipath/multipath.rules | 1 + multipath/multipath.rules | 1 multipathd/cli_handlers.c | 4 + 13 files changed, 211 insertions(+), 17 deletions(-) @@ -19,118 +19,118 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -343,6 +343,7 @@ merge_hwe (struct hwentry * dst, struct - merge_num(deferred_remove); - merge_num(delay_watch_checks); - merge_num(delay_wait_checks); + merge_num(deferred_remove); + merge_num(delay_watch_checks); + merge_num(delay_wait_checks); + merge_num(skip_kpartx); - - /* - * Make sure features is consistent with + + /* + * Make sure features is consistent with @@ -403,6 +404,7 @@ overwrite_hwe (struct hwentry * dst, str - overwrite_num(deferred_remove); - overwrite_num(delay_watch_checks); - overwrite_num(delay_wait_checks); + overwrite_num(deferred_remove); + overwrite_num(delay_watch_checks); + overwrite_num(delay_wait_checks); + overwrite_num(skip_kpartx); - - /* - * Make sure features is consistent with + + /* + * Make sure features is consistent with @@ -677,6 +679,7 @@ load_config (char * file, struct udev *u - conf->retrigger_delay = DEFAULT_RETRIGGER_DELAY; - conf->new_bindings_in_boot = 0; - conf->uev_wait_timeout = DEFAULT_UEV_WAIT_TIMEOUT; + conf->retrigger_delay = DEFAULT_RETRIGGER_DELAY; + conf->new_bindings_in_boot = 0; + conf->uev_wait_timeout = DEFAULT_UEV_WAIT_TIMEOUT; + conf->skip_kpartx = DEFAULT_SKIP_KPARTX; - - /* - * preload default hwtable + + /* + * preload default hwtable Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -64,6 +64,7 @@ struct hwentry { - int deferred_remove; - int delay_watch_checks; - int delay_wait_checks; + int deferred_remove; + int delay_watch_checks; + int delay_wait_checks; + int skip_kpartx; - char * bl_product; + char * bl_product; }; - + @@ -90,6 +91,7 @@ struct mpentry { - int deferred_remove; - int delay_watch_checks; - int delay_wait_checks; + int deferred_remove; + int delay_watch_checks; + int delay_wait_checks; + int skip_kpartx; - uid_t uid; - gid_t gid; - mode_t mode; + uid_t uid; + gid_t gid; + mode_t mode; @@ -143,6 +145,7 @@ struct config { - int new_bindings_in_boot; - int delayed_reconfig; - int uev_wait_timeout; + int new_bindings_in_boot; + int delayed_reconfig; + int uev_wait_timeout; + int skip_kpartx; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/libmultipath/configure.c =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -294,6 +294,7 @@ setup_map (struct multipath * mpp, char - select_deferred_remove(mpp); - select_delay_watch_checks(mpp); - select_delay_wait_checks(mpp); + select_deferred_remove(mpp); + select_delay_watch_checks(mpp); + select_delay_wait_checks(mpp); + select_skip_kpartx(mpp); - - sysfs_set_scsi_tmo(mpp); - /* + + sysfs_set_scsi_tmo(mpp); + /* @@ -446,6 +447,7 @@ select_action (struct multipath * mpp, v - } - mpp->force_udev_reload = !pathcount(mpp, PATH_WILD); - if (cmpp->size != mpp->size) { + } + mpp->force_udev_reload = !pathcount(mpp, PATH_WILD); + if (cmpp->size != mpp->size) { + mpp->force_udev_reload = 1; - mpp->action = ACT_RESIZE; - condlog(3, "%s: set ACT_RESIZE (size change)", - mpp->alias); + mpp->action = ACT_RESIZE; + condlog(3, "%s: set ACT_RESIZE (size change)", + mpp->alias); @@ -609,6 +611,7 @@ extern int domap (struct multipath * mpp, char * params) { - int r = 0; + int r = 0; + uint16_t udev_flags = ((mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG) | ((mpp->skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0); - - /* - * last chance to quit before touching the devmaps + + /* + * last chance to quit before touching the devmaps @@ -654,25 +657,27 @@ domap (struct multipath * mpp, char * pa - case ACT_RELOAD: - r = dm_addmap_reload(mpp, params); - if (r) + case ACT_RELOAD: + r = dm_addmap_reload(mpp, params); + if (r) - r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, (mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG); + r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, + udev_flags); - break; - - case ACT_RESIZE: - r = dm_addmap_reload(mpp, params); - if (r) + break; + + case ACT_RESIZE: + r = dm_addmap_reload(mpp, params); + if (r) - r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1, 0); + r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1, + udev_flags); - break; - - case ACT_RENAME: + break; + + case ACT_RENAME: - r = dm_rename(mpp->alias_old, mpp->alias); + r = dm_rename(mpp->alias_old, mpp->alias, mpp->skip_kpartx); - break; - - case ACT_RENAME2: + break; + + case ACT_RENAME2: - r = dm_rename(mpp->alias_old, mpp->alias); + r = dm_rename(mpp->alias_old, mpp->alias, mpp->skip_kpartx); - if (r) { - r = dm_addmap_reload(mpp, params); - if (r) + if (r) { + r = dm_addmap_reload(mpp, params); + if (r) - r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, (mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG); + r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, udev_flags); - } - break; - + } + break; + Index: multipath-tools-130222/libmultipath/defaults.h =================================================================== --- multipath-tools-130222.orig/libmultipath/defaults.h @@ -140,7 +140,7 @@ Index: multipath-tools-130222/libmultipath/defaults.h #define DEFAULT_RETRIGGER_TRIES 3 #define DEFAULT_UEV_WAIT_TIMEOUT 30 +#define DEFAULT_SKIP_KPARTX SKIP_KPARTX_OFF - + #define DEFAULT_CHECKINT 5 #define MAX_CHECKINT(a) (a << 2) Index: multipath-tools-130222/libmultipath/devmapper.c @@ -148,58 +148,58 @@ Index: multipath-tools-130222/libmultipath/devmapper.c --- multipath-tools-130222.orig/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -262,13 +262,14 @@ dm_device_remove (const char *name, int - deferred_remove); + deferred_remove); } - + -extern int +static int dm_addmap (int task, const char *target, struct multipath *mpp, char * params, - int use_uuid, int ro) { + int use_uuid, int ro, int skip_kpartx) { - int r = 0; - struct dm_task *dmt; - char *prefixed_uuid = NULL; - uint32_t cookie = 0; + int r = 0; + struct dm_task *dmt; + char *prefixed_uuid = NULL; + uint32_t cookie = 0; + uint16_t udev_flags = ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | ((skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0); - - if (!(dmt = dm_task_create (task))) - return 0; + + if (!(dmt = dm_task_create (task))) + return 0; @@ -309,7 +310,7 @@ dm_addmap (int task, const char *target, - dm_task_no_open_count(dmt); - - if (task == DM_DEVICE_CREATE && + dm_task_no_open_count(dmt); + + if (task == DM_DEVICE_CREATE && - !dm_task_set_cookie(dmt, &cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0)) + !dm_task_set_cookie(dmt, &cookie, udev_flags)) - goto freeout; - r = dm_task_run (dmt); - + goto freeout; + r = dm_task_run (dmt); + @@ -332,7 +333,8 @@ dm_addmap_create (struct multipath *mpp, - for (ro = 0; ro <= 1; ro++) { - int err; - + for (ro = 0; ro <= 1; ro++) { + int err; + - if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, mpp, params, 1, ro)) + if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, + mpp, params, 1, ro, mpp->skip_kpartx)) - return 1; - /* - * DM_DEVICE_CREATE is actually DM_DEV_CREATE + DM_TABLE_LOAD. + return 1; + /* + * DM_DEVICE_CREATE is actually DM_DEV_CREATE + DM_TABLE_LOAD. @@ -354,11 +356,11 @@ dm_addmap_create (struct multipath *mpp, - + extern int dm_addmap_reload (struct multipath *mpp, char *params) { - if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW)) + if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW, SKIP_KPARTX_OFF)) - return 1; - if (errno != EROFS) - return 0; + return 1; + if (errno != EROFS) + return 0; - return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RO); + return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RO, SKIP_KPARTX_OFF); } - + extern int @@ -720,6 +722,12 @@ out: } - + static int +has_partmap(const char *name, void *data) +{ @@ -209,65 +209,65 @@ Index: multipath-tools-130222/libmultipath/devmapper.c +static int partmap_in_use(const char *name, void *data) { - int part_count, *ret_count = (int *)data; + int part_count, *ret_count = (int *)data; @@ -798,10 +806,16 @@ dm_suspend_and_flush_map (const char * m - int s = 0, queue_if_no_path = 0; - unsigned long long mapsize; - char params[PARAMS_SIZE] = {0}; + int s = 0, queue_if_no_path = 0; + unsigned long long mapsize; + char params[PARAMS_SIZE] = {0}; + int udev_flags = 0; - - if (!dm_is_mpath(mapname)) - return 0; /* nothing to do */ - + + if (!dm_is_mpath(mapname)) + return 0; /* nothing to do */ + + /* if the device currently has no partitions, do not + run kpartx on it if you fail to delete it */ + if (do_foreach_partmaps(mapname, has_partmap, NULL) == 0) + udev_flags |= MPATH_UDEV_NO_KPARTX_FLAG; + - if (!dm_get_map(mapname, &mapsize, params)) { - if (strstr(params, "queue_if_no_path")) - queue_if_no_path = 1; + if (!dm_get_map(mapname, &mapsize, params)) { + if (strstr(params, "queue_if_no_path")) + queue_if_no_path = 1; @@ -820,7 +834,7 @@ dm_suspend_and_flush_map (const char * m - return 0; - } - condlog(2, "failed to remove multipath map %s", mapname); + return 0; + } + condlog(2, "failed to remove multipath map %s", mapname); - dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname, 0); + dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname, udev_flags); - if (queue_if_no_path) - s = dm_queue_if_no_path((char *)mapname, 1); - return 1; + if (queue_if_no_path) + s = dm_queue_if_no_path((char *)mapname, 1); + return 1; @@ -1349,7 +1363,7 @@ rename_partmap (const char *name, void * - for (offset = strlen(rd->old); name[offset] && !(isdigit(name[offset])); offset++); /* do nothing */ - snprintf(buff, PARAMS_SIZE, "%s%s%s", rd->new, rd->delim, - name + offset); + for (offset = strlen(rd->old); name[offset] && !(isdigit(name[offset])); offset++); /* do nothing */ + snprintf(buff, PARAMS_SIZE, "%s%s%s", rd->new, rd->delim, + name + offset); - dm_rename(name, buff); + dm_rename(name, buff, SKIP_KPARTX_OFF); - condlog(4, "partition map %s renamed", name); - return 0; + condlog(4, "partition map %s renamed", name); + return 0; } @@ -1369,11 +1383,12 @@ dm_rename_partmaps (const char * old, ch } - + int -dm_rename (const char * old, char * new) +dm_rename (const char * old, char * new, int skip_kpartx) { - int r = 0; - struct dm_task *dmt; - uint32_t cookie; + int r = 0; + struct dm_task *dmt; + uint32_t cookie; + uint16_t udev_flags = ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | ((skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0); - - if (dm_rename_partmaps(old, new)) - return r; + + if (dm_rename_partmaps(old, new)) + return r; @@ -1389,7 +1404,7 @@ dm_rename (const char * old, char * new) - - dm_task_no_open_count(dmt); - + + dm_task_no_open_count(dmt); + - if (!dm_task_set_cookie(dmt, &cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0)) + if (!dm_task_set_cookie(dmt, &cookie, udev_flags)) - goto out; - r = dm_task_run(dmt); - + goto out; + r = dm_task_run(dmt); + Index: multipath-tools-130222/libmultipath/devmapper.h =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.h @@ -275,7 +275,7 @@ Index: multipath-tools-130222/libmultipath/devmapper.h @@ -12,6 +12,12 @@ #define MPATH_UDEV_RELOAD_FLAG 0 #endif - + +#ifdef DM_SUBSYSTEM_UDEV_FLAG1 +#define MPATH_UDEV_NO_KPARTX_FLAG DM_SUBSYSTEM_UDEV_FLAG1 +#else @@ -286,7 +286,7 @@ Index: multipath-tools-130222/libmultipath/devmapper.h int dm_prereq (void); int dm_drv_version (unsigned int * version, char * str); @@ -47,7 +53,7 @@ int dm_remove_partmaps (const char * map - int deferred_remove); + int deferred_remove); int dm_get_uuid(char *name, char *uuid); int dm_get_info (char * mapname, struct dm_info ** dmi); -int dm_rename (const char * old, char * new); @@ -300,7 +300,7 @@ Index: multipath-tools-130222/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -779,6 +779,29 @@ def_deferred_remove_handler(vector strve } - + static int +def_skip_kpartx_handler(vector strvec) +{ @@ -327,10 +327,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int def_ignore_new_boot_devs_handler(vector strvec) { - char * buff; + char * buff; @@ -1629,6 +1652,33 @@ hw_deferred_remove_handler(vector strvec } - + static int +hw_skip_kpartx_handler(vector strvec) +{ @@ -361,10 +361,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int hw_delay_watch_checks_handler(vector strvec) { - struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable); + struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable); @@ -2154,6 +2204,32 @@ mp_deferred_remove_handler(vector strvec } - + static int +mp_skip_kpartx_handler(vector strvec) +{ @@ -394,10 +394,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int mp_delay_watch_checks_handler(vector strvec) { - struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable); + struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable); @@ -2461,6 +2537,19 @@ snprint_mp_deferred_remove (char * buff, } - + static int +snprint_mp_skip_kpartx (char * buff, int len, void * data) +{ @@ -414,10 +414,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_mp_delay_watch_checks(char * buff, int len, void * data) { - struct mpentry * mpe = (struct mpentry *)data; + struct mpentry * mpe = (struct mpentry *)data; @@ -2813,6 +2902,19 @@ snprint_hw_deferred_remove(char * buff, } - + static int +snprint_hw_skip_kpartx(char * buff, int len, void * data) +{ @@ -434,10 +434,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_hw_delay_watch_checks(char * buff, int len, void * data) { - struct hwentry * hwe = (struct hwentry *)data; + struct hwentry * hwe = (struct hwentry *)data; @@ -3231,6 +3333,15 @@ snprint_def_deferred_remove(char * buff, } - + static int +snprint_def_skip_kpartx(char * buff, int len, void * data) +{ @@ -450,37 +450,37 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_def_ignore_new_boot_devs(char * buff, int len, void * data) { - if (conf->ignore_new_boot_devs == 1) + if (conf->ignore_new_boot_devs == 1) @@ -3364,6 +3475,7 @@ init_keywords(void) - install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync); - install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove); - install_keyword("ignore_new_boot_devs", &def_ignore_new_boot_devs_handler, &snprint_def_ignore_new_boot_devs); + install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync); + install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove); + install_keyword("ignore_new_boot_devs", &def_ignore_new_boot_devs_handler, &snprint_def_ignore_new_boot_devs); + install_keyword("skip_kpartx", &def_skip_kpartx_handler, &snprint_def_skip_kpartx); - install_keyword("config_dir", &def_config_dir_handler, &snprint_def_config_dir); - install_keyword("delay_watch_checks", &def_delay_watch_checks_handler, &snprint_def_delay_watch_checks); - install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks); + install_keyword("config_dir", &def_config_dir_handler, &snprint_def_config_dir); + install_keyword("delay_watch_checks", &def_delay_watch_checks_handler, &snprint_def_delay_watch_checks); + install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks); @@ -3438,6 +3550,7 @@ init_keywords(void) - install_keyword("deferred_remove", &hw_deferred_remove_handler, &snprint_hw_deferred_remove); - install_keyword("delay_watch_checks", &hw_delay_watch_checks_handler, &snprint_hw_delay_watch_checks); - install_keyword("delay_wait_checks", &hw_delay_wait_checks_handler, &snprint_hw_delay_wait_checks); + install_keyword("deferred_remove", &hw_deferred_remove_handler, &snprint_hw_deferred_remove); + install_keyword("delay_watch_checks", &hw_delay_watch_checks_handler, &snprint_hw_delay_watch_checks); + install_keyword("delay_wait_checks", &hw_delay_wait_checks_handler, &snprint_hw_delay_wait_checks); + install_keyword("skip_kpartx", &hw_skip_kpartx_handler, &snprint_hw_skip_kpartx); - install_sublevel_end(); - - install_keyword_root("multipaths", &multipaths_handler); + install_sublevel_end(); + + install_keyword_root("multipaths", &multipaths_handler); @@ -3465,5 +3578,6 @@ init_keywords(void) - install_keyword("deferred_remove", &mp_deferred_remove_handler, &snprint_mp_deferred_remove); - install_keyword("delay_watch_checks", &mp_delay_watch_checks_handler, &snprint_mp_delay_watch_checks); - install_keyword("delay_wait_checks", &mp_delay_wait_checks_handler, &snprint_mp_delay_wait_checks); + install_keyword("deferred_remove", &mp_deferred_remove_handler, &snprint_mp_deferred_remove); + install_keyword("delay_watch_checks", &mp_delay_watch_checks_handler, &snprint_mp_delay_watch_checks); + install_keyword("delay_wait_checks", &mp_delay_wait_checks_handler, &snprint_mp_delay_wait_checks); + install_keyword("skip_kpartx", &mp_skip_kpartx_handler, &snprint_mp_skip_kpartx); - install_sublevel_end(); + install_sublevel_end(); } Index: multipath-tools-130222/libmultipath/propsel.c =================================================================== --- multipath-tools-130222.orig/libmultipath/propsel.c +++ multipath-tools-130222/libmultipath/propsel.c @@ -854,3 +854,29 @@ select_delay_wait_checks (struct multipa - condlog(3, "delay_wait_checks = DISABLED (internal default)"); - return 0; + condlog(3, "delay_wait_checks = DISABLED (internal default)"); + return 0; } + +extern int @@ -522,9 +522,9 @@ Index: multipath-tools-130222/libmultipath/structs.h --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -121,6 +121,12 @@ enum deferred_remove_states { - DEFERRED_REMOVE_IN_PROGRESS, + DEFERRED_REMOVE_IN_PROGRESS, }; - + +enum skip_kpartx_states { + SKIP_KPARTX_UNDEF, + SKIP_KPARTX_OFF, @@ -532,16 +532,16 @@ Index: multipath-tools-130222/libmultipath/structs.h +}; + enum scsi_protocol { - SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */ - SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */ + SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */ + SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */ @@ -236,6 +242,7 @@ struct multipath { - int delay_watch_checks; - int delay_wait_checks; - int force_udev_reload; + int delay_watch_checks; + int delay_wait_checks; + int force_udev_reload; + int skip_kpartx; - unsigned int dev_loss; - uid_t uid; - gid_t gid; + unsigned int dev_loss; + uid_t uid; + gid_t gid; Index: multipath-tools-130222/multipath/multipath.rules =================================================================== --- multipath-tools-130222.orig/multipath/multipath.rules @@ -559,28 +559,28 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c --- multipath-tools-130222.orig/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -825,19 +825,21 @@ cli_resume(void * v, char ** reply, int - char * param = get_keyparam(v, MAP); - int r; - struct multipath * mpp; + char * param = get_keyparam(v, MAP); + int r; + struct multipath * mpp; + uint16_t udev_flags; - - param = convert_dev(param, 0); - mpp = find_mp_by_alias(vecs->mpvec, param); - if (!mpp) - return 1; - + + param = convert_dev(param, 0); + mpp = find_mp_by_alias(vecs->mpvec, param); + if (!mpp) + return 1; + + udev_flags = (mpp->skip_kpartx)? MPATH_UDEV_NO_KPARTX_FLAG : 0; - if (mpp->wait_for_udev) { - condlog(2, "%s: device not fully created, failing resume", - mpp->alias); - return 1; - } - + if (mpp->wait_for_udev) { + condlog(2, "%s: device not fully created, failing resume", + mpp->alias); + return 1; + } + - r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param, 0); + r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param, udev_flags); - - condlog(2, "%s: resume (operator)", param); - + + condlog(2, "%s: resume (operator)", param); + Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.conf.5 diff --git a/SOURCES/0162-RHBZ-1333331-huawei-config.patch b/SOURCES/0162-RHBZ-1333331-huawei-config.patch index c8a08f92..7b97e073 100644 --- a/SOURCES/0162-RHBZ-1333331-huawei-config.patch +++ b/SOURCES/0162-RHBZ-1333331-huawei-config.patch @@ -7,9 +7,9 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -1182,6 +1182,15 @@ static struct hwentry default_hw[] = { - .dev_loss = 60, - .prio_args = NULL, - }, + .dev_loss = 60, + .prio_args = NULL, + }, + { + .vendor = "HUAWEI", + .product = "XSG1", @@ -19,6 +19,6 @@ Index: multipath-tools-130222/libmultipath/hwtable.c + .pgfailback = -FAILBACK_IMMEDIATE, + .checker_name = TUR, + }, - /* - * EOL - */ + /* + * EOL + */ diff --git a/SOURCES/0163-UPBZ-1333492-resize-map.patch b/SOURCES/0163-UPBZ-1333492-resize-map.patch index 9eefd24a..cc24b6ff 100644 --- a/SOURCES/0163-UPBZ-1333492-resize-map.patch +++ b/SOURCES/0163-UPBZ-1333492-resize-map.patch @@ -7,18 +7,18 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c --- multipath-tools-130222.orig/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -571,6 +571,7 @@ int resize_map(struct multipath *mpp, un - struct vectors * vecs) + struct vectors * vecs) { - char params[PARAMS_SIZE] = {0}; + char params[PARAMS_SIZE] = {0}; + unsigned long long orig_size = mpp->size; - - mpp->size = size; - update_mpp_paths(mpp, vecs->pathvec); + + mpp->size = size; + update_mpp_paths(mpp, vecs->pathvec); @@ -579,6 +580,7 @@ int resize_map(struct multipath *mpp, un - if (domap(mpp, params) <= 0) { - condlog(0, "%s: failed to resize map : %s", mpp->alias, - strerror(errno)); + if (domap(mpp, params) <= 0) { + condlog(0, "%s: failed to resize map : %s", mpp->alias, + strerror(errno)); + mpp->size = orig_size; - return 1; - } - return 0; + return 1; + } + return 0; diff --git a/SOURCES/0164-RHBZ-1311463-dos-part-rollover.patch b/SOURCES/0164-RHBZ-1311463-dos-part-rollover.patch index 290e06de..dc511f2e 100644 --- a/SOURCES/0164-RHBZ-1311463-dos-part-rollover.patch +++ b/SOURCES/0164-RHBZ-1311463-dos-part-rollover.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/kpartx/dos.c --- multipath-tools-130222.orig/kpartx/dos.c +++ multipath-tools-130222/kpartx/dos.c @@ -78,7 +78,7 @@ read_dos_pt(int fd, struct slice all, st - unsigned long offset = all.start; - int i, n=4; - unsigned char *bp; + unsigned long offset = all.start; + int i, n=4; + unsigned char *bp; - int sector_size_mul = get_sector_size(fd)/512; + uint64_t sector_size_mul = get_sector_size(fd)/512; - - bp = (unsigned char *)getblock(fd, offset); - if (bp == NULL) + + bp = (unsigned char *)getblock(fd, offset); + if (bp == NULL) diff --git a/SOURCES/0165-UPBZ-1341748-MSA-2040-conf.patch b/SOURCES/0165-UPBZ-1341748-MSA-2040-conf.patch index feb3176f..6c6e64a1 100644 --- a/SOURCES/0165-UPBZ-1341748-MSA-2040-conf.patch +++ b/SOURCES/0165-UPBZ-1341748-MSA-2040-conf.patch @@ -7,9 +7,9 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -175,6 +175,21 @@ static struct hwentry default_hw[] = { - .prio_name = PRIO_ALUA, - .prio_args = NULL, - }, + .prio_name = PRIO_ALUA, + .prio_args = NULL, + }, + { + /* HP MSA 1040/2040 product family */ + .vendor = "HP", @@ -25,6 +25,6 @@ Index: multipath-tools-130222/libmultipath/hwtable.c + .prio_name = PRIO_ALUA, + .prio_args = NULL, + }, - - { - /* HP SVSP */ + + { + /* HP SVSP */ diff --git a/SOURCES/0166-RHBZ-1323429-dont-allow-new-wwid.patch b/SOURCES/0166-RHBZ-1323429-dont-allow-new-wwid.patch index a1741081..bcc61cc0 100644 --- a/SOURCES/0166-RHBZ-1323429-dont-allow-new-wwid.patch +++ b/SOURCES/0166-RHBZ-1323429-dont-allow-new-wwid.patch @@ -7,9 +7,9 @@ Index: multipath-tools-130222/libmultipath/dmparser.c --- multipath-tools-130222.orig/libmultipath/dmparser.c +++ multipath-tools-130222/libmultipath/dmparser.c @@ -360,6 +360,15 @@ disassemble_map (vector pathvec, char * - else if (!strlen(pp->wwid)) - strncpy(pp->wwid, mpp->wwid, WWID_SIZE); - + else if (!strlen(pp->wwid)) + strncpy(pp->wwid, mpp->wwid, WWID_SIZE); + + /* + * Something went wrong. Likely the user changed the + * path uid_attribute after creating a device @@ -19,5 +19,6 @@ Index: multipath-tools-130222/libmultipath/dmparser.c + strncpy(pp->wwid, mpp->wwid, WWID_SIZE); + } + - pgp->id ^= (long)pp; - pp->pgindex = i + 1; + pgp->id ^= (long)pp; + pp->pgindex = i + 1; + diff --git a/SOURCES/0167-RHBZ-1335176-fix-show-cmds.patch b/SOURCES/0167-RHBZ-1335176-fix-show-cmds.patch index 9f41e9e4..cbc58175 100644 --- a/SOURCES/0167-RHBZ-1335176-fix-show-cmds.patch +++ b/SOURCES/0167-RHBZ-1335176-fix-show-cmds.patch @@ -12,7 +12,7 @@ Index: multipath-tools-130222/libmultipath/print.c +++ multipath-tools-130222/libmultipath/print.c @@ -248,6 +248,12 @@ snprint_q_timeouts (char * buff, size_t } - + static int +snprint_map_failures (char * buff, size_t len, struct multipath * mpp) +{ @@ -22,27 +22,27 @@ Index: multipath-tools-130222/libmultipath/print.c +static int snprint_multipath_uuid (char * buff, size_t len, struct multipath * mpp) { - return snprint_str(buff, len, mpp->wwid); + return snprint_str(buff, len, mpp->wwid); @@ -546,6 +552,7 @@ struct multipath_data mpd[] = { - {'t', "dm-st", 0, snprint_dm_map_state}, - {'S', "size", 0, snprint_multipath_size}, - {'f', "features", 0, snprint_features}, + {'t', "dm-st", 0, snprint_dm_map_state}, + {'S', "size", 0, snprint_multipath_size}, + {'f', "features", 0, snprint_features}, + {'x', "failures", 0, snprint_map_failures}, - {'h', "hwhandler", 0, snprint_hwhandler}, - {'A', "action", 0, snprint_action}, - {'0', "path_faults", 0, snprint_path_faults}, + {'h', "hwhandler", 0, snprint_hwhandler}, + {'A', "action", 0, snprint_action}, + {'0', "path_faults", 0, snprint_path_faults}, Index: multipath-tools-130222/libmultipath/structs.h =================================================================== --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -270,6 +270,7 @@ struct multipath { - unsigned int stat_map_loads; - unsigned int stat_total_queueing_time; - unsigned int stat_queueing_timeouts; + unsigned int stat_map_loads; + unsigned int stat_total_queueing_time; + unsigned int stat_queueing_timeouts; + unsigned int stat_map_failures; - - /* checkers shared data */ - void * mpcontext; + + /* checkers shared data */ + void * mpcontext; Index: multipath-tools-130222/libmultipath/structs_vec.c =================================================================== --- multipath-tools-130222.orig/libmultipath/structs_vec.c @@ -75,64 +75,64 @@ Index: multipath-tools-130222/libmultipath/structs_vec.c + mpp->alias, mpp->no_path_retry); + } else if (mpp->no_path_retry != NO_PATH_RETRY_QUEUE) + mpp->stat_map_failures++; - } - condlog(2, "%s: remaining active paths: %d", mpp->alias, mpp->nr_active); + } + condlog(2, "%s: remaining active paths: %d", mpp->alias, mpp->nr_active); } Index: multipath-tools-130222/multipathd/cli_handlers.c =================================================================== --- multipath-tools-130222.orig/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -319,9 +319,14 @@ show_maps (char ** r, int *len, struct v - c += snprint_multipath_header(c, reply + maxlen - c, - style); - + c += snprint_multipath_header(c, reply + maxlen - c, + style); + - vector_foreach_slot(vecs->mpvec, mpp, i) + vector_foreach_slot(vecs->mpvec, mpp, i) { + if (update_multipath(vecs, mpp->alias, 0)) { + i--; + continue; + } - c += snprint_multipath(c, reply + maxlen - c, - style, mpp, pretty); + c += snprint_multipath(c, reply + maxlen - c, + style, mpp, pretty); + } - - again = ((c - reply) == (maxlen - 1)); - + + again = ((c - reply) == (maxlen - 1)); + @@ -742,6 +747,8 @@ cli_disable_queueing(void *v, char **rep - return 1; - } - + return 1; + } + + if (mpp->nr_active == 0) + mpp->stat_map_failures++; - mpp->retry_tick = 0; - dm_queue_if_no_path(mpp->alias, 0); - return 0; + mpp->retry_tick = 0; + dm_queue_if_no_path(mpp->alias, 0); + return 0; @@ -756,6 +763,8 @@ cli_disable_all_queueing(void *v, char * - - condlog(2, "disable queueing (operator)"); - vector_foreach_slot(vecs->mpvec, mpp, i) { + + condlog(2, "disable queueing (operator)"); + vector_foreach_slot(vecs->mpvec, mpp, i) { + if (mpp->nr_active == 0) + mpp->stat_map_failures++; - mpp->retry_tick = 0; - dm_queue_if_no_path(mpp->alias, 0); - } + mpp->retry_tick = 0; + dm_queue_if_no_path(mpp->alias, 0); + } Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -716,6 +716,7 @@ ev_remove_path (struct path *pp, struct - mpp->retry_tick = 0; - mpp->no_path_retry = NO_PATH_RETRY_FAIL; - mpp->flush_on_last_del = FLUSH_IN_PROGRESS; + mpp->retry_tick = 0; + mpp->no_path_retry = NO_PATH_RETRY_FAIL; + mpp->flush_on_last_del = FLUSH_IN_PROGRESS; + mpp->stat_map_failures++; - dm_queue_if_no_path(mpp->alias, 0); - } - if (!flush_map(mpp, vecs, 1)) { + dm_queue_if_no_path(mpp->alias, 0); + } + if (!flush_map(mpp, vecs, 1)) { @@ -1197,6 +1198,7 @@ retry_count_tick(vector mpvec) - mpp->stat_total_queueing_time++; - condlog(4, "%s: Retrying.. No active path", mpp->alias); - if(--mpp->retry_tick == 0) { + mpp->stat_total_queueing_time++; + condlog(4, "%s: Retrying.. No active path", mpp->alias); + if(--mpp->retry_tick == 0) { + mpp->stat_map_failures++; - dm_queue_if_no_path(mpp->alias, 0); - condlog(2, "%s: Disable queueing", mpp->alias); - } + dm_queue_if_no_path(mpp->alias, 0); + condlog(2, "%s: Disable queueing", mpp->alias); + } diff --git a/SOURCES/0168-RHBZ-1347769-shared-lock.patch b/SOURCES/0168-RHBZ-1347769-shared-lock.patch index 409caf36..084d112f 100644 --- a/SOURCES/0168-RHBZ-1347769-shared-lock.patch +++ b/SOURCES/0168-RHBZ-1347769-shared-lock.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/libmultipath/configure.c --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -552,7 +552,7 @@ lock_multipath (struct multipath * mpp, - if (!pgp->paths) - continue; - vector_foreach_slot(pgp->paths, pp, j) { + if (!pgp->paths) + continue; + vector_foreach_slot(pgp->paths, pp, j) { - if (lock && flock(pp->fd, LOCK_EX | LOCK_NB) && + if (lock && flock(pp->fd, LOCK_SH | LOCK_NB) && - errno == EWOULDBLOCK) - goto fail; - else if (!lock) + errno == EWOULDBLOCK) + goto fail; + else if (!lock) diff --git a/SOURCES/0169-UPBZ-1353357-json-output.patch b/SOURCES/0169-UPBZ-1353357-json-output.patch index 1940206f..14fa8401 100644 --- a/SOURCES/0169-UPBZ-1353357-json-output.patch +++ b/SOURCES/0169-UPBZ-1353357-json-output.patch @@ -1,11 +1,11 @@ --- libmultipath/print.c | 222 ++++++++++++++++++++++++++++++++++++++++++++++ libmultipath/print.h | 61 ++++++++++++ - multipathd/cli.c | 3 - multipathd/cli.h | 2 + multipathd/cli.c | 3 + multipathd/cli.h | 2 multipathd/cli_handlers.c | 93 +++++++++++++++++++ - multipathd/cli_handlers.h | 2 - multipathd/main.c | 2 + multipathd/cli_handlers.h | 2 + multipathd/main.c | 2 multipathd/multipathd.8 | 9 + 8 files changed, 393 insertions(+), 1 deletion(-) @@ -14,9 +14,9 @@ Index: multipath-tools-130222/libmultipath/print.c --- multipath-tools-130222.orig/libmultipath/print.c +++ multipath-tools-130222/libmultipath/print.c @@ -269,6 +269,61 @@ snprint_multipath_vpr (char * buff, size - pp->vendor_id, pp->product_id); + pp->vendor_id, pp->product_id); } - + + +static int +snprint_multipath_vend (char * buff, size_t len, struct multipath * mpp) @@ -76,19 +76,19 @@ Index: multipath-tools-130222/libmultipath/print.c snprint_action (char * buff, size_t len, struct multipath * mpp) { @@ -561,6 +616,9 @@ struct multipath_data mpd[] = { - {'3', "total_q_time", 0, snprint_total_q_time}, - {'4', "q_timeouts", 0, snprint_q_timeouts}, - {'s', "vend/prod/rev", 0, snprint_multipath_vpr}, + {'3', "total_q_time", 0, snprint_total_q_time}, + {'4', "q_timeouts", 0, snprint_q_timeouts}, + {'s', "vend/prod/rev", 0, snprint_multipath_vpr}, + {'v', "vend", 0, snprint_multipath_vend}, + {'p', "prod", 0, snprint_multipath_prod}, + {'e', "rev", 0, snprint_multipath_rev}, - {0, NULL, 0 , NULL} + {0, NULL, 0 , NULL} }; - + @@ -983,6 +1041,170 @@ snprint_multipath_topology (char * buff, - return fwd; + return fwd; } - + +static int +snprint_json (char * buff, int len, int indent, char *json_str) +{ @@ -263,7 +263,7 @@ Index: multipath-tools-130222/libmultipath/print.h @@ -7,6 +7,63 @@ #define PRINT_MAP_PROPS "size=%S features='%f' hwhandler='%h' wp=%r" #define PRINT_PG_INDENT "policy='%s' prio=%p status=%t" - + +#define PRINT_JSON_MULTIPLIER 5 +#define PRINT_JSON_MAJOR_VERSION 0 +#define PRINT_JSON_MINOR_VERSION 1 @@ -327,7 +327,7 @@ Index: multipath-tools-130222/libmultipath/print.h @@ -41,6 +98,10 @@ int snprint_path (char *, int, char *, s int snprint_multipath (char *, int, char *, struct multipath *, int); int snprint_multipath_topology (char *, int, struct multipath * mpp, - int verbosity); + int verbosity); +int snprint_multipath_topology_json (char * buff, int len, + struct vectors * vecs); +int snprint_multipath_map_json (char * buff, int len, @@ -340,51 +340,51 @@ Index: multipath-tools-130222/multipathd/cli.c --- multipath-tools-130222.orig/multipathd/cli.c +++ multipath-tools-130222/multipathd/cli.c @@ -189,6 +189,7 @@ load_keys (void) - r += add_key(keys, "setprstatus", SETPRSTATUS, 0); - r += add_key(keys, "unsetprstatus", UNSETPRSTATUS, 0); - r += add_key(keys, "format", FMT, 1); + r += add_key(keys, "setprstatus", SETPRSTATUS, 0); + r += add_key(keys, "unsetprstatus", UNSETPRSTATUS, 0); + r += add_key(keys, "format", FMT, 1); + r += add_key(keys, "json", JSON, 0); - - if (r) { - free_keys(keys); + + if (r) { + free_keys(keys); @@ -473,8 +474,10 @@ cli_init (void) { - add_handler(LIST+MAPS+FMT, NULL); - add_handler(LIST+MAPS+RAW+FMT, NULL); - add_handler(LIST+MAPS+TOPOLOGY, NULL); + add_handler(LIST+MAPS+FMT, NULL); + add_handler(LIST+MAPS+RAW+FMT, NULL); + add_handler(LIST+MAPS+TOPOLOGY, NULL); + add_handler(LIST+MAPS+JSON, NULL); - add_handler(LIST+TOPOLOGY, NULL); - add_handler(LIST+MAP+TOPOLOGY, NULL); + add_handler(LIST+TOPOLOGY, NULL); + add_handler(LIST+MAP+TOPOLOGY, NULL); + add_handler(LIST+MAP+JSON, NULL); - add_handler(LIST+CONFIG, NULL); - add_handler(LIST+BLACKLIST, NULL); - add_handler(LIST+DEVICES, NULL); + add_handler(LIST+CONFIG, NULL); + add_handler(LIST+BLACKLIST, NULL); + add_handler(LIST+DEVICES, NULL); Index: multipath-tools-130222/multipathd/cli.h =================================================================== --- multipath-tools-130222.orig/multipathd/cli.h +++ multipath-tools-130222/multipathd/cli.h @@ -36,6 +36,7 @@ enum { - __SETPRSTATUS, - __UNSETPRSTATUS, - __FMT, + __SETPRSTATUS, + __UNSETPRSTATUS, + __FMT, + __JSON, }; - + #define LIST (1 << __LIST) @@ -74,6 +75,7 @@ enum { #define SETPRSTATUS (1ULL << __SETPRSTATUS) #define UNSETPRSTATUS (1ULL << __UNSETPRSTATUS) #define FMT (1ULL << __FMT) +#define JSON (1ULL << __JSON) - + #define INITIAL_REPLY_LEN 1200 - + Index: multipath-tools-130222/multipathd/cli_handlers.c =================================================================== --- multipath-tools-130222.orig/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -127,6 +127,70 @@ show_maps_topology (char ** r, int * len } - + int +show_maps_json (char ** r, int * len, struct vectors * vecs) +{ @@ -452,10 +452,10 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c +int show_config (char ** r, int * len) { - char * c; + char * c; @@ -239,6 +303,35 @@ cli_list_maps_topology (void * v, char * } - + int +cli_list_map_json (void * v, char ** reply, int * len, void * data) +{ @@ -488,7 +488,7 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c +int cli_list_wildcards (void * v, char ** reply, int * len, void * data) { - char * c; + char * c; Index: multipath-tools-130222/multipathd/cli_handlers.h =================================================================== --- multipath-tools-130222.orig/multipathd/cli_handlers.h @@ -507,15 +507,15 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -981,7 +981,9 @@ uxlsnrloop (void * ap) - set_handler_callback(LIST+MAPS+RAW+FMT, cli_list_maps_raw); - set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology); - set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology); + set_handler_callback(LIST+MAPS+RAW+FMT, cli_list_maps_raw); + set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology); + set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology); + set_handler_callback(LIST+MAPS+JSON, cli_list_maps_json); - set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology); + set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology); + set_handler_callback(LIST+MAP+JSON, cli_list_map_json); - set_handler_callback(LIST+CONFIG, cli_list_config); - set_handler_callback(LIST+BLACKLIST, cli_list_blacklist); - set_handler_callback(LIST+DEVICES, cli_list_devices); + set_handler_callback(LIST+CONFIG, cli_list_config); + set_handler_callback(LIST+BLACKLIST, cli_list_blacklist); + set_handler_callback(LIST+DEVICES, cli_list_devices); Index: multipath-tools-130222/multipathd/multipathd.8 =================================================================== --- multipath-tools-130222.orig/multipathd/multipathd.8 diff --git a/SOURCES/0170-UPBZ-1352925-fix-typo.patch b/SOURCES/0170-UPBZ-1352925-fix-typo.patch index 9ce01e22..2521c3d9 100644 --- a/SOURCES/0170-UPBZ-1352925-fix-typo.patch +++ b/SOURCES/0170-UPBZ-1352925-fix-typo.patch @@ -7,20 +7,20 @@ Index: multipath-tools-130222/multipath/main.c --- multipath-tools-130222.orig/multipath/main.c +++ multipath-tools-130222/multipath/main.c @@ -286,7 +286,7 @@ configure (void) - if (failed == 2 && conf->cmd == CMD_VALID_PATH) - printf("%s is not a valid multipath device path\n", conf->dev); - else + if (failed == 2 && conf->cmd == CMD_VALID_PATH) + printf("%s is not a valid multipath device path\n", conf->dev); + else - condlog(3, "scope is nul"); + condlog(3, "scope is null"); - goto out; - } - if (conf->cmd == CMD_REMOVE_WWID) { + goto out; + } + if (conf->cmd == CMD_REMOVE_WWID) { @@ -358,7 +358,7 @@ configure (void) - - - if (conf->cmd == CMD_VALID_PATH) { + + + if (conf->cmd == CMD_VALID_PATH) { - /* This only happens if find_multipaths is and + /* This only happens if find_multipaths and - * ignore_wwids is set. - * If there is currently a multipath device matching - * the refwwid, or there is more than one path matching + * ignore_wwids is set. + * If there is currently a multipath device matching + * the refwwid, or there is more than one path matching diff --git a/SOURCES/0171-UPBZ-1356651-allow-zero-size.patch b/SOURCES/0171-UPBZ-1356651-allow-zero-size.patch index bf4cfa53..0fe05b52 100644 --- a/SOURCES/0171-UPBZ-1356651-allow-zero-size.patch +++ b/SOURCES/0171-UPBZ-1356651-allow-zero-size.patch @@ -9,38 +9,38 @@ Index: multipath-tools-130222/libmultipath/discovery.c --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -1188,6 +1188,11 @@ pathinfo (struct path *pp, vector hwtabl - if (pp->state == PATH_UNCHECKED || - pp->state == PATH_WILD) - goto blank; + if (pp->state == PATH_UNCHECKED || + pp->state == PATH_WILD) + goto blank; + if (pp->state == PATH_UP && !pp->size) { + condlog(3, "%s: device size is 0, " + "path unuseable", pp->dev); + pp->state = PATH_GHOST; + } - } else { - condlog(3, "%s: path inaccessible", pp->dev); - pp->chkrstate = pp->state = path_state; + } else { + condlog(3, "%s: path inaccessible", pp->dev); + pp->chkrstate = pp->state = path_state; Index: multipath-tools-130222/libmultipath/structs_vec.c =================================================================== --- multipath-tools-130222.orig/libmultipath/structs_vec.c +++ multipath-tools-130222/libmultipath/structs_vec.c @@ -551,7 +551,7 @@ int update_multipath (struct vectors *ve - - if (pp->state != PATH_DOWN) { - int oldstate = pp->state; + + if (pp->state != PATH_DOWN) { + int oldstate = pp->state; - condlog(2, "%s: mark as failed", pp->dev_t); + condlog(2, "%s: mark as failed", pp->dev); - mpp->stat_path_failures++; - pp->state = PATH_DOWN; - if (oldstate == PATH_UP || + mpp->stat_path_failures++; + pp->state = PATH_DOWN; + if (oldstate == PATH_UP || Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -538,15 +538,10 @@ ev_add_path (struct path * pp, struct ve - pp->mpp = mpp; + pp->mpp = mpp; rescan: - if (mpp) { + if (mpp) { - if ((!pp->size) || (mpp->size != pp->size)) { - if (!pp->size) - condlog(0, "%s: failed to add new path %s, " @@ -54,13 +54,13 @@ Index: multipath-tools-130222/multipathd/main.c + condlog(0, "%s: failed to add new path %s, " + "device size mismatch", + mpp->alias, pp->dev); - int i = find_slot(vecs->pathvec, (void *)pp); - if (i != -1) - vector_del_slot(vecs->pathvec, i); + int i = find_slot(vecs->pathvec, (void *)pp); + if (i != -1) + vector_del_slot(vecs->pathvec, i); @@ -563,18 +558,7 @@ rescan: - verify_paths(mpp, vecs, NULL); - mpp->flush_on_last_del = FLUSH_UNDEF; - mpp->action = ACT_RELOAD; + verify_paths(mpp, vecs, NULL); + mpp->flush_on_last_del = FLUSH_UNDEF; + mpp->action = ACT_RELOAD; - } - else { - if (!pp->size) { @@ -74,6 +74,6 @@ Index: multipath-tools-130222/multipathd/main.c - } - + } else { - if (!should_multipath(pp, vecs->pathvec)) { - orphan_path(pp); - return 0; + if (!should_multipath(pp, vecs->pathvec)) { + orphan_path(pp); + return 0; diff --git a/SOURCES/0172-RHBZ-1350931-no-active-add.patch b/SOURCES/0172-RHBZ-1350931-no-active-add.patch index 560308d3..4e79e325 100644 --- a/SOURCES/0172-RHBZ-1350931-no-active-add.patch +++ b/SOURCES/0172-RHBZ-1350931-no-active-add.patch @@ -7,9 +7,9 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -530,9 +530,15 @@ ev_add_path (struct path * pp, struct ve - } - mpp = find_mp_by_wwid(vecs->mpvec, pp->wwid); - if (mpp && mpp->wait_for_udev) { + } + mpp = find_mp_by_wwid(vecs->mpvec, pp->wwid); + if (mpp && mpp->wait_for_udev) { - mpp->wait_for_udev = 2; - orphan_path(pp); - return 0; @@ -22,15 +22,16 @@ Index: multipath-tools-130222/multipathd/main.c + orphan_path(pp); + return 0; + } - } - - pp->mpp = mpp; + } + + pp->mpp = mpp; @@ -551,7 +557,8 @@ rescan: - - condlog(4,"%s: adopting all paths for path %s", - mpp->alias, pp->dev); + + condlog(4,"%s: adopting all paths for path %s", + mpp->alias, pp->dev); - mpp->force_udev_reload = !pathcount(mpp, PATH_WILD); + if (pathcount(mpp, PATH_WILD) == 0) + mpp->force_udev_reload = 1; - if (adopt_paths(vecs->pathvec, mpp, 1)) - goto fail; /* leave path added to pathvec */ + if (adopt_paths(vecs->pathvec, mpp, 1)) + goto fail; /* leave path added to pathvec */ + diff --git a/SOURCES/0174-RHBZ-1362396-modprobe.patch b/SOURCES/0174-RHBZ-1362396-modprobe.patch index 77338ea7..509510cb 100644 --- a/SOURCES/0174-RHBZ-1362396-modprobe.patch +++ b/SOURCES/0174-RHBZ-1362396-modprobe.patch @@ -8,9 +8,9 @@ Index: multipath-tools-130222/multipathd/multipathd.init.redhat +++ multipath-tools-130222/multipathd/multipathd.init.redhat @@ -67,6 +67,7 @@ popd > /dev/null start() { - test -x $DAEMON || exit 5 - echo -n $"Starting $prog daemon: " + test -x $DAEMON || exit 5 + echo -n $"Starting $prog daemon: " + modprobe dm-multipath >/dev/null 2>&1 - daemon $DAEMON - RETVAL=$? - [ $RETVAL -eq 0 ] && touch $lockdir/$prog + daemon $DAEMON + RETVAL=$? + [ $RETVAL -eq 0 ] && touch $lockdir/$prog diff --git a/SOURCES/0176-RHBZ-1363830-fix-rename.patch b/SOURCES/0176-RHBZ-1363830-fix-rename.patch index a4b33056..428b2f1a 100644 --- a/SOURCES/0176-RHBZ-1363830-fix-rename.patch +++ b/SOURCES/0176-RHBZ-1363830-fix-rename.patch @@ -8,10 +8,10 @@ Index: multipath-tools-130222/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -1387,7 +1387,7 @@ dm_rename (const char * old, char * new, { - int r = 0; - struct dm_task *dmt; + int r = 0; + struct dm_task *dmt; - uint32_t cookie; + uint32_t cookie = 0; - uint16_t udev_flags = ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | ((skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0); - - if (dm_rename_partmaps(old, new)) + uint16_t udev_flags = ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | ((skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0); + + if (dm_rename_partmaps(old, new)) diff --git a/SOURCES/0177-libmultipath-correctly-initialize-pp-sg_id.patch b/SOURCES/0177-libmultipath-correctly-initialize-pp-sg_id.patch index 4d80c110..1c927be8 100644 --- a/SOURCES/0177-libmultipath-correctly-initialize-pp-sg_id.patch +++ b/SOURCES/0177-libmultipath-correctly-initialize-pp-sg_id.patch @@ -26,12 +26,13 @@ index 30d247d..26a6a3b 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c @@ -94,6 +94,7 @@ alloc_path (void) - pp->sg_id.channel = -1; - pp->sg_id.scsi_id = -1; - pp->sg_id.lun = -1; + pp->sg_id.channel = -1; + pp->sg_id.scsi_id = -1; + pp->sg_id.lun = -1; + pp->sg_id.proto_id = SCSI_PROTOCOL_UNSPEC; - pp->fd = -1; - pp->priority = PRIO_UNDEF; - } --- + pp->fd = -1; + pp->priority = PRIO_UNDEF; + } +-- 1.8.3.1 + diff --git a/SOURCES/0178-libmultipath-add-rbd-discovery.patch b/SOURCES/0178-libmultipath-add-rbd-discovery.patch index 14234774..6930e46c 100644 --- a/SOURCES/0178-libmultipath-add-rbd-discovery.patch +++ b/SOURCES/0178-libmultipath-add-rbd-discovery.patch @@ -38,16 +38,16 @@ index f6fe326..735bb25 100644 #define READSECTOR0 "readsector0" #define CCISS_TUR "cciss_tur" +#define RBD "rbd" - + #define DEFAULT_CHECKER DIRECTIO - + diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 7a8282b..1b9f390 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -781,6 +781,21 @@ scsi_sysfs_pathinfo (struct path * pp) } - + static int +rbd_sysfs_pathinfo (struct path * pp) +{ @@ -66,29 +66,29 @@ index 7a8282b..1b9f390 100644 +static int ccw_sysfs_pathinfo (struct path * pp) { - struct udev_device *parent; + struct udev_device *parent; @@ -974,6 +989,8 @@ sysfs_pathinfo(struct path * pp) - pp->bus = SYSFS_BUS_CCW; - if (!strncmp(pp->dev,"sd", 2)) - pp->bus = SYSFS_BUS_SCSI; + 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 (pp->bus == SYSFS_BUS_UNDEF) - return 0; + + if (pp->bus == SYSFS_BUS_UNDEF) + return 0; @@ -986,6 +1003,9 @@ 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_CCISS) { + if (cciss_sysfs_pathinfo(pp)) + return 1; + } else if (pp->bus == SYSFS_BUS_RBD) { + if (rbd_sysfs_pathinfo(pp)) + return 1; - } - return 0; + } + return 0; } @@ -1087,10 +1107,60 @@ get_prio (struct path * pp) } - + static int +get_rbd_uid(struct path * pp) +{ @@ -134,23 +134,23 @@ index 7a8282b..1b9f390 100644 + } + +free_dev: -+ udev_device_unref(rbd_bus_dev); ++ udev_device_unref(rbd_bus_dev); + return ret; +} + +static int get_uid (struct path * pp) { - char *c; - const char *value; + char *c; + const char *value; + int ret; - - if (!pp->uid_attribute) - select_getuid(pp); + + if (!pp->uid_attribute) + select_getuid(pp); @@ -1101,25 +1171,37 @@ get_uid (struct path * pp) - } - - memset(pp->wwid, 0, WWID_SIZE); + } + + memset(pp->wwid, 0, WWID_SIZE); - value = udev_device_get_property_value(pp->udev, pp->uid_attribute); - if ((!value || strlen(value) == 0) && conf->cmd == CMD_VALID_PATH) - value = getenv(pp->uid_attribute); @@ -168,11 +168,11 @@ index 7a8282b..1b9f390 100644 + pp->dev, strerror(-ret)); + pp->missing_udev_info = INFO_MISSING; + pp->tick = conf->retrigger_delay; - } + } - strncpy(pp->wwid, value, len); - pp->missing_udev_info = INFO_OK; - pp->tick = 0; - } else { + } else { - condlog(3, "%s: no %s attribute", pp->dev, - pp->uid_attribute); - pp->missing_udev_info = INFO_MISSING; @@ -199,20 +199,21 @@ index 7a8282b..1b9f390 100644 + pp->missing_udev_info = INFO_MISSING; + pp->tick = conf->retrigger_delay; + } - } - - /* Strip any trailing blanks */ + } + + /* Strip any trailing blanks */ diff --git a/libmultipath/structs.h b/libmultipath/structs.h index b5b4567..e566462 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -52,6 +52,7 @@ enum sysfs_buses { - SYSFS_BUS_IDE, - SYSFS_BUS_CCW, - SYSFS_BUS_CCISS, + SYSFS_BUS_IDE, + SYSFS_BUS_CCW, + SYSFS_BUS_CCISS, + SYSFS_BUS_RBD, }; - + enum pathstates { --- +-- 1.8.3.1 + diff --git a/SOURCES/0179-multipath-tools-add-checker-callout-to-repair-path.patch b/SOURCES/0179-multipath-tools-add-checker-callout-to-repair-path.patch index 4a58e8d3..8b48f7d4 100644 --- a/SOURCES/0179-multipath-tools-add-checker-callout-to-repair-path.patch +++ b/SOURCES/0179-multipath-tools-add-checker-callout-to-repair-path.patch @@ -41,9 +41,9 @@ index 7f9db2d..fa7d8b7 100644 --- a/libmultipath/checkers.c +++ b/libmultipath/checkers.c @@ -137,6 +137,14 @@ struct checker * add_checker (char * name) - if (!c->free) - goto out; - + if (!c->free) + goto out; + + c->repair = (void (*)(struct checker *)) dlsym(c->handle, + "libcheck_repair"); + errstr = dlerror(); @@ -52,13 +52,13 @@ index 7f9db2d..fa7d8b7 100644 + if (!c->repair) + goto out; + - c->fd = 0; - c->sync = 1; - list_add(&c->node, &checkers); + c->fd = 0; + c->sync = 1; + list_add(&c->node, &checkers); @@ -202,6 +210,20 @@ void checker_put (struct checker * dst) - free_checker(src); + free_checker(src); } - + +void checker_repair (struct checker * c) +{ + if (!c) @@ -75,28 +75,28 @@ index 7f9db2d..fa7d8b7 100644 + int checker_check (struct checker * c) { - int r; + int r; @@ -266,6 +288,7 @@ void checker_get (struct checker * dst, char * name) - dst->sync = src->sync; - strncpy(dst->name, src->name, CHECKER_NAME_LEN); - strncpy(dst->message, src->message, CHECKER_MSG_LEN); + 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; + dst->check = src->check; + dst->init = src->init; + dst->free = src->free; diff --git a/libmultipath/checkers.h b/libmultipath/checkers.h index 735bb25..ad3b9e4 100644 --- a/libmultipath/checkers.h +++ b/libmultipath/checkers.h @@ -106,6 +106,9 @@ struct checker { - multipath-wide. Use MALLOC if - you want to stuff data in. */ - int (*check)(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 */ + int (*init)(struct checker *); /* to allocate the context */ + void (*free)(struct checker *); /* to free the context */ }; @@ -125,6 +128,7 @@ void checker_set_async (struct checker *); void checker_set_fd (struct checker *, int); @@ -111,9 +111,9 @@ index 4c26901..7e4eb81 100644 --- a/libmultipath/checkers/cciss_tur.c +++ b/libmultipath/checkers/cciss_tur.c @@ -63,6 +63,11 @@ void libcheck_free (struct checker * c) - return; + return; } - + +void libcheck_repair (struct checker * c) +{ + return; @@ -127,9 +127,9 @@ index 46fe6a7..1a997ed 100644 --- a/libmultipath/checkers/directio.c +++ b/libmultipath/checkers/directio.c @@ -116,6 +116,11 @@ void libcheck_free (struct checker * c) - free(ct); + free(ct); } - + +void libcheck_repair (struct checker * c) +{ + return; @@ -143,9 +143,9 @@ index b42d267..43b5025 100644 --- a/libmultipath/checkers/emc_clariion.c +++ b/libmultipath/checkers/emc_clariion.c @@ -90,6 +90,11 @@ void libcheck_free (struct checker * c) - free(c->context); + free(c->context); } - + +void libcheck_repair (struct checker * c) +{ + return; @@ -153,15 +153,15 @@ index b42d267..43b5025 100644 + int libcheck_check (struct checker * c) { - unsigned char sense_buffer[128] = { 0, }; + unsigned char sense_buffer[128] = { 0, }; diff --git a/libmultipath/checkers/hp_sw.c b/libmultipath/checkers/hp_sw.c index b50ac0c..857ac5e 100644 --- a/libmultipath/checkers/hp_sw.c +++ b/libmultipath/checkers/hp_sw.c @@ -44,6 +44,11 @@ void libcheck_free (struct checker * c) - return; + return; } - + +void libcheck_repair (struct checker * c) +{ + return; @@ -175,9 +175,9 @@ index f0e0af3..5469e61 100644 --- a/libmultipath/checkers/rdac.c +++ b/libmultipath/checkers/rdac.c @@ -139,6 +139,11 @@ void libcheck_free (struct checker * c) - return; + return; } - + +void libcheck_repair (struct checker * c) +{ + return; @@ -191,9 +191,9 @@ index 0550fb6..b3ed1f3 100644 --- a/libmultipath/checkers/readsector0.c +++ b/libmultipath/checkers/readsector0.c @@ -23,6 +23,11 @@ void libcheck_free (struct checker * c) - return; + return; } - + +void libcheck_repair (struct checker * c) +{ + return; @@ -201,31 +201,31 @@ index 0550fb6..b3ed1f3 100644 + int libcheck_check (struct checker * c) { - unsigned char buf[4096]; + unsigned char buf[4096]; diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c index 1e5b039..91f1458 100644 --- a/libmultipath/checkers/tur.c +++ b/libmultipath/checkers/tur.c @@ -187,6 +187,11 @@ void libcheck_free (struct checker * c) - return; + return; } - + +void libcheck_repair (struct checker * c) +{ + return; +} + #define TUR_MSG(msg, fmt, args...) snprintf(msg, CHECKER_MSG_LEN, fmt, ##args); - + int diff --git a/multipathd/main.c b/multipathd/main.c index 8808c88..d26fd22 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1455,6 +1455,14 @@ check_path (struct vectors * vecs, struct path * pp) - } + } } - + +void repair_path(struct vectors * vecs, struct path * pp) +{ + if (pp->state != PATH_DOWN) @@ -238,12 +238,13 @@ index 8808c88..d26fd22 100644 checkerloop (void *ap) { @@ -1483,6 +1491,7 @@ checkerloop (void *ap) - if (vecs->pathvec) { - vector_foreach_slot (vecs->pathvec, pp, i) { - check_path(vecs, pp); + if (vecs->pathvec) { + vector_foreach_slot (vecs->pathvec, pp, i) { + check_path(vecs, pp); + repair_path(vecs, pp); - } - } - if (vecs->mpvec) { --- + } + } + if (vecs->mpvec) { +-- 1.8.3.1 + diff --git a/SOURCES/0180-multipath-tools-Add-rbd-checker.patch b/SOURCES/0180-multipath-tools-Add-rbd-checker.patch index a286e992..cf8a752f 100644 --- a/SOURCES/0180-multipath-tools-Add-rbd-checker.patch +++ b/SOURCES/0180-multipath-tools-Add-rbd-checker.patch @@ -35,10 +35,10 @@ Added rbd to multipath.conf.annotated. Signed-off-by: Mike Christie --- - libmultipath/checkers/Makefile | 7 + libmultipath/checkers/Makefile | 7 libmultipath/checkers/rbd.c | 639 +++++++++++++++++++++++++++++++++++++++++ - multipath.conf.annotated | 4 - multipath/multipath.conf.5 | 3 + multipath.conf.annotated | 4 + multipath/multipath.conf.5 | 3 4 files changed, 651 insertions(+), 2 deletions(-) create mode 100644 libmultipath/checkers/rbd.c @@ -47,23 +47,23 @@ Index: multipath-tools-130222/libmultipath/checkers/Makefile --- multipath-tools-130222.orig/libmultipath/checkers/Makefile +++ multipath-tools-130222/libmultipath/checkers/Makefile @@ -14,10 +14,17 @@ LIBS= \ - libcheckhp_sw.so \ - libcheckrdac.so - + 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 - + $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ -laio + Index: multipath-tools-130222/libmultipath/checkers/rbd.c =================================================================== --- /dev/null diff --git a/SOURCES/0181-multipath-tools-Add-rbd-to-the-hwtable.patch b/SOURCES/0181-multipath-tools-Add-rbd-to-the-hwtable.patch index c83031a6..fd9d6ff1 100644 --- a/SOURCES/0181-multipath-tools-Add-rbd-to-the-hwtable.patch +++ b/SOURCES/0181-multipath-tools-Add-rbd-to-the-hwtable.patch @@ -25,9 +25,9 @@ index 61d1033..d278c04 100644 --- a/libmultipath/hwtable.c +++ b/libmultipath/hwtable.c @@ -1206,6 +1206,21 @@ static struct hwentry default_hw[] = { - .pgfailback = -FAILBACK_IMMEDIATE, - .checker_name = TUR, - }, + .pgfailback = -FAILBACK_IMMEDIATE, + .checker_name = TUR, + }, + { + /* + * Red Hat @@ -43,8 +43,9 @@ index 61d1033..d278c04 100644 + .deferred_remove = DEFERRED_REMOVE_ON, + }, + - /* - * EOL - */ --- + /* + * EOL + */ +-- 1.8.3.1 + diff --git a/SOURCES/0182-multipath-tools-check-for-initialized-checker-before.patch b/SOURCES/0182-multipath-tools-check-for-initialized-checker-before.patch index bc3b54bb..26b8f281 100644 --- a/SOURCES/0182-multipath-tools-check-for-initialized-checker-before.patch +++ b/SOURCES/0182-multipath-tools-check-for-initialized-checker-before.patch @@ -36,13 +36,14 @@ index fa7d8b7..6cd8d34 100644 --- a/libmultipath/checkers.c +++ b/libmultipath/checkers.c @@ -212,7 +212,7 @@ void checker_put (struct checker * dst) - + void checker_repair (struct checker * c) { - if (!c) + if (!c || !checker_selected(c)) - return; - - c->message[0] = '\0'; --- + return; + + c->message[0] = '\0'; +-- 1.8.3.1 + diff --git a/SOURCES/0183-multipathd-Don-t-call-repair-on-blacklisted-path.patch b/SOURCES/0183-multipathd-Don-t-call-repair-on-blacklisted-path.patch index 1723f97f..93323c18 100644 --- a/SOURCES/0183-multipathd-Don-t-call-repair-on-blacklisted-path.patch +++ b/SOURCES/0183-multipathd-Don-t-call-repair-on-blacklisted-path.patch @@ -30,9 +30,9 @@ index d26fd22..4638c8b 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1238,6 +1238,16 @@ int update_path_groups(struct multipath *mpp, struct vectors *vecs, int refresh) - return 0; + return 0; } - + +void repair_path(struct path * pp) +{ + if (pp->state != PATH_DOWN) @@ -47,26 +47,26 @@ index d26fd22..4638c8b 100644 check_path (struct vectors * vecs, struct path * pp) { @@ -1352,6 +1362,7 @@ check_path (struct vectors * vecs, struct path * pp) - pp->mpp->failback_tick = 0; - - pp->mpp->stat_path_failures++; + pp->mpp->failback_tick = 0; + + pp->mpp->stat_path_failures++; + repair_path(pp); - return; - } - + return; + } + @@ -1431,7 +1442,7 @@ check_path (struct vectors * vecs, struct path * pp) - } - - pp->state = newstate; + } + + pp->state = newstate; - + repair_path(pp); - - if (pp->mpp->wait_for_udev) - return; + + if (pp->mpp->wait_for_udev) + return; @@ -1455,14 +1466,6 @@ check_path (struct vectors * vecs, struct path * pp) - } + } } - + -void repair_path(struct vectors * vecs, struct path * pp) -{ - if (pp->state != PATH_DOWN) @@ -79,12 +79,13 @@ index d26fd22..4638c8b 100644 checkerloop (void *ap) { @@ -1491,7 +1494,6 @@ checkerloop (void *ap) - if (vecs->pathvec) { - vector_foreach_slot (vecs->pathvec, pp, i) { - check_path(vecs, pp); + if (vecs->pathvec) { + vector_foreach_slot (vecs->pathvec, pp, i) { + check_path(vecs, pp); - repair_path(vecs, pp); - } - } - if (vecs->mpvec) { --- + } + } + if (vecs->mpvec) { +-- 1.8.3.1 + diff --git a/SOURCES/0184-rbd-fix-sync-repair-support.patch b/SOURCES/0184-rbd-fix-sync-repair-support.patch index d3690882..6ae63034 100644 --- a/SOURCES/0184-rbd-fix-sync-repair-support.patch +++ b/SOURCES/0184-rbd-fix-sync-repair-support.patch @@ -16,13 +16,14 @@ index 6f1b53a..76f4005 100644 --- a/libmultipath/checkers/rbd.c +++ b/libmultipath/checkers/rbd.c @@ -554,7 +554,7 @@ static int rbd_exec_fn(struct checker *c, thread_fn *fn) - int rbd_status, r; - - if (c->sync) + int rbd_status, r; + + if (c->sync) - return rbd_check(ct, c->message); + return fn(ct, c->message); - /* - * Async mode - */ --- + /* + * Async mode + */ +-- 1.8.3.1 + diff --git a/SOURCES/0185-rbd-check-for-nonshared-clients.patch b/SOURCES/0185-rbd-check-for-nonshared-clients.patch index 8ff8e75d..c209d738 100644 --- a/SOURCES/0185-rbd-check-for-nonshared-clients.patch +++ b/SOURCES/0185-rbd-check-for-nonshared-clients.patch @@ -16,16 +16,17 @@ index 76f4005..a6f3405 100644 --- a/libmultipath/checkers/rbd.c +++ b/libmultipath/checkers/rbd.c @@ -123,6 +123,11 @@ int libcheck_init(struct checker * c) - if (!config_info) - goto free_addr; - + if (!config_info) + goto free_addr; + + if (!strstr(config_info, "noshare")) { + condlog(3, "Only nonshared clients supported."); + goto free_addr; + } + - ct->config_info = strdup(config_info); - if (!ct->config_info) - goto free_addr; --- + ct->config_info = strdup(config_info); + if (!ct->config_info) + goto free_addr; +-- 1.8.3.1 + diff --git a/SOURCES/0186-rbd-check-for-exclusive-lock-enabled.patch b/SOURCES/0186-rbd-check-for-exclusive-lock-enabled.patch index 8c5970d8..290850ba 100644 --- a/SOURCES/0186-rbd-check-for-exclusive-lock-enabled.patch +++ b/SOURCES/0186-rbd-check-for-exclusive-lock-enabled.patch @@ -16,29 +16,29 @@ index a6f3405..e34bf53 100644 --- a/libmultipath/checkers/rbd.c +++ b/libmultipath/checkers/rbd.c @@ -33,6 +33,8 @@ 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; + int rbd_bus_id; + char *client_addr; @@ -65,8 +67,9 @@ int libcheck_init(struct checker * c) - struct udev_device *bus_dev; - struct udev *udev; - struct stat sb; + struct udev_device *bus_dev; + struct udev *udev; + struct stat sb; - const char *block_name, *addr, *config_info; + const char *block_name, *addr, *config_info, *features_str; - const char *image, *pool, *snap, *username; + const char *image, *pool, *snap, *username; + uint64_t features = 0; - char sysfs_path[PATH_SIZE]; - int ret; - + char sysfs_path[PATH_SIZE]; + int ret; + @@ -119,6 +122,15 @@ int libcheck_init(struct checker * c) - if (!ct->client_addr) - goto free_dev; - + if (!ct->client_addr) + goto free_dev; + + features_str = udev_device_get_sysattr_value(bus_dev, "features"); + if (!features_str) + goto free_addr; @@ -48,8 +48,9 @@ index a6f3405..e34bf53 100644 + goto free_addr; + } + - config_info = udev_device_get_sysattr_value(bus_dev, "config_info"); - if (!config_info) - goto free_addr; --- + config_info = udev_device_get_sysattr_value(bus_dev, "config_info"); + if (!config_info) + goto free_addr; +-- 1.8.3.1 + diff --git a/SOURCES/0187-rbd-fixup-log-messages.patch b/SOURCES/0187-rbd-fixup-log-messages.patch index edc967ec..c4ed6dbb 100644 --- a/SOURCES/0187-rbd-fixup-log-messages.patch +++ b/SOURCES/0187-rbd-fixup-log-messages.patch @@ -16,222 +16,223 @@ index e34bf53..8e6cd3c 100644 --- a/libmultipath/checkers/rbd.c +++ b/libmultipath/checkers/rbd.c @@ -113,8 +113,8 @@ int libcheck_init(struct checker * c) - - addr = udev_device_get_sysattr_value(bus_dev, "client_addr"); - if (!addr) { + + addr = udev_device_get_sysattr_value(bus_dev, "client_addr"); + if (!addr) { - condlog(0, "Could not find client_addr in rbd sysfs. Try " - "updating kernel"); + condlog(0, "rbd%d: Could not find client_addr in rbd sysfs. " + "Try updating kernel", ct->rbd_bus_id); - goto free_dev; - } - + goto free_dev; + } + @@ -127,7 +127,7 @@ int libcheck_init(struct checker * c) - goto free_addr; - features = strtoll(features_str, NULL, 16); - if (!(features & RBD_FEATURE_EXCLUSIVE_LOCK)) { + goto free_addr; + features = strtoll(features_str, NULL, 16); + if (!(features & RBD_FEATURE_EXCLUSIVE_LOCK)) { - condlog(3, "Exclusive lock not set."); + condlog(3, "rbd%d: Exclusive lock not set.", ct->rbd_bus_id); - goto free_addr; - } - + goto free_addr; + } + @@ -136,7 +136,8 @@ int libcheck_init(struct checker * c) - goto free_addr; - - if (!strstr(config_info, "noshare")) { + goto free_addr; + + if (!strstr(config_info, "noshare")) { - condlog(3, "Only nonshared clients supported."); + condlog(3, "rbd%d: Only nonshared clients supported.", + ct->rbd_bus_id); - goto free_addr; - } - + goto free_addr; + } + @@ -189,18 +190,20 @@ int libcheck_init(struct checker * c) - } - - if (rados_create(&ct->cluster, NULL) < 0) { + } + + if (rados_create(&ct->cluster, NULL) < 0) { - condlog(0, "Could not create rados cluster"); + 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) { + goto free_snap; + } + + if (rados_conf_read_file(ct->cluster, NULL) < 0) { - condlog(0, "Could not read rados conf"); + condlog(0, "rbd%d: Could not read rados conf", ct->rbd_bus_id); - goto shutdown_rados; - } - - ret = rados_connect(ct->cluster); - if (ret < 0) { + goto shutdown_rados; + } + + ret = rados_connect(ct->cluster); + if (ret < 0) { - condlog(0, "Could not connect to rados cluster"); + condlog(0, "rbd%d: Could not connect to rados cluster", + ct->rbd_bus_id); - goto shutdown_rados; - } - + goto shutdown_rados; + } + @@ -291,8 +294,7 @@ static int rbd_is_blacklisted(struct rbd_checker_context *ct, char *msg) - ret = rados_mon_command(ct->cluster, (const char **)cmd, 1, "", 0, - &blklist, &blklist_len, &stat, &stat_len); - if (ret < 0) { + ret = rados_mon_command(ct->cluster, (const char **)cmd, 1, "", 0, + &blklist, &blklist_len, &stat, &stat_len); + if (ret < 0) { - RBD_MSG(msg, "rbd checker failed: mon command failed %d", - ret); + RBD_MSG(msg, "checker failed: mon command failed %d", ret); - return ret; - } - + return ret; + } + @@ -313,16 +315,15 @@ static int rbd_is_blacklisted(struct rbd_checker_context *ct, char *msg) - - end = strchr(addr_tok, ' '); - if (!end) { + + end = strchr(addr_tok, ' '); + if (!end) { - RBD_MSG(msg, "rbd%d checker failed: invalid blacklist %s", - ct->rbd_bus_id, addr_tok); + RBD_MSG(msg, "checker failed: invalid blacklist %s", + addr_tok); - break; - } - *end = '\0'; - - if (!strcmp(addr_tok, ct->client_addr)) { - ct->blacklisted = 1; + break; + } + *end = '\0'; + + if (!strcmp(addr_tok, ct->client_addr)) { + ct->blacklisted = 1; - RBD_MSG(msg, "rbd%d checker: %s is blacklisted", - ct->rbd_bus_id, ct->client_addr); + RBD_MSG(msg, "%s is blacklisted", ct->client_addr); - ret = 1; - break; - } + ret = 1; + break; + } @@ -339,7 +340,7 @@ int rbd_check(struct rbd_checker_context *ct, char *msg) - if (ct->blacklisted || rbd_is_blacklisted(ct, msg) == 1) - return PATH_DOWN; - + if (ct->blacklisted || rbd_is_blacklisted(ct, msg) == 1) + return PATH_DOWN; + - RBD_MSG(msg, "rbd checker reports path is up"); + 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. + /* + * Path may have issues, but the ceph cluster is at least + * accepting IO, so we can attempt to do IO. @@ -411,10 +412,12 @@ static int rbd_remap(struct rbd_checker_context *ct) - argv[i] = NULL; - - ret = execvp(argv[0], argv); + argv[i] = NULL; + + ret = execvp(argv[0], argv); - condlog(0, "Error executing rbd: %s", strerror(errno)); + condlog(0, "rbd%d: Error executing rbd: %s", ct->rbd_bus_id, + strerror(errno)); - exit(-1); - case -1: + exit(-1); + case -1: - condlog(0, "fork failed: %s", strerror(errno)); + condlog(0, "rbd%d: fork failed: %s", ct->rbd_bus_id, + strerror(errno)); - return -1; - default: - ret = -1; + return -1; + default: + ret = -1; @@ -424,7 +427,8 @@ static int rbd_remap(struct rbd_checker_context *ct) - if (status == 0) - ret = 0; - else + if (status == 0) + ret = 0; + else - condlog(0, "rbd failed with %d", status); + condlog(0, "rbd%d: failed with %d", + ct->rbd_bus_id, status); - } - } - + } + } + @@ -454,12 +458,12 @@ static int rbd_rm_blacklist(struct rbd_checker_context *ct) - ret = rados_mon_command(ct->cluster, (const char **)cmd, 1, "", 0, - NULL, 0, &stat, &stat_len); - if (ret < 0) { + 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", + condlog(1, "rbd%d: repair failed to remove blacklist for %s %d", - ct->rbd_bus_id, ct->client_addr, ret); - goto free_cmd; - } - + ct->rbd_bus_id, ct->client_addr, ret); + goto free_cmd; + } + - condlog(1, "rbd%d repair rm blacklist for %s", + condlog(1, "rbd%d: repair rm blacklist for %s", - ct->rbd_bus_id, ct->client_addr); - free(stat); + ct->rbd_bus_id, ct->client_addr); + free(stat); free_cmd: @@ -478,8 +482,7 @@ static int rbd_repair(struct rbd_checker_context *ct, char *msg) - if (!ct->remapped) { - ret = rbd_remap(ct); - if (ret) { + if (!ct->remapped) { + ret = rbd_remap(ct); + if (ret) { - RBD_MSG(msg, "rbd%d repair failed to remap. Err %d", - ct->rbd_bus_id, ret); + RBD_MSG(msg, "repair failed to remap. Err %d", ret); - return PATH_DOWN; - } - } + return PATH_DOWN; + } + } @@ -488,22 +491,21 @@ static int rbd_repair(struct rbd_checker_context *ct, char *msg) - snprintf(del, sizeof(del), "%d force", ct->rbd_bus_id); - ret = sysfs_write_rbd_remove(del, strlen(del) + 1); - if (ret) { + snprintf(del, sizeof(del), "%d force", ct->rbd_bus_id); + ret = sysfs_write_rbd_remove(del, strlen(del) + 1); + if (ret) { - RBD_MSG(msg, "rbd%d repair failed to clean up. Err %d", - ct->rbd_bus_id, ret); + RBD_MSG(msg, "repair failed to clean up. Err %d", ret); - return PATH_DOWN; - } - - ret = rbd_rm_blacklist(ct); - if (ret) { + return PATH_DOWN; + } + + ret = rbd_rm_blacklist(ct); + if (ret) { - RBD_MSG(msg, "rbd%d repair could not remove blacklist entry. Err %d", - ct->rbd_bus_id, ret); + RBD_MSG(msg, "repair could not remove blacklist entry. Err %d", + ret); - return PATH_DOWN; - } - - ct->remapped = 0; - ct->blacklisted = 0; - + return PATH_DOWN; + } + + ct->remapped = 0; + ct->blacklisted = 0; + - RBD_MSG(msg, "rbd%d has been repaired", ct->rbd_bus_id); + RBD_MSG(msg, "has been repaired"); - return PATH_UP; + return PATH_UP; } - + @@ -528,7 +530,7 @@ void *rbd_thread(void *ctx) - struct rbd_checker_context *ct = ctx; - int state; - + struct rbd_checker_context *ct = ctx; + int state; + - condlog(3, "rbd%d thread starting up", ct->rbd_bus_id); + condlog(3, "rbd%d: thread starting up", ct->rbd_bus_id); - - ct->message[0] = '\0'; - /* This thread can be canceled, so setup clean up */ + + ct->message[0] = '\0'; + /* This thread can be canceled, so setup clean up */ @@ -547,7 +549,7 @@ void *rbd_thread(void *ctx) - pthread_mutex_unlock(&ct->lock); - pthread_cond_signal(&ct->active); - + pthread_mutex_unlock(&ct->lock); + pthread_cond_signal(&ct->active); + - condlog(3, "rbd%d thead finished, state %s", ct->rbd_bus_id, + condlog(3, "rbd%d: thead finished, state %s", ct->rbd_bus_id, - checker_state_name(state)); - rbd_thread_cleanup_pop(ct); - return ((void *)0); + checker_state_name(state)); + rbd_thread_cleanup_pop(ct); + return ((void *)0); @@ -577,16 +579,17 @@ static int rbd_exec_fn(struct checker *c, thread_fn *fn) - */ - r = pthread_mutex_lock(&ct->lock); - if (r != 0) { + */ + r = pthread_mutex_lock(&ct->lock); + if (r != 0) { - condlog(2, "rbd%d mutex lock failed with %d", ct->rbd_bus_id, + condlog(2, "rbd%d: mutex lock failed with %d", ct->rbd_bus_id, - r); + r); - MSG(c, "rbd%d thread failed to initialize", ct->rbd_bus_id); + 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) { + 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); + condlog(3, "rbd%d: thread not finished", + ct->rbd_bus_id); - rbd_status = PATH_PENDING; - } else { - /* checker done */ + rbd_status = PATH_PENDING; + } else { + /* checker done */ @@ -623,7 +626,7 @@ static int rbd_exec_fn(struct checker *c, thread_fn *fn) - - if (ct->thread && - (rbd_status == PATH_PENDING || rbd_status == PATH_UNCHECKED)) { + + if (ct->thread && + (rbd_status == PATH_PENDING || rbd_status == PATH_UNCHECKED)) { - condlog(3, "rbd%d thread still running", + condlog(3, "rbd%d: thread still running", - ct->rbd_bus_id); - ct->running = 1; - rbd_status = PATH_PENDING; --- + ct->rbd_bus_id); + ct->running = 1; + rbd_status = PATH_PENDING; +-- 1.8.3.1 + diff --git a/SOURCES/0188-RHBZ-1368501-dont-exit.patch b/SOURCES/0188-RHBZ-1368501-dont-exit.patch index bbe91fee..47839916 100644 --- a/SOURCES/0188-RHBZ-1368501-dont-exit.patch +++ b/SOURCES/0188-RHBZ-1368501-dont-exit.patch @@ -8,201 +8,201 @@ Index: multipath-tools-130222/libmultipath/configure.c --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -829,8 +829,10 @@ coalesce_paths (struct vectors * vecs, v - * at this point, we know we really got a new mp - */ - mpp = add_map_with_path(vecs, pp1, 0); + * at this point, we know we really got a new mp + */ + mpp = add_map_with_path(vecs, pp1, 0); - if (!mpp) - return 1; + if (!mpp) { + orphan_path(pp1); + continue; + } - - if (pp1->priority == PRIO_UNDEF) - mpp->action = ACT_REJECT; + + if (pp1->priority == PRIO_UNDEF) + mpp->action = ACT_REJECT; @@ -879,7 +881,7 @@ coalesce_paths (struct vectors * vecs, v - condlog(3, "%s: domap (%u) failure " - "for create/reload map", - mpp->alias, r); + condlog(3, "%s: domap (%u) failure " + "for create/reload map", + mpp->alias, r); - if (r == DOMAP_FAIL) { + if (r == DOMAP_FAIL || conf->daemon) { - condlog(2, "%s: %s map", - mpp->alias, (mpp->action == ACT_CREATE)? - "ignoring" : "removing"); + condlog(2, "%s: %s map", + mpp->alias, (mpp->action == ACT_CREATE)? + "ignoring" : "removing"); Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -821,7 +821,7 @@ map_discovery (struct vectors * vecs) - - vector_foreach_slot (vecs->mpvec, mpp, i) - if (setup_multipath(vecs, mpp)) + + vector_foreach_slot (vecs->mpvec, mpp, i) + if (setup_multipath(vecs, mpp)) - return 1; + i--; - - return 0; + + return 0; } @@ -1523,21 +1523,29 @@ configure (struct vectors * vecs, int st - vector mpvec; - int i, ret; - + vector mpvec; + int i, ret; + - if (!vecs->pathvec && !(vecs->pathvec = vector_alloc())) + if (!vecs->pathvec && !(vecs->pathvec = vector_alloc())) { + condlog(0, "couldn't allocate path vec in configure"); - return 1; + return 1; + } - + - if (!vecs->mpvec && !(vecs->mpvec = vector_alloc())) + if (!vecs->mpvec && !(vecs->mpvec = vector_alloc())) { + condlog(0, "couldn't allocate multipath vec in configure"); - return 1; + return 1; + } - + - if (!(mpvec = vector_alloc())) + if (!(mpvec = vector_alloc())) { + condlog(0, "couldn't allocate new maps vec in configure"); - return 1; + return 1; + } - - /* - * probe for current path (from sysfs) and map (from dm) sets - */ - ret = path_discovery(vecs->pathvec, conf, DI_ALL); + + /* + * probe for current path (from sysfs) and map (from dm) sets + */ + ret = path_discovery(vecs->pathvec, conf, DI_ALL); - if (ret < 0) + if (ret < 0) { + condlog(0, "configure failed at path discovery"); - return 1; + return 1; + } - - vector_foreach_slot (vecs->pathvec, pp, i){ - if (filter_path(conf, pp) > 0){ + + vector_foreach_slot (vecs->pathvec, pp, i){ + if (filter_path(conf, pp) > 0){ @@ -1548,21 +1556,27 @@ configure (struct vectors * vecs, int st - else - pp->checkint = conf->checkint; - } + else + pp->checkint = conf->checkint; + } - if (map_discovery(vecs)) + if (map_discovery(vecs)) { + condlog(0, "configure failed at map discovery"); - return 1; + return 1; + } - - /* - * create new set of maps & push changed ones into dm - */ + + /* + * create new set of maps & push changed ones into dm + */ - if (coalesce_paths(vecs, mpvec, NULL, 1)) + if (coalesce_paths(vecs, mpvec, NULL, 1)) { + condlog(0, "configure failed while coalescing paths"); - return 1; + return 1; + } - - /* - * may need to remove some maps which are no longer relevant - * e.g., due to blacklist changes in conf file - */ + + /* + * may need to remove some maps which are no longer relevant + * e.g., due to blacklist changes in conf file + */ - if (coalesce_maps(vecs, mpvec)) + if (coalesce_maps(vecs, mpvec)) { + condlog(0, "configure failed while coalescing maps"); - return 1; + return 1; + } - - dm_lib_release(); - + + dm_lib_release(); + @@ -1588,11 +1602,15 @@ configure (struct vectors * vecs, int st - * start dm event waiter threads for these new maps - */ - vector_foreach_slot(vecs->mpvec, mpp, i) { + * start dm event waiter threads for these new maps + */ + vector_foreach_slot(vecs->mpvec, mpp, i) { - if (setup_multipath(vecs, mpp)) - return 1; + if (setup_multipath(vecs, mpp)) { + i--; + continue; + } - if (start_waiters) + if (start_waiters) - if (start_waiter_thread(mpp, vecs)) - return 1; + if (start_waiter_thread(mpp, vecs)) { + remove_map(mpp, vecs, 1); + i--; + } - } - return 0; + } + return 0; } @@ -1857,15 +1875,23 @@ child (void * param) - condlog(2, "--------start up--------"); - condlog(2, "read " DEFAULT_CONFIGFILE); - + condlog(2, "--------start up--------"); + condlog(2, "read " DEFAULT_CONFIGFILE); + - if (load_config(DEFAULT_CONFIGFILE, udev)) + if (load_config(DEFAULT_CONFIGFILE, udev)) { + condlog(0, "failed to load config"); + if (logsink) + log_thread_stop(); - exit(1); + exit(1); + } - - if (init_checkers()) { - condlog(0, "failed to initialize checkers"); + + if (init_checkers()) { + condlog(0, "failed to initialize checkers"); + if (logsink) + log_thread_stop(); - exit(1); - } - if (init_prio()) { - condlog(0, "failed to initialize prioritizers"); + exit(1); + } + if (init_prio()) { + condlog(0, "failed to initialize prioritizers"); + if (logsink) + log_thread_stop(); - exit(1); - } - + exit(1); + } + @@ -1898,8 +1924,12 @@ child (void * param) - } - - vecs = gvecs = init_vecs(); + } + + vecs = gvecs = init_vecs(); - if (!vecs) + if (!vecs) { + condlog(0, "failed to create vecs"); + if (logsink) + log_thread_stop(); - exit(1); + exit(1); + } - - setscheduler(); - set_oom_adj(); + + setscheduler(); + set_oom_adj(); @@ -1911,11 +1941,15 @@ child (void * param) - */ - if ((rc = pthread_create(&uevent_thr, &uevent_attr, ueventloop, udev))) { - condlog(0, "failed to create uevent thread: %d", rc); + */ + if ((rc = pthread_create(&uevent_thr, &uevent_attr, ueventloop, udev))) { + condlog(0, "failed to create uevent thread: %d", rc); + if (logsink) + log_thread_stop(); - exit(1); - } - pthread_attr_destroy(&uevent_attr); - if ((rc = pthread_create(&uxlsnr_thr, &misc_attr, uxlsnrloop, vecs))) { - condlog(0, "failed to create cli listener: %d", rc); + exit(1); + } + pthread_attr_destroy(&uevent_attr); + if ((rc = pthread_create(&uxlsnr_thr, &misc_attr, uxlsnrloop, vecs))) { + condlog(0, "failed to create cli listener: %d", rc); + if (logsink) + log_thread_stop(); - exit(1); - } - /* + exit(1); + } + /* @@ -1927,6 +1961,8 @@ child (void * param) - if (configure(vecs, 1)) { - unlock(vecs->lock); - condlog(0, "failure during configuration"); + if (configure(vecs, 1)) { + unlock(vecs->lock); + condlog(0, "failure during configuration"); + if (logsink) + log_thread_stop(); - exit(1); - } - unlock(vecs->lock); + exit(1); + } + unlock(vecs->lock); @@ -1936,10 +1972,14 @@ child (void * param) - */ - if ((rc = pthread_create(&check_thr, &misc_attr, checkerloop, vecs))) { - condlog(0,"failed to create checker loop thread: %d", rc); + */ + if ((rc = pthread_create(&check_thr, &misc_attr, checkerloop, vecs))) { + condlog(0,"failed to create checker loop thread: %d", rc); + if (logsink) + log_thread_stop(); - exit(1); - } - if ((rc = pthread_create(&uevq_thr, &misc_attr, uevqloop, vecs))) { - condlog(0, "failed to create uevent dispatcher: %d", rc); + exit(1); + } + if ((rc = pthread_create(&uevq_thr, &misc_attr, uevqloop, vecs))) { + condlog(0, "failed to create uevent dispatcher: %d", rc); + if (logsink) + log_thread_stop(); - exit(1); - } - pthread_attr_destroy(&misc_attr); + exit(1); + } + pthread_attr_destroy(&misc_attr); diff --git a/SOURCES/0189-RHBZ-1368211-remove-retries.patch b/SOURCES/0189-RHBZ-1368211-remove-retries.patch index df999a5e..253d5725 100644 --- a/SOURCES/0189-RHBZ-1368211-remove-retries.patch +++ b/SOURCES/0189-RHBZ-1368211-remove-retries.patch @@ -17,17 +17,17 @@ Index: multipath-tools-130222/libmultipath/devmapper.c { - int s = 0, queue_if_no_path = 0; + int need_reset = 0, queue_if_no_path = 0; - unsigned long long mapsize; - char params[PARAMS_SIZE] = {0}; - int udev_flags = 0; + unsigned long long mapsize; + char params[PARAMS_SIZE] = {0}; + int udev_flags = 0; + int retries = conf->remove_retries; - - if (!dm_is_mpath(mapname)) - return 0; /* nothing to do */ + + if (!dm_is_mpath(mapname)) + return 0; /* nothing to do */ @@ -821,22 +822,24 @@ dm_suspend_and_flush_map (const char * m - queue_if_no_path = 1; - } - + queue_if_no_path = 1; + } + - if (queue_if_no_path) - s = dm_queue_if_no_path((char *)mapname, 0); - /* Leave queue_if_no_path alone if unset failed */ @@ -55,47 +55,47 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + if (retries) + sleep(1); + } while (retries-- > 0); - condlog(2, "failed to remove multipath map %s", mapname); + condlog(2, "failed to remove multipath map %s", mapname); - dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname, udev_flags); - if (queue_if_no_path) - s = dm_queue_if_no_path((char *)mapname, 1); + if (need_reset) + dm_queue_if_no_path((char *)mapname, 1); - return 1; + return 1; } - + Index: multipath-tools-130222/libmultipath/config.c =================================================================== --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -680,6 +680,7 @@ load_config (char * file, struct udev *u - conf->new_bindings_in_boot = 0; - conf->uev_wait_timeout = DEFAULT_UEV_WAIT_TIMEOUT; - conf->skip_kpartx = DEFAULT_SKIP_KPARTX; + conf->new_bindings_in_boot = 0; + conf->uev_wait_timeout = DEFAULT_UEV_WAIT_TIMEOUT; + conf->skip_kpartx = DEFAULT_SKIP_KPARTX; + conf->remove_retries = 0; - - /* - * preload default hwtable + + /* + * preload default hwtable Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -146,6 +146,7 @@ struct config { - int delayed_reconfig; - int uev_wait_timeout; - int skip_kpartx; + int delayed_reconfig; + int uev_wait_timeout; + int skip_kpartx; + int remove_retries; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/libmultipath/dict.c =================================================================== --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -935,6 +935,24 @@ def_new_bindings_in_boot_handler(vector - return 0; + return 0; } - + +static int +def_remove_retries_handler(vector strvec) +{ @@ -119,7 +119,7 @@ Index: multipath-tools-130222/libmultipath/dict.c */ @@ -3405,6 +3423,12 @@ snprint_def_new_bindings_in_boot(char * } - + static int +snprint_def_remove_retries (char * buff, int len, void * data) +{ @@ -129,15 +129,15 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_ble_simple (char * buff, int len, void * data) { - struct blentry * ble = (struct blentry *)data; + struct blentry * ble = (struct blentry *)data; @@ -3483,6 +3507,7 @@ init_keywords(void) - install_keyword("retrigger_delay", &def_retrigger_delay_handler, &snprint_def_retrigger_delay); - install_keyword("missing_uev_wait_timeout", &def_uev_wait_timeout_handler, &snprint_def_uev_wait_timeout); - install_keyword("new_bindings_in_boot", &def_new_bindings_in_boot_handler, &snprint_def_new_bindings_in_boot); + install_keyword("retrigger_delay", &def_retrigger_delay_handler, &snprint_def_retrigger_delay); + install_keyword("missing_uev_wait_timeout", &def_uev_wait_timeout_handler, &snprint_def_uev_wait_timeout); + install_keyword("new_bindings_in_boot", &def_new_bindings_in_boot_handler, &snprint_def_new_bindings_in_boot); + install_keyword("remove_retries", &def_remove_retries_handler, &snprint_def_remove_retries); - __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); + __deprecated install_keyword("default_selector", &def_selector_handler, NULL); + __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); + __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); Index: multipath-tools-130222/multipath.conf.defaults =================================================================== --- multipath-tools-130222.orig/multipath.conf.defaults diff --git a/SOURCES/0190-RHBZ-1380602-rbd-lock-on-read.patch b/SOURCES/0190-RHBZ-1380602-rbd-lock-on-read.patch index ede85796..584d37f1 100644 --- a/SOURCES/0190-RHBZ-1380602-rbd-lock-on-read.patch +++ b/SOURCES/0190-RHBZ-1380602-rbd-lock-on-read.patch @@ -7,32 +7,32 @@ Index: multipath-tools-130222/libmultipath/checkers/rbd.c --- multipath-tools-130222.orig/libmultipath/checkers/rbd.c +++ multipath-tools-130222/libmultipath/checkers/rbd.c @@ -45,6 +45,7 @@ struct rbd_checker_context { - char *username; - int remapped; - int blacklisted; + char *username; + int remapped; + int blacklisted; + int lock_on_read:1; - - rados_t cluster; - + + rados_t cluster; + @@ -141,6 +142,9 @@ int libcheck_init(struct checker * c) - goto free_addr; - } - + 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; + ct->config_info = strdup(config_info); + if (!ct->config_info) + goto free_addr; @@ -397,7 +401,10 @@ static int rbd_remap(struct rbd_checker_ - case 0: - argv[i++] = "rbd"; - argv[i++] = "map"; + case 0: + argv[i++] = "rbd"; + argv[i++] = "map"; - argv[i++] = "-o noshare"; + 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; + if (ct->username) { + argv[i++] = "--id"; + argv[i++] = ct->username; diff --git a/SOURCES/0191-RHBZ-1169168-disable-changed-paths.patch b/SOURCES/0191-RHBZ-1169168-disable-changed-paths.patch index 413da7c6..4c1eb6bf 100644 --- a/SOURCES/0191-RHBZ-1169168-disable-changed-paths.patch +++ b/SOURCES/0191-RHBZ-1169168-disable-changed-paths.patch @@ -14,51 +14,51 @@ Index: multipath-tools-130222/libmultipath/discovery.c --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -1155,8 +1155,8 @@ free_dev: - return ret; + return ret; } - + -static int -get_uid (struct path * pp) +int +get_uid (struct path * pp, struct udev_device *udev) { - char *c; - const char *value; + char *c; + const char *value; @@ -1165,7 +1165,7 @@ get_uid (struct path * pp) - if (!pp->uid_attribute) - select_getuid(pp); - + if (!pp->uid_attribute) + select_getuid(pp); + - if (!pp->udev) { + if (!udev) { - condlog(1, "%s: no udev information", pp->dev); - return 1; - } + condlog(1, "%s: no udev information", pp->dev); + return 1; + } @@ -1180,7 +1180,7 @@ get_uid (struct path * pp) - pp->tick = conf->retrigger_delay; - } - } else { + pp->tick = conf->retrigger_delay; + } + } else { - value = udev_device_get_property_value(pp->udev, + value = udev_device_get_property_value(udev, - pp->uid_attribute); - if ((!value || strlen(value) == 0) && - conf->cmd == CMD_VALID_PATH) + pp->uid_attribute); + if ((!value || strlen(value) == 0) && + conf->cmd == CMD_VALID_PATH) @@ -1194,6 +1194,7 @@ get_uid (struct path * pp) - len = strlen(value); - } - strncpy(pp->wwid, value, len); + len = strlen(value); + } + strncpy(pp->wwid, value, len); + condlog(4, "%s: got wwid of '%s'", pp->dev, pp->wwid); - pp->missing_udev_info = INFO_OK; - pp->tick = 0; - } else { + pp->missing_udev_info = INFO_OK; + pp->tick = 0; + } else { @@ -1282,7 +1283,7 @@ pathinfo (struct path *pp, vector hwtabl - } - - if ((mask & DI_WWID) && !strlen(pp->wwid)) + } + + if ((mask & DI_WWID) && !strlen(pp->wwid)) - get_uid(pp); + get_uid(pp, pp->udev); - if (mask & DI_BLACKLIST && mask & DI_WWID) { - if (filter_wwid(conf->blist_wwid, conf->elist_wwid, - pp->wwid) > 0) { + if (mask & DI_BLACKLIST && mask & DI_WWID) { + if (filter_wwid(conf->blist_wwid, conf->elist_wwid, + pp->wwid) > 0) { Index: multipath-tools-130222/libmultipath/discovery.h =================================================================== --- multipath-tools-130222.orig/libmultipath/discovery.h @@ -68,7 +68,7 @@ Index: multipath-tools-130222/libmultipath/discovery.h int sysfs_get_host_pci_name(struct path *pp, char *pci_name); int sysfs_get_iscsi_ip_address(struct path *pp, char *ip_address); +int get_uid (struct path * pp, struct udev_device *udev); - + /* * discovery bitmask Index: multipath-tools-130222/libmultipath/structs.h @@ -76,21 +76,21 @@ Index: multipath-tools-130222/libmultipath/structs.h --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -209,6 +209,7 @@ struct path { - int fd; - int missing_udev_info; - int retriggers; + int fd; + int missing_udev_info; + int retriggers; + int wwid_changed; - - /* configlet pointers */ - struct hwentry * hwe; + + /* configlet pointers */ + struct hwentry * hwe; Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -784,6 +784,26 @@ uev_update_path (struct uevent *uev, str - if (pp->missing_udev_info == INFO_REQUESTED) - return uev_add_path(uev, vecs); - + if (pp->missing_udev_info == INFO_REQUESTED) + return uev_add_path(uev, vecs); + + if (conf->disable_changed_wwids && + (strlen(pp->wwid) || pp->wwid_changed)) { + char wwid[WWID_SIZE]; @@ -111,54 +111,54 @@ Index: multipath-tools-130222/multipathd/main.c + } + } + - /* reinit the prio values on change event, in case something is - * different */ - prio_init(&pp->prio); + /* reinit the prio values on change event, in case something is + * different */ + prio_init(&pp->prio); @@ -1284,6 +1304,12 @@ check_path (struct vectors * vecs, struc - else - checker_clear_message(&pp->checker); - + else + checker_clear_message(&pp->checker); + + if (pp->wwid_changed) { + condlog(2, "%s: path wwid has changed. Refusing to use", + pp->dev); + newstate = PATH_DOWN; + } + - if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) { - condlog(2, "%s: unusable path", pp->dev); - pathinfo(pp, conf->hwtable, 0); + if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) { + condlog(2, "%s: unusable path", pp->dev); + pathinfo(pp, conf->hwtable, 0); Index: multipath-tools-130222/libmultipath/config.c =================================================================== --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -681,6 +681,7 @@ load_config (char * file, struct udev *u - conf->uev_wait_timeout = DEFAULT_UEV_WAIT_TIMEOUT; - conf->skip_kpartx = DEFAULT_SKIP_KPARTX; - conf->remove_retries = 0; + conf->uev_wait_timeout = DEFAULT_UEV_WAIT_TIMEOUT; + conf->skip_kpartx = DEFAULT_SKIP_KPARTX; + conf->remove_retries = 0; + conf->disable_changed_wwids = 0; - - /* - * preload default hwtable + + /* + * preload default hwtable Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -147,6 +147,7 @@ struct config { - int uev_wait_timeout; - int skip_kpartx; - int remove_retries; + int uev_wait_timeout; + int skip_kpartx; + int remove_retries; + int disable_changed_wwids; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/libmultipath/dict.c =================================================================== --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -953,6 +953,29 @@ def_remove_retries_handler(vector strvec - return 0; + return 0; } - + +static int +def_disable_changed_wwids_handler(vector strvec) +{ @@ -187,7 +187,7 @@ Index: multipath-tools-130222/libmultipath/dict.c */ @@ -3429,6 +3452,15 @@ snprint_def_remove_retries (char * buff, } - + static int +snprint_def_disable_changed_wwids(char * buff, int len, void * data) +{ @@ -200,15 +200,15 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_ble_simple (char * buff, int len, void * data) { - struct blentry * ble = (struct blentry *)data; + struct blentry * ble = (struct blentry *)data; @@ -3508,6 +3540,7 @@ init_keywords(void) - install_keyword("missing_uev_wait_timeout", &def_uev_wait_timeout_handler, &snprint_def_uev_wait_timeout); - install_keyword("new_bindings_in_boot", &def_new_bindings_in_boot_handler, &snprint_def_new_bindings_in_boot); - install_keyword("remove_retries", &def_remove_retries_handler, &snprint_def_remove_retries); + install_keyword("missing_uev_wait_timeout", &def_uev_wait_timeout_handler, &snprint_def_uev_wait_timeout); + install_keyword("new_bindings_in_boot", &def_new_bindings_in_boot_handler, &snprint_def_new_bindings_in_boot); + install_keyword("remove_retries", &def_remove_retries_handler, &snprint_def_remove_retries); + install_keyword("disable_changed_wwids", &def_disable_changed_wwids_handler, &snprint_def_disable_changed_wwids); - __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); + __deprecated install_keyword("default_selector", &def_selector_handler, NULL); + __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); + __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.conf.5 diff --git a/SOURCES/0192-RHBZ-1362409-infinibox-config.patch b/SOURCES/0192-RHBZ-1362409-infinibox-config.patch index cee3e7fc..dd56f8b2 100644 --- a/SOURCES/0192-RHBZ-1362409-infinibox-config.patch +++ b/SOURCES/0192-RHBZ-1362409-infinibox-config.patch @@ -7,9 +7,9 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -1168,6 +1168,25 @@ static struct hwentry default_hw[] = { - .prio_name = PRIO_ALUA, - .prio_args = NULL, - }, + .prio_name = PRIO_ALUA, + .prio_args = NULL, + }, + /* + * Infinidat + */ @@ -29,6 +29,6 @@ Index: multipath-tools-130222/libmultipath/hwtable.c + .flush_on_last_del = FLUSH_ENABLED, + .dev_loss = 30, + }, - { - .vendor = "XtremIO", - .product = "XtremApp", + { + .vendor = "XtremIO", + .product = "XtremApp", diff --git a/SOURCES/0194-RHBZ-1351964-kpartx-recurse.patch b/SOURCES/0194-RHBZ-1351964-kpartx-recurse.patch index d8c08d79..be5b22ed 100644 --- a/SOURCES/0194-RHBZ-1351964-kpartx-recurse.patch +++ b/SOURCES/0194-RHBZ-1351964-kpartx-recurse.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/kpartx/dos.c --- multipath-tools-130222.orig/kpartx/dos.c +++ multipath-tools-130222/kpartx/dos.c @@ -46,7 +46,7 @@ read_extended_partition(int fd, struct p - for (i=0; i<2; i++) { - memcpy(&p, bp + 0x1be + i * sizeof (p), sizeof (p)); - if (is_extended(p.sys_type)) { + for (i=0; i<2; i++) { + memcpy(&p, bp + 0x1be + i * sizeof (p), sizeof (p)); + if (is_extended(p.sys_type)) { - if (p.nr_sects && !moretodo) { + if (p.start_sect && p.nr_sects && !moretodo) { - next = start + sector_size_mul * le32_to_cpu(p.start_sect); - moretodo = 1; - } + next = start + sector_size_mul * le32_to_cpu(p.start_sect); + moretodo = 1; + } diff --git a/SOURCES/0195-RHBZ-1359510-no-daemon-msg.patch b/SOURCES/0195-RHBZ-1359510-no-daemon-msg.patch index 48547992..667f10d1 100644 --- a/SOURCES/0195-RHBZ-1359510-no-daemon-msg.patch +++ b/SOURCES/0195-RHBZ-1359510-no-daemon-msg.patch @@ -9,27 +9,27 @@ Index: multipath-tools-130222/libmultipath/configure.c --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -743,7 +743,8 @@ deadmap (struct multipath * mpp) - return 1; /* dead */ + return 1; /* dead */ } - + -int check_daemon(void) +extern int +check_daemon(void) { - int fd; - char *reply; + int fd; + char *reply; @@ -776,6 +777,7 @@ coalesce_paths (struct vectors * vecs, v { - int r = 1; - int k, i; + int r = 1; + int k, i; + int map_processed = 0; - char empty_buff[WWID_SIZE]; - char params[PARAMS_SIZE]; - struct multipath * mpp; + char empty_buff[WWID_SIZE]; + char params[PARAMS_SIZE]; + struct multipath * mpp; @@ -936,6 +938,13 @@ coalesce_paths (struct vectors * vecs, v - else - remove_map(mpp, vecs, 0); - } + else + remove_map(mpp, vecs, 0); + } + + /* By now at least one multipath device map is processed, + * so set map_processed = 1 @@ -37,13 +37,13 @@ Index: multipath-tools-130222/libmultipath/configure.c + if (!map_processed) + map_processed = 1; + - } - /* - * Flush maps with only dead paths (ie not in sysfs) + } + /* + * Flush maps with only dead paths (ie not in sysfs) @@ -963,6 +972,16 @@ coalesce_paths (struct vectors * vecs, v - condlog(2, "%s: remove (dead)", alias); - } - } + condlog(2, "%s: remove (dead)", alias); + } + } + + /* If there is at least one multipath device map processed then + * check if 'multipathd' service is running or not? @@ -54,9 +54,9 @@ Index: multipath-tools-130222/libmultipath/configure.c + "running, IO failover/failback will not work"); + } + - return 0; + return 0; } - + Index: multipath-tools-130222/libmultipath/configure.h =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.h @@ -76,15 +76,15 @@ Index: multipath-tools-130222/multipath/main.c @@ -178,6 +178,7 @@ static int get_dm_mpvec (vector curmp, vector pathvec, char * refwwid) { - int i; + int i; + int maps_present = 0; - struct multipath * mpp; - char params[PARAMS_SIZE], status[PARAMS_SIZE]; - + struct multipath * mpp; + char params[PARAMS_SIZE], status[PARAMS_SIZE]; + @@ -226,7 +227,27 @@ get_dm_mpvec (vector curmp, vector pathv - - if (conf->cmd == CMD_CREATE) - reinstate_paths(mpp); + + if (conf->cmd == CMD_CREATE) + reinstate_paths(mpp); + + /* At this place we have found at least one multipath + * device map, so set maps_present = 1 @@ -92,7 +92,7 @@ Index: multipath-tools-130222/multipath/main.c + if (!maps_present) + maps_present = 1; + - } + } + + /* If there is at least one multipath device map present then + * check if 'multipathd' service is running or not? @@ -106,5 +106,6 @@ Index: multipath-tools-130222/multipath/main.c + } + } + - return 0; + return 0; } + diff --git a/SOURCES/0196-RHBZ-1239173-dont-set-flag.patch b/SOURCES/0196-RHBZ-1239173-dont-set-flag.patch index 8c6b8523..269edc8e 100644 --- a/SOURCES/0196-RHBZ-1239173-dont-set-flag.patch +++ b/SOURCES/0196-RHBZ-1239173-dont-set-flag.patch @@ -9,30 +9,30 @@ Index: multipath-tools-130222/libmultipath/configure.c @@ -257,7 +257,7 @@ extern int setup_map (struct multipath * mpp, char * params, int params_size) { - struct pathgroup * pgp; + struct pathgroup * pgp; - int i; + int i, old_nr_active; - - /* - * don't bother if devmap size is unknown + + /* + * don't bother if devmap size is unknown @@ -311,8 +311,12 @@ setup_map (struct multipath * mpp, char - if (mpp->pgpolicyfn && mpp->pgpolicyfn(mpp)) - return 1; - + if (mpp->pgpolicyfn && mpp->pgpolicyfn(mpp)) + return 1; + + old_nr_active = mpp->nr_active; - mpp->nr_active = pathcount(mpp, PATH_UP) + pathcount(mpp, PATH_GHOST); - + mpp->nr_active = pathcount(mpp, PATH_UP) + pathcount(mpp, PATH_GHOST); + + if (mpp->nr_active && !old_nr_active) + mpp->force_udev_reload = 1; + - /* - * ponders each path group and determine highest prio pg - * to switch over (default to first) + /* + * ponders each path group and determine highest prio pg + * to switch over (default to first) @@ -445,7 +449,6 @@ select_action (struct multipath * mpp, v - mpp->alias); - return; - } + mpp->alias); + return; + } - mpp->force_udev_reload = !pathcount(mpp, PATH_WILD); - if (cmpp->size != mpp->size) { - mpp->force_udev_reload = 1; - mpp->action = ACT_RESIZE; + if (cmpp->size != mpp->size) { + mpp->force_udev_reload = 1; + mpp->action = ACT_RESIZE; diff --git a/SOURCES/0197-RHBZ-1394059-max-sectors-kb.patch b/SOURCES/0197-RHBZ-1394059-max-sectors-kb.patch index 7d5f56d8..f5cfa233 100644 --- a/SOURCES/0197-RHBZ-1394059-max-sectors-kb.patch +++ b/SOURCES/0197-RHBZ-1394059-max-sectors-kb.patch @@ -1,14 +1,14 @@ --- libmultipath/config.c | 3 + libmultipath/config.h | 3 + - libmultipath/configure.c | 1 - libmultipath/defaults.h | 1 + libmultipath/configure.c | 1 + libmultipath/defaults.h | 1 libmultipath/devmapper.c | 4 +- libmultipath/dict.c | 87 +++++++++++++++++++++++++++++++++++++++++++++ libmultipath/discovery.c | 60 +++++++++++++++++++++++++++++++ - libmultipath/discovery.h | 1 + libmultipath/discovery.h | 1 libmultipath/propsel.c | 25 ++++++++++++ - libmultipath/propsel.h | 1 + libmultipath/propsel.h | 1 libmultipath/structs.h | 7 +++ multipath/multipath.conf.5 | 8 ++++ 12 files changed, 200 insertions(+), 1 deletion(-) @@ -18,69 +18,69 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -344,6 +344,7 @@ merge_hwe (struct hwentry * dst, struct - merge_num(delay_watch_checks); - merge_num(delay_wait_checks); - merge_num(skip_kpartx); + merge_num(delay_watch_checks); + merge_num(delay_wait_checks); + merge_num(skip_kpartx); + merge_num(max_sectors_kb); - - /* - * Make sure features is consistent with + + /* + * Make sure features is consistent with @@ -405,6 +406,7 @@ overwrite_hwe (struct hwentry * dst, str - overwrite_num(delay_watch_checks); - overwrite_num(delay_wait_checks); - overwrite_num(skip_kpartx); + overwrite_num(delay_watch_checks); + overwrite_num(delay_wait_checks); + overwrite_num(skip_kpartx); + overwrite_num(max_sectors_kb); - - /* - * Make sure features is consistent with + + /* + * Make sure features is consistent with @@ -682,6 +684,7 @@ load_config (char * file, struct udev *u - conf->skip_kpartx = DEFAULT_SKIP_KPARTX; - conf->remove_retries = 0; - conf->disable_changed_wwids = 0; + conf->skip_kpartx = DEFAULT_SKIP_KPARTX; + conf->remove_retries = 0; + conf->disable_changed_wwids = 0; + conf->max_sectors_kb = DEFAULT_MAX_SECTORS_KB; - - /* - * preload default hwtable + + /* + * preload default hwtable Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -65,6 +65,7 @@ struct hwentry { - int delay_watch_checks; - int delay_wait_checks; - int skip_kpartx; + int delay_watch_checks; + int delay_wait_checks; + int skip_kpartx; + int max_sectors_kb; - char * bl_product; + char * bl_product; }; - + @@ -92,6 +93,7 @@ struct mpentry { - int delay_watch_checks; - int delay_wait_checks; - int skip_kpartx; + int delay_watch_checks; + int delay_wait_checks; + int skip_kpartx; + int max_sectors_kb; - uid_t uid; - gid_t gid; - mode_t mode; + uid_t uid; + gid_t gid; + mode_t mode; @@ -148,6 +150,7 @@ struct config { - int skip_kpartx; - int remove_retries; - int disable_changed_wwids; + int skip_kpartx; + int remove_retries; + int disable_changed_wwids; + int max_sectors_kb; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/libmultipath/configure.c =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -295,6 +295,7 @@ setup_map (struct multipath * mpp, char - select_delay_watch_checks(mpp); - select_delay_wait_checks(mpp); - select_skip_kpartx(mpp); + select_delay_watch_checks(mpp); + select_delay_wait_checks(mpp); + select_skip_kpartx(mpp); + select_max_sectors_kb(mpp); - - sysfs_set_scsi_tmo(mpp); - /* + + sysfs_set_scsi_tmo(mpp); + /* Index: multipath-tools-130222/libmultipath/defaults.h =================================================================== --- multipath-tools-130222.orig/libmultipath/defaults.h @@ -90,7 +90,7 @@ Index: multipath-tools-130222/libmultipath/defaults.h #define DEFAULT_UEV_WAIT_TIMEOUT 30 #define DEFAULT_SKIP_KPARTX SKIP_KPARTX_OFF +#define DEFAULT_MAX_SECTORS_KB MAX_SECTORS_KB_UNDEF - + #define DEFAULT_CHECKINT 5 #define MAX_CHECKINT(a) (a << 2) Index: multipath-tools-130222/libmultipath/dict.c @@ -98,9 +98,9 @@ Index: multipath-tools-130222/libmultipath/dict.c --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -976,6 +976,22 @@ def_disable_changed_wwids_handler(vector - return 0; + return 0; } - + +static int +def_max_sectors_kb_handler(vector strvec) +{ @@ -121,9 +121,9 @@ Index: multipath-tools-130222/libmultipath/dict.c * blacklist block handlers */ @@ -1765,6 +1781,26 @@ hw_delay_wait_checks_handler(vector strv - return 0; + return 0; } - + +static int +hw_max_sectors_kb_handler(vector strvec) +{ @@ -148,9 +148,9 @@ Index: multipath-tools-130222/libmultipath/dict.c * multipaths block handlers */ @@ -2316,6 +2352,26 @@ mp_delay_wait_checks_handler(vector strv - return 0; + return 0; } - + +static int +mp_max_sectors_kb_handler(vector strvec) +{ @@ -176,7 +176,7 @@ Index: multipath-tools-130222/libmultipath/dict.c */ @@ -2615,6 +2671,16 @@ snprint_mp_delay_wait_checks(char * buff } - + static int +snprint_mp_max_sectors_kb(char * buff, int len, void * data) +{ @@ -190,10 +190,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_hw_fast_io_fail(char * buff, int len, void * data) { - struct hwentry * hwe = (struct hwentry *)data; + struct hwentry * hwe = (struct hwentry *)data; @@ -2993,6 +3059,16 @@ snprint_detect_prio(char * buff, int len } - + static int +snprint_hw_max_sectors_kb(char * buff, int len, void * data) +{ @@ -207,10 +207,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_def_polling_interval (char * buff, int len, void * data) { - return snprintf(buff, len, "%i", conf->checkint); + return snprintf(buff, len, "%i", conf->checkint); @@ -3461,6 +3537,14 @@ snprint_def_disable_changed_wwids(char * } - + static int +snprint_def_max_sectors_kb(char * buff, int len, void * data) +{ @@ -222,29 +222,29 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_ble_simple (char * buff, int len, void * data) { - struct blentry * ble = (struct blentry *)data; + struct blentry * ble = (struct blentry *)data; @@ -3541,6 +3625,7 @@ init_keywords(void) - install_keyword("new_bindings_in_boot", &def_new_bindings_in_boot_handler, &snprint_def_new_bindings_in_boot); - install_keyword("remove_retries", &def_remove_retries_handler, &snprint_def_remove_retries); - install_keyword("disable_changed_wwids", &def_disable_changed_wwids_handler, &snprint_def_disable_changed_wwids); + install_keyword("new_bindings_in_boot", &def_new_bindings_in_boot_handler, &snprint_def_new_bindings_in_boot); + install_keyword("remove_retries", &def_remove_retries_handler, &snprint_def_remove_retries); + install_keyword("disable_changed_wwids", &def_disable_changed_wwids_handler, &snprint_def_disable_changed_wwids); + install_keyword("max_sectors_kb", &def_max_sectors_kb_handler, &snprint_def_max_sectors_kb); - __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); + __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); @@ -3609,6 +3694,7 @@ init_keywords(void) - install_keyword("delay_watch_checks", &hw_delay_watch_checks_handler, &snprint_hw_delay_watch_checks); - install_keyword("delay_wait_checks", &hw_delay_wait_checks_handler, &snprint_hw_delay_wait_checks); - install_keyword("skip_kpartx", &hw_skip_kpartx_handler, &snprint_hw_skip_kpartx); + install_keyword("delay_watch_checks", &hw_delay_watch_checks_handler, &snprint_hw_delay_watch_checks); + install_keyword("delay_wait_checks", &hw_delay_wait_checks_handler, &snprint_hw_delay_wait_checks); + install_keyword("skip_kpartx", &hw_skip_kpartx_handler, &snprint_hw_skip_kpartx); + install_keyword("max_sectors_kb", &hw_max_sectors_kb_handler, &snprint_hw_max_sectors_kb); - install_sublevel_end(); - - install_keyword_root("multipaths", &multipaths_handler); + install_sublevel_end(); + + install_keyword_root("multipaths", &multipaths_handler); @@ -3637,5 +3723,6 @@ init_keywords(void) - install_keyword("delay_watch_checks", &mp_delay_watch_checks_handler, &snprint_mp_delay_watch_checks); - install_keyword("delay_wait_checks", &mp_delay_wait_checks_handler, &snprint_mp_delay_wait_checks); - install_keyword("skip_kpartx", &mp_skip_kpartx_handler, &snprint_mp_skip_kpartx); + install_keyword("delay_watch_checks", &mp_delay_watch_checks_handler, &snprint_mp_delay_watch_checks); + install_keyword("delay_wait_checks", &mp_delay_wait_checks_handler, &snprint_mp_delay_wait_checks); + install_keyword("skip_kpartx", &mp_skip_kpartx_handler, &snprint_mp_skip_kpartx); + install_keyword("max_sectors_kb", &mp_max_sectors_kb_handler, &snprint_mp_max_sectors_kb); - install_sublevel_end(); + install_sublevel_end(); } Index: multipath-tools-130222/libmultipath/discovery.c =================================================================== @@ -255,7 +255,7 @@ Index: multipath-tools-130222/libmultipath/discovery.c #include #include +#include - + #include "checkers.h" #include "vector.h" @@ -27,6 +28,7 @@ @@ -263,12 +263,12 @@ Index: multipath-tools-130222/libmultipath/discovery.c #include "prio.h" #include "defaults.h" +#include "devmapper.h" - + int store_pathinfo (vector pathvec, vector hwtable, struct udev_device *udevice, @@ -166,6 +168,64 @@ declare_sysfs_get_str(rev); declare_sysfs_get_str(dev); - + int +sysfs_set_max_sectors_kb(struct multipath *mpp, int is_reload) +{ @@ -330,14 +330,14 @@ Index: multipath-tools-130222/libmultipath/discovery.c +int sysfs_get_timeout(struct path *pp, unsigned int *timeout) { - const char *attr = NULL; + const char *attr = NULL; Index: multipath-tools-130222/libmultipath/discovery.h =================================================================== --- multipath-tools-130222.orig/libmultipath/discovery.h +++ multipath-tools-130222/libmultipath/discovery.h @@ -41,6 +41,7 @@ int store_pathinfo (vector pathvec, vect - struct udev_device *udevice, int flag, - struct path **pp_ptr); + struct udev_device *udevice, int flag, + struct path **pp_ptr); int sysfs_set_scsi_tmo (struct multipath *mpp); +int sysfs_set_max_sectors_kb(struct multipath *mpp, int is_reload); int sysfs_get_timeout(struct path *pp, unsigned int *timeout); @@ -348,8 +348,8 @@ Index: multipath-tools-130222/libmultipath/propsel.c --- multipath-tools-130222.orig/libmultipath/propsel.c +++ multipath-tools-130222/libmultipath/propsel.c @@ -880,3 +880,28 @@ select_skip_kpartx (struct multipath * m - condlog(3, "skip_kpartx = DISABLED (internal default)"); - return 0; + condlog(3, "skip_kpartx = DISABLED (internal default)"); + return 0; } + +extern int @@ -390,9 +390,9 @@ Index: multipath-tools-130222/libmultipath/structs.h --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -128,6 +128,12 @@ enum skip_kpartx_states { - SKIP_KPARTX_ON, + SKIP_KPARTX_ON, }; - + + +enum max_sectors_kb_states { + MAX_SECTORS_KB_UNDEF = 0, @@ -400,16 +400,16 @@ Index: multipath-tools-130222/libmultipath/structs.h +}; + enum scsi_protocol { - SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */ - SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */ + SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */ + SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */ @@ -245,6 +251,7 @@ struct multipath { - int delay_wait_checks; - int force_udev_reload; - int skip_kpartx; + int delay_wait_checks; + int force_udev_reload; + int skip_kpartx; + int max_sectors_kb; - unsigned int dev_loss; - uid_t uid; - gid_t gid; + unsigned int dev_loss; + uid_t uid; + gid_t gid; Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.conf.5 @@ -458,17 +458,17 @@ Index: multipath-tools-130222/libmultipath/devmapper.c #include @@ -330,6 +330,7 @@ extern int dm_addmap_create (struct multipath *mpp, char * params) { - int ro; - + int ro; + + sysfs_set_max_sectors_kb(mpp, 0); - for (ro = 0; ro <= 1; ro++) { - int err; - + for (ro = 0; ro <= 1; ro++) { + int err; + @@ -356,6 +357,7 @@ dm_addmap_create (struct multipath *mpp, - + extern int dm_addmap_reload (struct multipath *mpp, char *params) { + sysfs_set_max_sectors_kb(mpp, 1); - if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW, SKIP_KPARTX_OFF)) - return 1; - if (errno != EROFS) + if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW, SKIP_KPARTX_OFF)) + return 1; + if (errno != EROFS) diff --git a/SOURCES/0198-RHBZ-1372032-detect-path-checker.patch b/SOURCES/0198-RHBZ-1372032-detect-path-checker.patch index bdef1f20..48fcfce9 100644 --- a/SOURCES/0198-RHBZ-1372032-detect-path-checker.patch +++ b/SOURCES/0198-RHBZ-1372032-detect-path-checker.patch @@ -1,12 +1,12 @@ --- libmultipath/config.c | 4 ++ libmultipath/config.h | 2 + - libmultipath/defaults.h | 1 + libmultipath/defaults.h | 1 libmultipath/dict.c | 74 +++++++++++++++++++++++++++++++++++++++++++++ - libmultipath/discovery.c | 1 - libmultipath/hwtable.c | 1 + libmultipath/discovery.c | 1 + libmultipath/hwtable.c | 1 libmultipath/propsel.c | 65 +++++++++++++++++++++++++++++++-------- - libmultipath/propsel.h | 1 + libmultipath/propsel.h | 1 libmultipath/structs.h | 7 ++++ multipath/multipath.conf.5 | 9 +++++ 10 files changed, 152 insertions(+), 13 deletions(-) @@ -16,57 +16,57 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -340,6 +340,7 @@ merge_hwe (struct hwentry * dst, struct - merge_num(user_friendly_names); - merge_num(retain_hwhandler); - merge_num(detect_prio); + merge_num(user_friendly_names); + merge_num(retain_hwhandler); + merge_num(detect_prio); + merge_num(detect_checker); - merge_num(deferred_remove); - merge_num(delay_watch_checks); - merge_num(delay_wait_checks); + merge_num(deferred_remove); + merge_num(delay_watch_checks); + merge_num(delay_wait_checks); @@ -402,6 +403,7 @@ overwrite_hwe (struct hwentry * dst, str - overwrite_num(user_friendly_names); - overwrite_num(retain_hwhandler); - overwrite_num(detect_prio); + overwrite_num(user_friendly_names); + overwrite_num(retain_hwhandler); + overwrite_num(detect_prio); + overwrite_num(detect_checker); - overwrite_num(deferred_remove); - overwrite_num(delay_watch_checks); - overwrite_num(delay_wait_checks); + overwrite_num(deferred_remove); + overwrite_num(delay_watch_checks); + overwrite_num(delay_wait_checks); @@ -476,6 +478,7 @@ store_hwe (vector hwtable, struct hwentr - hwe->user_friendly_names = dhwe->user_friendly_names; - hwe->retain_hwhandler = dhwe->retain_hwhandler; - hwe->detect_prio = dhwe->detect_prio; + hwe->user_friendly_names = dhwe->user_friendly_names; + hwe->retain_hwhandler = dhwe->retain_hwhandler; + hwe->detect_prio = dhwe->detect_prio; + hwe->detect_checker = dhwe->detect_checker; - - if (dhwe->bl_product && !(hwe->bl_product = set_param_str(dhwe->bl_product))) - goto out; + + if (dhwe->bl_product && !(hwe->bl_product = set_param_str(dhwe->bl_product))) + goto out; @@ -672,6 +675,7 @@ load_config (char * file, struct udev *u - conf->fast_io_fail = DEFAULT_FAST_IO_FAIL; - conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER; - conf->detect_prio = DEFAULT_DETECT_PRIO; + conf->fast_io_fail = DEFAULT_FAST_IO_FAIL; + conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER; + conf->detect_prio = DEFAULT_DETECT_PRIO; + conf->detect_checker = DEFAULT_DETECT_CHECKER; - conf->deferred_remove = DEFAULT_DEFERRED_REMOVE; - conf->hw_strmatch = 0; - conf->force_sync = 0; + conf->deferred_remove = DEFAULT_DEFERRED_REMOVE; + conf->hw_strmatch = 0; + conf->force_sync = 0; Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -61,6 +61,7 @@ struct hwentry { - int user_friendly_names; - int retain_hwhandler; - int detect_prio; + int user_friendly_names; + int retain_hwhandler; + int detect_prio; + int detect_checker; - int deferred_remove; - int delay_watch_checks; - int delay_wait_checks; + int deferred_remove; + int delay_watch_checks; + int delay_wait_checks; @@ -136,6 +137,7 @@ struct config { - int reassign_maps; - int retain_hwhandler; - int detect_prio; + int reassign_maps; + int retain_hwhandler; + int detect_prio; + int detect_checker; - int force_sync; - int deferred_remove; - int ignore_new_boot_devs; + int force_sync; + int deferred_remove; + int ignore_new_boot_devs; Index: multipath-tools-130222/libmultipath/defaults.h =================================================================== --- multipath-tools-130222.orig/libmultipath/defaults.h @@ -85,7 +85,7 @@ Index: multipath-tools-130222/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -714,6 +714,29 @@ def_detect_prio_handler(vector strvec) } - + static int +def_detect_checker_handler(vector strvec) +{ @@ -112,10 +112,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int def_hw_strmatch_handler(vector strvec) { - char *buff; + char *buff; @@ -1682,6 +1705,33 @@ hw_detect_prio_handler(vector strvec) } - + static int +hw_detect_checker_handler(vector strvec) +{ @@ -146,10 +146,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int hw_deferred_remove_handler(vector strvec) { - struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable); + struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable); @@ -3059,6 +3109,19 @@ snprint_detect_prio(char * buff, int len } - + static int +snprint_detect_checker(char * buff, int len, void * data) +{ @@ -166,10 +166,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_hw_max_sectors_kb(char * buff, int len, void * data) { - struct hwentry * hwe = (struct hwentry *)data; + struct hwentry * hwe = (struct hwentry *)data; @@ -3424,6 +3487,15 @@ snprint_def_detect_prio(char * buff, int } - + static int +snprint_def_detect_checker(char * buff, int len, void * data) +{ @@ -182,55 +182,55 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_def_hw_strmatch(char * buff, int len, void * data) { - if (conf->hw_strmatch) + if (conf->hw_strmatch) @@ -3611,6 +3683,7 @@ init_keywords(void) - install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths); - install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler); - install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio); + install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths); + install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler); + install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio); + install_keyword("detect_path_checker", &def_detect_checker_handler, &snprint_def_detect_checker); - install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch); - install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync); - install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove); + install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch); + install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync); + install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove); @@ -3690,6 +3763,7 @@ init_keywords(void) - install_keyword("user_friendly_names", &hw_names_handler, &snprint_hw_user_friendly_names); - install_keyword("retain_attached_hw_handler", &hw_retain_hwhandler_handler, &snprint_hw_retain_hwhandler_handler); - install_keyword("detect_prio", &hw_detect_prio_handler, &snprint_detect_prio); + install_keyword("user_friendly_names", &hw_names_handler, &snprint_hw_user_friendly_names); + install_keyword("retain_attached_hw_handler", &hw_retain_hwhandler_handler, &snprint_hw_retain_hwhandler_handler); + install_keyword("detect_prio", &hw_detect_prio_handler, &snprint_detect_prio); + install_keyword("detect_path_checker", &hw_detect_checker_handler, &snprint_detect_checker); - install_keyword("deferred_remove", &hw_deferred_remove_handler, &snprint_hw_deferred_remove); - install_keyword("delay_watch_checks", &hw_delay_watch_checks_handler, &snprint_hw_delay_watch_checks); - install_keyword("delay_wait_checks", &hw_delay_wait_checks_handler, &snprint_hw_delay_wait_checks); + install_keyword("deferred_remove", &hw_deferred_remove_handler, &snprint_hw_deferred_remove); + install_keyword("delay_watch_checks", &hw_delay_watch_checks_handler, &snprint_hw_delay_watch_checks); + install_keyword("delay_wait_checks", &hw_delay_wait_checks_handler, &snprint_hw_delay_wait_checks); Index: multipath-tools-130222/libmultipath/discovery.c =================================================================== --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -1107,6 +1107,7 @@ get_state (struct path * pp, int daemon) - return PATH_UNCHECKED; - } - } + return PATH_UNCHECKED; + } + } + select_detect_checker(pp); - select_checker(pp); - if (!checker_selected(c)) { - condlog(3, "%s: No checker selected", pp->dev); + select_checker(pp); + if (!checker_selected(c)) { + condlog(3, "%s: No checker selected", pp->dev); Index: multipath-tools-130222/libmultipath/hwtable.c =================================================================== --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -289,6 +289,7 @@ static struct hwentry default_hw[] = { - .prio_args = NULL, - .retain_hwhandler = RETAIN_HWHANDLER_ON, - .detect_prio = DETECT_PRIO_ON, + .prio_args = NULL, + .retain_hwhandler = RETAIN_HWHANDLER_ON, + .detect_prio = DETECT_PRIO_ON, + .detect_checker = DETECT_CHECKER_ON, - }, - { - .vendor = "EMC", + }, + { + .vendor = "EMC", Index: multipath-tools-130222/libmultipath/propsel.c =================================================================== --- multipath-tools-130222.orig/libmultipath/propsel.c +++ multipath-tools-130222/libmultipath/propsel.c @@ -335,11 +335,43 @@ select_hwhandler (struct multipath * mp) - return 0; + return 0; } - + +int +detect_alua(struct path * pp) +{ @@ -258,8 +258,8 @@ Index: multipath-tools-130222/libmultipath/propsel.c extern int select_checker(struct path *pp) { - struct checker * c = &pp->checker; - + struct checker * c = &pp->checker; + + if (pp->detect_checker == DETECT_CHECKER_ON) { + detect_checker(pp); + if (checker_selected(c)) { @@ -268,9 +268,9 @@ Index: multipath-tools-130222/libmultipath/propsel.c + goto out; + } + } - if (pp->hwe && pp->hwe->checker_name) { - checker_get(c, pp->hwe->checker_name); - condlog(3, "%s: path checker = %s (controller setting)", + if (pp->hwe && pp->hwe->checker_name) { + checker_get(c, pp->hwe->checker_name); + condlog(3, "%s: path checker = %s (controller setting)", @@ -396,19 +428,8 @@ select_getuid (struct path * pp) void detect_prio(struct path * pp) @@ -291,12 +291,12 @@ Index: multipath-tools-130222/libmultipath/propsel.c + if (detect_alua(pp)) + prio_get(&pp->prio, PRIO_ALUA, DEFAULT_PRIO_ARGS); } - + extern int @@ -803,6 +824,24 @@ select_detect_prio (struct path * pp) - return 0; + return 0; } - + +extern int +select_detect_checker (struct path * pp) +{ @@ -335,9 +335,9 @@ Index: multipath-tools-130222/libmultipath/structs.h --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -115,6 +115,12 @@ enum detect_prio_states { - DETECT_PRIO_ON, + DETECT_PRIO_ON, }; - + +enum detect_checker_states { + DETECT_CHECKER_UNDEF, + DETECT_CHECKER_OFF, @@ -345,16 +345,16 @@ Index: multipath-tools-130222/libmultipath/structs.h +}; + enum deferred_remove_states { - DEFERRED_REMOVE_UNDEF, - DEFERRED_REMOVE_OFF, + DEFERRED_REMOVE_UNDEF, + DEFERRED_REMOVE_OFF, @@ -204,6 +210,7 @@ struct path { - int priority; - int pgindex; - int detect_prio; + int priority; + int pgindex; + int detect_prio; + int detect_checker; - int watch_checks; - int wait_checks; - int tpgs; + int watch_checks; + int wait_checks; + int tpgs; Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.conf.5 diff --git a/SOURCES/0199-RHBZ-1279355-3pardata-config.patch b/SOURCES/0199-RHBZ-1279355-3pardata-config.patch index 707bd596..037de3df 100644 --- a/SOURCES/0199-RHBZ-1279355-3pardata-config.patch +++ b/SOURCES/0199-RHBZ-1279355-3pardata-config.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -69,7 +69,7 @@ static struct hwentry default_hw[] = { - .pgpolicy = MULTIBUS, - .pgfailback = FAILBACK_UNDEF, - .rr_weight = RR_WEIGHT_NONE, + .pgpolicy = MULTIBUS, + .pgfailback = FAILBACK_UNDEF, + .rr_weight = RR_WEIGHT_NONE, - .no_path_retry = NO_PATH_RETRY_UNDEF, + .no_path_retry = 12, - .checker_name = DEFAULT_CHECKER, - .prio_name = DEFAULT_PRIO, - .prio_args = NULL, + .checker_name = DEFAULT_CHECKER, + .prio_name = DEFAULT_PRIO, + .prio_args = NULL, diff --git a/SOURCES/0200-RHBZ-1402092-orphan-status.patch b/SOURCES/0200-RHBZ-1402092-orphan-status.patch index 68a47a49..67830ca1 100644 --- a/SOURCES/0200-RHBZ-1402092-orphan-status.patch +++ b/SOURCES/0200-RHBZ-1402092-orphan-status.patch @@ -14,9 +14,9 @@ Index: multipath-tools-130222/libmultipath/print.c + if (!pp || !pp->mpp) + return snprintf(buff, len, "unknown"); + else if (pp->offline) - return snprintf(buff, len, "offline"); - else - return snprintf(buff, len, "running"); + return snprintf(buff, len, "offline"); + else + return snprintf(buff, len, "running"); @@ -395,6 +397,9 @@ snprint_offline (char * buff, size_t len static int snprint_chk_state (char * buff, size_t len, struct path * pp) @@ -24,6 +24,6 @@ Index: multipath-tools-130222/libmultipath/print.c + if (!pp || !pp->mpp) + return snprintf(buff, len, "undef"); + - switch (pp->state) { - case PATH_UP: - return snprintf(buff, len, "ready"); + switch (pp->state) { + case PATH_UP: + return snprintf(buff, len, "ready"); diff --git a/SOURCES/0201-RHBZ-1403552-silence-warning.patch b/SOURCES/0201-RHBZ-1403552-silence-warning.patch index 1dcb7158..c816ea05 100644 --- a/SOURCES/0201-RHBZ-1403552-silence-warning.patch +++ b/SOURCES/0201-RHBZ-1403552-silence-warning.patch @@ -8,20 +8,20 @@ Index: multipath-tools-130222/libmultipath/discovery.c --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -84,10 +84,6 @@ path_discover (vector pathvec, struct co - if (!devname) - return PATHINFO_FAILED; - + if (!devname) + return PATHINFO_FAILED; + - if (filter_devnode(conf->blist_devnode, conf->elist_devnode, - (char *)devname) > 0) - return PATHINFO_SKIPPED; - - pp = find_path_by_dev(pathvec, (char *)devname); - if (!pp) { - return store_pathinfo(pathvec, conf->hwtable, + pp = find_path_by_dev(pathvec, (char *)devname); + if (!pp) { + return store_pathinfo(pathvec, conf->hwtable, @@ -1286,6 +1282,17 @@ pathinfo (struct path *pp, vector hwtabl - if (!pp) - return PATHINFO_FAILED; - + if (!pp) + return PATHINFO_FAILED; + + /* + * For behavior backward-compatibility with multipathd, + * the blacklisting by filter_devnode() is not @@ -33,17 +33,17 @@ Index: multipath-tools-130222/libmultipath/discovery.c + pp->dev) > 0) + return PATHINFO_SKIPPED; + - condlog(3, "%s: mask = 0x%x", pp->dev, mask); - - /* + condlog(3, "%s: mask = 0x%x", pp->dev, mask); + + /* Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -776,6 +776,16 @@ uev_update_path (struct uevent *uev, str - - pp = find_path_by_dev(vecs->pathvec, uev->kernel); - if (!pp) { + + pp = find_path_by_dev(vecs->pathvec, uev->kernel); + if (!pp) { + /* If the path is blacklisted, print a debug/non-default verbosity message. */ + if (uev->udev) { + int flag = DI_SYSFS | DI_WWID; @@ -54,6 +54,6 @@ Index: multipath-tools-130222/multipathd/main.c + } + } + - condlog(0, "%s: spurious uevent, path not found", - uev->kernel); - return 1; + condlog(0, "%s: spurious uevent, path not found", + uev->kernel); + return 1; diff --git a/SOURCES/0202-RHBZ-1362120-skip-prio.patch b/SOURCES/0202-RHBZ-1362120-skip-prio.patch index 02976dce..8a187ad7 100644 --- a/SOURCES/0202-RHBZ-1362120-skip-prio.patch +++ b/SOURCES/0202-RHBZ-1362120-skip-prio.patch @@ -7,12 +7,12 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -1248,7 +1248,8 @@ int update_prio(struct path *pp, int ref - return changed; - } - oldpriority = pp->priority; + return changed; + } + oldpriority = pp->priority; - pathinfo(pp, conf->hwtable, DI_PRIO); + if (pp->state != PATH_DOWN) + pathinfo(pp, conf->hwtable, DI_PRIO); - - if (pp->priority == oldpriority) - return 0; + + if (pp->priority == oldpriority) + return 0; diff --git a/SOURCES/0203-RHBZ-1363718-add-msgs.patch b/SOURCES/0203-RHBZ-1363718-add-msgs.patch index c3ff02d8..9eaadc07 100644 --- a/SOURCES/0203-RHBZ-1363718-add-msgs.patch +++ b/SOURCES/0203-RHBZ-1363718-add-msgs.patch @@ -7,18 +7,18 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -337,6 +337,7 @@ ev_add_map (char * dev, char * alias, st - - if (mpp) { - if (mpp->wait_for_udev > 1) { + + if (mpp) { + if (mpp->wait_for_udev > 1) { + condlog(2, "%s: performing delayed actions", mpp->alias); - if (update_map(mpp, vecs)) - /* setup multipathd removed the map */ - return 1; + if (update_map(mpp, vecs)) + /* setup multipathd removed the map */ + return 1; @@ -535,6 +536,7 @@ ev_add_path (struct path * pp, struct ve - pp->tpgs == TPGS_IMPLICIT)) - mpp->force_udev_reload = 1; - else { + pp->tpgs == TPGS_IMPLICIT)) + mpp->force_udev_reload = 1; + else { + condlog(2, "%s : delaying path addition until %s is fully initialized", pp->dev, mpp->alias); - mpp->wait_for_udev = 2; - orphan_path(pp); - return 0; + mpp->wait_for_udev = 2; + orphan_path(pp); + return 0; diff --git a/SOURCES/0204-RHBZ-1406226-nimble-config.patch b/SOURCES/0204-RHBZ-1406226-nimble-config.patch index c77f7fbe..c3f2e902 100644 --- a/SOURCES/0204-RHBZ-1406226-nimble-config.patch +++ b/SOURCES/0204-RHBZ-1406226-nimble-config.patch @@ -7,9 +7,9 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -1189,6 +1189,19 @@ static struct hwentry default_hw[] = { - .dev_loss = 30, - }, - { + .dev_loss = 30, + }, + { + .vendor = "Nimble", + .product = "Server", + .features = "1 queue_if_no_path", @@ -23,6 +23,6 @@ Index: multipath-tools-130222/libmultipath/hwtable.c + .fast_io_fail = 1, + }, + { - .vendor = "XtremIO", - .product = "XtremApp", - .features = DEFAULT_FEATURES, + .vendor = "XtremIO", + .product = "XtremApp", + .features = DEFAULT_FEATURES, diff --git a/SOURCES/0205-RHBZ-1416569-reset-stats.patch b/SOURCES/0205-RHBZ-1416569-reset-stats.patch index 2948b4b6..b152f884 100644 --- a/SOURCES/0205-RHBZ-1416569-reset-stats.patch +++ b/SOURCES/0205-RHBZ-1416569-reset-stats.patch @@ -11,22 +11,22 @@ Index: multipath-tools-130222/multipathd/cli.c --- multipath-tools-130222.orig/multipathd/cli.c +++ multipath-tools-130222/multipathd/cli.c @@ -482,6 +482,8 @@ cli_init (void) { - add_handler(LIST+BLACKLIST, NULL); - add_handler(LIST+DEVICES, NULL); - add_handler(LIST+WILDCARDS, NULL); + add_handler(LIST+BLACKLIST, NULL); + add_handler(LIST+DEVICES, NULL); + add_handler(LIST+WILDCARDS, NULL); + add_handler(RESET+MAPS+STATS, NULL); + add_handler(RESET+MAP+STATS, NULL); - add_handler(ADD+PATH, NULL); - add_handler(DEL+PATH, NULL); - add_handler(ADD+MAP, NULL); + add_handler(ADD+PATH, NULL); + add_handler(DEL+PATH, NULL); + add_handler(ADD+MAP, NULL); Index: multipath-tools-130222/multipathd/cli_handlers.c =================================================================== --- multipath-tools-130222.orig/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -233,6 +233,17 @@ show_config (char ** r, int * len) - return 0; + return 0; } - + +void +reset_stats(struct multipath * mpp) +{ @@ -43,7 +43,7 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c { @@ -501,6 +512,39 @@ cli_list_daemon (void * v, char ** reply } - + int +cli_reset_maps_stats (void * v, char ** reply, int * len, void * data) +{ @@ -80,7 +80,7 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c +int cli_add_path (void * v, char ** reply, int * len, void * data) { - struct vectors * vecs = (struct vectors *)data; + struct vectors * vecs = (struct vectors *)data; Index: multipath-tools-130222/multipathd/cli_handlers.h =================================================================== --- multipath-tools-130222.orig/multipathd/cli_handlers.h @@ -99,14 +99,14 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -1011,6 +1011,8 @@ uxlsnrloop (void * ap) - set_handler_callback(LIST+BLACKLIST, cli_list_blacklist); - set_handler_callback(LIST+DEVICES, cli_list_devices); - set_handler_callback(LIST+WILDCARDS, cli_list_wildcards); + set_handler_callback(LIST+BLACKLIST, cli_list_blacklist); + set_handler_callback(LIST+DEVICES, cli_list_devices); + set_handler_callback(LIST+WILDCARDS, cli_list_wildcards); + set_handler_callback(RESET+MAPS+STATS, cli_reset_maps_stats); + set_handler_callback(RESET+MAP+STATS, cli_reset_map_stats); - set_handler_callback(ADD+PATH, cli_add_path); - set_handler_callback(DEL+PATH, cli_del_path); - set_handler_callback(ADD+MAP, cli_add_map); + set_handler_callback(ADD+PATH, cli_add_path); + set_handler_callback(DEL+PATH, cli_del_path); + set_handler_callback(ADD+MAP, cli_add_map); Index: multipath-tools-130222/multipathd/multipathd.8 =================================================================== --- multipath-tools-130222.orig/multipathd/multipathd.8 @@ -123,4 +123,4 @@ Index: multipath-tools-130222/multipathd/multipathd.8 +.TP .B add path $path Add a path to the list of monitored paths. $path is as listed in /sys/block (e.g. sda). - .TP + .TP diff --git a/SOURCES/0206-RHBZ-1239173-pt2-no-paths.patch b/SOURCES/0206-RHBZ-1239173-pt2-no-paths.patch index 74316e24..c38be569 100644 --- a/SOURCES/0206-RHBZ-1239173-pt2-no-paths.patch +++ b/SOURCES/0206-RHBZ-1239173-pt2-no-paths.patch @@ -11,12 +11,12 @@ Index: multipath-tools-130222/libmultipath/configure.c @@ -615,7 +615,7 @@ extern int domap (struct multipath * mpp, char * params) { - int r = 0; + int r = 0; - uint16_t udev_flags = ((mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG) | ((mpp->skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0); + uint16_t udev_flags = ((mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG) | ((mpp->skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0) | ((mpp->nr_active)? 0 : MPATH_UDEV_NO_PATHS_FLAG); - - /* - * last chance to quit before touching the devmaps + + /* + * last chance to quit before touching the devmaps Index: multipath-tools-130222/libmultipath/devmapper.h =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.h @@ -24,7 +24,7 @@ Index: multipath-tools-130222/libmultipath/devmapper.h @@ -18,6 +18,12 @@ #define MPATH_UDEV_NO_KPARTX_FLAG 0 #endif - + +#ifdef DM_SUBSYSTEM_UDEV_FLAG2 +#define MPATH_UDEV_NO_PATHS_FLAG DM_SUBSYSTEM_UDEV_FLAG2 +#else @@ -41,7 +41,7 @@ Index: multipath-tools-130222/multipath/11-dm-mpath.rules @@ -2,33 +2,66 @@ ACTION!="add|change", GOTO="mpath_end" ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="mpath_end" ENV{DM_UUID}!="mpath-?*", GOTO="mpath_end" - + +IMPORT{db}="DM_DISABLE_OTHER_RULES_FLAG_OLD" +IMPORT{db}="MPATH_DEVICE_READY" + @@ -85,7 +85,7 @@ Index: multipath-tools-130222/multipath/11-dm-mpath.rules -ENV{DM_NR_VALID_PATHS}!="?*", IMPORT{db}="DM_NR_VALID_PATHS" -ENV{DM_NR_VALID_PATHS}=="0", ENV{DM_NOSCAN}="1" +ENV{MPATH_DEVICE_READY}=="0", ENV{DM_NOSCAN}="1" - + # Also skip all foreign rules if no path is available. # Remember the original value of DM_DISABLE_OTHER_RULES_FLAG # and restore it back once we have at least one path available. @@ -93,16 +93,16 @@ Index: multipath-tools-130222/multipath/11-dm-mpath.rules -ENV{DM_ACTION}=="PATH_FAILED",\ - ENV{DM_NR_VALID_PATHS}=="0",\ +ENV{MPATH_DEVICE_READY}=="0", ENV{.MPATH_DEVICE_READY_OLD}!="0",\ - ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}=="",\ - ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}",\ - ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1" + ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}=="",\ + ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}",\ + ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1" -ENV{DM_ACTION}=="PATH_REINSTATED",\ - ENV{DM_NR_VALID_PATHS}=="1",\ +ENV{MPATH_DEVICE_READY}!="0", ENV{.MPATH_DEVICE_READY_OLD}=="0",\ - ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="$env{DM_DISABLE_OTHER_RULES_FLAG_OLD}",\ - ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="",\ - ENV{DM_ACTIVATION}="1" - + ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="$env{DM_DISABLE_OTHER_RULES_FLAG_OLD}",\ + ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="",\ + ENV{DM_ACTIVATION}="1" + -# DM_SUBSYSTEM_UDEV_FLAG0 is the "RELOAD" flag for multipath subsystem. -# Drop the DM_ACTIVATION flag here as mpath reloads tables if any of its -# paths are lost/recovered. For any stack above the mpath device, this is not @@ -117,5 +117,5 @@ Index: multipath-tools-130222/multipath/11-dm-mpath.rules +ENV{ID_FS_UUID}!="?*", IMPORT{db}="ID_FS_UUID" +ENV{ID_FS_ENC}!="?*", IMPORT{db}="ID_FS_UUID_ENC" +ENV{ID_FS_VERSION}!="?*", IMPORT{db}="ID_FS_VERSION" - + LABEL="mpath_end" diff --git a/SOURCES/0207-UP-add-libmpathcmd.patch b/SOURCES/0207-UP-add-libmpathcmd.patch index ed8a472f..ee19d65c 100644 --- a/SOURCES/0207-UP-add-libmpathcmd.patch +++ b/SOURCES/0207-UP-add-libmpathcmd.patch @@ -11,21 +11,21 @@ this library internally as well. Signed-off-by: Benjamin Marzinski --- - Makefile | 1 - Makefile.inc | 2 + Makefile | 1 + Makefile.inc | 2 libmpathcmd/Makefile | 32 +++++++ libmpathcmd/mpath_cmd.c | 178 +++++++++++++++++++++++++++++++++++++++ libmpathcmd/mpath_cmd.h | 125 +++++++++++++++++++++++++++ libmpathpersist/Makefile | 5 - libmpathpersist/mpath_updatepr.c | 30 +++--- - libmultipath/Makefile | 4 - libmultipath/config.c | 1 + libmultipath/Makefile | 4 + libmultipath/config.c | 1 libmultipath/configure.c | 10 +- libmultipath/uxsock.c | 88 +++---------------- libmultipath/uxsock.h | 6 - - mpathpersist/Makefile | 2 + mpathpersist/Makefile | 2 multipath/Makefile | 5 - - multipathd/Makefile | 4 + multipathd/Makefile | 4 multipathd/uxclnt.c | 13 +- multipathd/uxlsnr.c | 9 - 17 files changed, 401 insertions(+), 114 deletions(-) @@ -39,12 +39,12 @@ Index: multipath-tools-130222/Makefile +++ multipath-tools-130222/Makefile @@ -20,6 +20,7 @@ export KRNLSRC export KRNLOBJ - + BUILDDIRS = \ + libmpathcmd \ - libmultipath \ - libmultipath/prioritizers \ - libmultipath/checkers \ + libmultipath \ + libmultipath/prioritizers \ + libmultipath/checkers \ Index: multipath-tools-130222/Makefile.inc =================================================================== --- multipath-tools-130222.orig/Makefile.inc @@ -55,7 +55,7 @@ Index: multipath-tools-130222/Makefile.inc mpathpersistdir = $(TOPDIR)/libmpathpersist +includedir = $(prefix)/usr/include +mpathcmddir = $(TOPDIR)/libmpathcmd - + GZIP = /bin/gzip -9 -c INSTALL_PROGRAM = install Index: multipath-tools-130222/libmpathcmd/Makefile @@ -414,16 +414,16 @@ Index: multipath-tools-130222/libmpathpersist/Makefile +++ multipath-tools-130222/libmpathpersist/Makefile @@ -10,8 +10,9 @@ DEVLIB = libmpathpersist.so LIBS = $(DEVLIB).$(SONAME) - - + + -CFLAGS += -fPIC -I$(multipathdir) -I$(mpathpersistdir) -LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath +CFLAGS += -fPIC -I$(multipathdir) -I$(mpathpersistdir) -I$(mpathcmddir) +LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath \ + -L$(mpathcmddir) -lmpathcmd - - OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o - + + OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o + Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c =================================================================== --- multipath-tools-130222.orig/libmpathpersist/mpath_updatepr.c @@ -437,25 +437,25 @@ Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c #include "memory.h" -#include "../libmultipath/uxsock.h" -#include "../libmultipath/defaults.h" - + unsigned long mem_allocated; /* Total memory used in Bytes */ - + @@ -23,10 +23,9 @@ int update_prflag(char * arg1, char * ar - int fd; - char str[64]; - char *reply; + int fd; + char str[64]; + char *reply; - size_t len; - int ret = 0; - + int ret = 0; + - fd = ux_socket_connect(DEFAULT_SOCKET); + fd = mpath_connect(); - if (fd == -1) { - condlog (0, "ux socket connect error"); - return 1 ; + if (fd == -1) { + condlog (0, "ux socket connect error"); + return 1 ; @@ -34,18 +33,23 @@ int update_prflag(char * arg1, char * ar - - snprintf(str,sizeof(str),"map %s %s", arg1, arg2); - condlog (2, "%s: pr flag message=%s", arg1, str); + + snprintf(str,sizeof(str),"map %s %s", arg1, arg2); + condlog (2, "%s: pr flag message=%s", arg1, str); - send_packet(fd, str, strlen(str) + 1); - recv_packet(fd, &reply, &len); - @@ -467,7 +467,7 @@ Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c + ret = recv_packet(fd, &reply); + if (ret < 0) { + condlog(2, "%s: message=%s recv error=%d", arg1, str, errno); - ret = -2; + ret = -2; - else{ - ret = atoi(reply); + } else { @@ -479,11 +479,11 @@ Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c + else{ + ret = atoi(reply); + } - } - - free(reply); + } + + free(reply); + mpath_disconnect(fd); - return ret; + return ret; } Index: multipath-tools-130222/libmultipath/Makefile =================================================================== @@ -497,7 +497,7 @@ Index: multipath-tools-130222/libmultipath/Makefile -CFLAGS += -fPIC +LIBDEPS = -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd +CFLAGS += -fPIC -I$(mpathcmddir) - + OBJS = memory.o parser.o vector.o devmapper.o \ hwtable.o blacklist.o util.o dmparser.o config.o \ Index: multipath-tools-130222/libmultipath/config.c @@ -509,7 +509,7 @@ Index: multipath-tools-130222/libmultipath/config.c #include "devmapper.h" #include "version.h" +#include "mpath_cmd.h" - + static int hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2) Index: multipath-tools-130222/libmultipath/configure.c @@ -521,38 +521,38 @@ Index: multipath-tools-130222/libmultipath/configure.c #include #include +#include - + #include "checkers.h" #include "vector.h" @@ -752,16 +753,15 @@ check_daemon(void) { - int fd; - char *reply; + int fd; + char *reply; - size_t len; - int ret = 0; - + int ret = 0; + - fd = ux_socket_connect(DEFAULT_SOCKET); + fd = mpath_connect(); - if (fd == -1) - return 0; - + if (fd == -1) + return 0; + - if (send_packet(fd, "show daemon", 12) != 0) + if (send_packet(fd, "show daemon") != 0) - goto out; + goto out; - if (recv_packet(fd, &reply, &len) != 0) + if (recv_packet(fd, &reply) != 0) - goto out; - - if (strstr(reply, "shutdown")) + goto out; + + if (strstr(reply, "shutdown")) @@ -772,7 +772,7 @@ check_daemon(void) out_free: - FREE(reply); + FREE(reply); out: - close(fd); + mpath_disconnect(fd); - return ret; + return ret; } - + Index: multipath-tools-130222/libmultipath/uxsock.c =================================================================== --- multipath-tools-130222.orig/libmultipath/uxsock.c @@ -562,7 +562,7 @@ Index: multipath-tools-130222/libmultipath/uxsock.c #include #include +#include - + #include "memory.h" #include "uxsock.h" - @@ -598,7 +598,7 @@ Index: multipath-tools-130222/libmultipath/uxsock.c * return a file descriptor open on the socket @@ -102,32 +75,9 @@ size_t write_all(int fd, const void *buf } - + /* - * keep reading until its all read - */ @@ -628,20 +628,20 @@ Index: multipath-tools-130222/libmultipath/uxsock.c -int send_packet(int fd, const char *buf, size_t len) +int send_packet(int fd, const char *buf) { - int ret = 0; - sigset_t set, old; + int ret = 0; + sigset_t set, old; @@ -137,10 +87,7 @@ int send_packet(int fd, const char *buf, - sigaddset(&set, SIGPIPE); - pthread_sigmask(SIG_BLOCK, &set, &old); - + sigaddset(&set, SIGPIPE); + pthread_sigmask(SIG_BLOCK, &set, &old); + - if (write_all(fd, &len, sizeof(len)) != sizeof(len)) - ret = -1; - if (!ret && write_all(fd, buf, len) != len) - ret = -1; + ret = mpath_send_cmd(fd, buf); - - /* And unblock it again */ - pthread_sigmask(SIG_SETMASK, &old, NULL); + + /* And unblock it again */ + pthread_sigmask(SIG_SETMASK, &old, NULL); @@ -151,25 +98,24 @@ int send_packet(int fd, const char *buf, /* * receive a packet in length prefix format @@ -668,19 +668,19 @@ Index: multipath-tools-130222/libmultipath/uxsock.c + if (len <= 0) + return len; + (*buf) = MALLOC(len); - if (!*buf) + if (!*buf) - return -1; - if (read_all(fd, *buf, *len) != *len) { + return -ENOMEM; + err = mpath_recv_reply_data(fd, *buf, len, timeout); + if (err) { - FREE(*buf); - (*buf) = NULL; + FREE(*buf); + (*buf) = NULL; - *len = 0; - return -1; + return err; - } - return 0; + } + return 0; } Index: multipath-tools-130222/libmultipath/uxsock.h =================================================================== @@ -701,30 +701,30 @@ Index: multipath-tools-130222/mpathpersist/Makefile --- multipath-tools-130222.orig/mpathpersist/Makefile +++ multipath-tools-130222/mpathpersist/Makefile @@ -5,7 +5,7 @@ include ../Makefile.inc - OBJS = main.o - - CFLAGS += -I$(multipathdir) -I$(mpathpersistdir) + OBJS = main.o + + CFLAGS += -I$(multipathdir) -I$(mpathpersistdir) -LDFLAGS += -lpthread -ldevmapper -L$(mpathpersistdir) -lmpathpersist -L$(multipathdir) -lmultipath -ludev +LDFLAGS += -lpthread -ldevmapper -L$(mpathpersistdir) -lmpathpersist -L$(multipathdir) -L$(mpathcmddir) -lmpathcmd -lmultipath -ludev - + EXEC = mpathpersist - + Index: multipath-tools-130222/multipath/Makefile =================================================================== --- multipath-tools-130222.orig/multipath/Makefile +++ multipath-tools-130222/multipath/Makefile @@ -6,8 +6,9 @@ include ../Makefile.inc - + OBJS = main.o - + -CFLAGS += -fPIC -I$(multipathdir) -LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath -ludev +CFLAGS += -I$(multipathdir) -I$(mpathcmddir) +LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath -ludev \ + -L$(mpathcmddir) -lmpathcmd - + EXEC = multipath - + Index: multipath-tools-130222/multipathd/Makefile =================================================================== --- multipath-tools-130222.orig/multipathd/Makefile @@ -736,10 +736,10 @@ Index: multipath-tools-130222/multipathd/Makefile -CFLAGS += -fPIE -DPIE -I$(multipathdir) -I$(mpathpersistdir) +CFLAGS += -fPIE -DPIE -I$(multipathdir) -I$(mpathpersistdir) -I$(mpathcmddir) LDFLAGS += -lpthread -ldevmapper -lreadline -ludev -ldl \ - -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \ + -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \ - -Wl,-z,now -pie + -L$(mpathcmddir) -lmpathcmd -Wl,-z,now -pie - + # # debuging stuff Index: multipath-tools-130222/multipathd/uxclnt.c @@ -749,55 +749,55 @@ Index: multipath-tools-130222/multipathd/uxclnt.c @@ -17,6 +17,7 @@ #include #include - + +#include #include #include #include @@ -49,7 +50,6 @@ static void process(int fd) - rl_readline_name = "multipathd"; - rl_completion_entry_function = key_generator; - while ((line = readline("multipathd> "))) { + rl_readline_name = "multipathd"; + rl_completion_entry_function = key_generator; + while ((line = readline("multipathd> "))) { - size_t len; - size_t llen = strlen(line); - - if (!llen) { + size_t llen = strlen(line); + + if (!llen) { @@ -61,8 +61,8 @@ static void process(int fd) - if (!strncmp(line, "quit", 4) && llen == 4) - break; - + if (!strncmp(line, "quit", 4) && llen == 4) + break; + - if (send_packet(fd, line, llen + 1) != 0) break; - if (recv_packet(fd, &reply, &len) != 0) break; + if (send_packet(fd, line) != 0) break; + if (recv_packet(fd, &reply) != 0) break; - - print_reply(reply); - + + print_reply(reply); + @@ -77,13 +77,12 @@ static void process(int fd) static void process_req(int fd, char * inbuf) { - char *reply; + char *reply; - size_t len; - + - if (send_packet(fd, inbuf, strlen(inbuf) + 1) != 0) { + if (send_packet(fd, inbuf) != 0) { - printf("cannot send packet\n"); - return; - } + printf("cannot send packet\n"); + return; + } - if (recv_packet(fd, &reply, &len) != 0) + if (recv_packet(fd, &reply) != 0) - printf("error receiving packet\n"); - else { - printf("%s", reply); + printf("error receiving packet\n"); + else { + printf("%s", reply); @@ -98,7 +97,7 @@ int uxclnt(char * inbuf) { - int fd; - + int fd; + - fd = ux_socket_connect(DEFAULT_SOCKET); + fd = mpath_connect(); - if (fd == -1) { - perror("ux_socket_connect"); - exit(1); + if (fd == -1) { + perror("ux_socket_connect"); + exit(1); Index: multipath-tools-130222/multipathd/uxlsnr.c =================================================================== --- multipath-tools-130222.orig/multipathd/uxlsnr.c @@ -807,34 +807,34 @@ Index: multipath-tools-130222/multipathd/uxlsnr.c #include #include +#include - + #include "main.h" #include "cli.h" @@ -108,7 +109,6 @@ void * uxsock_listen(int (*uxsock_trigge - void * trigger_data) + void * trigger_data) { - int ux_sock; + int ux_sock; - size_t len; - int rlen; - char *inbuf; - char *reply; + int rlen; + char *inbuf; + char *reply; @@ -171,16 +171,15 @@ void * uxsock_listen(int (*uxsock_trigge - struct client *next = c->next; - - if (polls[i].revents & POLLIN) { + struct client *next = c->next; + + if (polls[i].revents & POLLIN) { - if (recv_packet(c->fd, &inbuf, &len) != 0) { + if (recv_packet(c->fd, &inbuf) != 0) { - dead_client(c); - } else { + dead_client(c); + } else { - inbuf[len - 1] = 0; - condlog(4, "Got request [%s]", inbuf); - uxsock_trigger(inbuf, &reply, &rlen, - trigger_data); - if (reply) { + condlog(4, "Got request [%s]", inbuf); + uxsock_trigger(inbuf, &reply, &rlen, + trigger_data); + if (reply) { - if (send_packet(c->fd, reply, - rlen) != 0) { + if (send_packet(c->fd, + reply) != 0) { - dead_client(c); - } - condlog(4, "Reply [%d bytes]", + dead_client(c); + } + condlog(4, "Reply [%d bytes]", diff --git a/SOURCES/0208-UPBZ-1430097-multipathd-IPC-changes.patch b/SOURCES/0208-UPBZ-1430097-multipathd-IPC-changes.patch index 818b4aad..cddf6414 100644 --- a/SOURCES/0208-UPBZ-1430097-multipathd-IPC-changes.patch +++ b/SOURCES/0208-UPBZ-1430097-multipathd-IPC-changes.patch @@ -17,56 +17,56 @@ Index: multipath-tools-130222/libmultipath/print.c --- multipath-tools-130222.orig/libmultipath/print.c +++ multipath-tools-130222/libmultipath/print.c @@ -771,8 +771,6 @@ snprint_multipath_header (char * line, i - int fwd; - struct multipath_data * data; - + int fwd; + struct multipath_data * data; + - memset(line, 0, len); - - do { - if (!TAIL) - break; + do { + if (!TAIL) + break; @@ -806,8 +804,6 @@ snprint_multipath (char * line, int len, - struct multipath_data * data; - char buff[MAX_FIELD_LEN] = {}; - + struct multipath_data * data; + char buff[MAX_FIELD_LEN] = {}; + - memset(line, 0, len); - - do { - if (!TAIL) - break; + do { + if (!TAIL) + break; @@ -842,8 +838,6 @@ snprint_path_header (char * line, int le - int fwd; - struct path_data * data; - + int fwd; + struct path_data * data; + - memset(line, 0, len); - - do { - if (!TAIL) - break; + do { + if (!TAIL) + break; @@ -877,8 +871,6 @@ snprint_path (char * line, int len, char - struct path_data * data; - char buff[MAX_FIELD_LEN]; - + struct path_data * data; + char buff[MAX_FIELD_LEN]; + - memset(line, 0, len); - - do { - if (!TAIL) - break; + do { + if (!TAIL) + break; @@ -914,8 +906,6 @@ snprint_pathgroup (char * line, int len, - struct pathgroup_data * data; - char buff[MAX_FIELD_LEN]; - + struct pathgroup_data * data; + char buff[MAX_FIELD_LEN]; + - memset(line, 0, len); - - do { - if (!TAIL) - break; + do { + if (!TAIL) + break; Index: multipath-tools-130222/libmultipath/uxsock.c =================================================================== --- multipath-tools-130222.orig/libmultipath/uxsock.c +++ multipath-tools-130222/libmultipath/uxsock.c @@ -20,6 +20,15 @@ - + #include "memory.h" #include "uxsock.h" + @@ -82,9 +82,9 @@ Index: multipath-tools-130222/libmultipath/uxsock.c * create a unix domain socket and start listening on it * return a file descriptor open on the socket @@ -95,27 +104,38 @@ int send_packet(int fd, const char *buf) - return ret; + return ret; } - + -/* - * receive a packet in length prefix format - */ @@ -95,24 +95,24 @@ Index: multipath-tools-130222/libmultipath/uxsock.c - ssize_t len; + int err = 0; + ssize_t len = 0; - unsigned int timeout = DEFAULT_REPLY_TIMEOUT; - - *buf = NULL; - len = mpath_recv_reply_len(fd, timeout); - if (len <= 0) - return len; + unsigned int timeout = DEFAULT_REPLY_TIMEOUT; + + *buf = NULL; + len = mpath_recv_reply_len(fd, timeout); + if (len <= 0) + return len; + if ((limit > 0) && (len > limit)) + return -EINVAL; - (*buf) = MALLOC(len); - if (!*buf) - return -ENOMEM; - err = mpath_recv_reply_data(fd, *buf, len, timeout); + (*buf) = MALLOC(len); + if (!*buf) + return -ENOMEM; + err = mpath_recv_reply_data(fd, *buf, len, timeout); - if (err) { + if (err != 0) { - FREE(*buf); - (*buf) = NULL; + FREE(*buf); + (*buf) = NULL; - return err; - } + } - return 0; + return err; +} @@ -157,21 +157,21 @@ Index: multipath-tools-130222/multipathd/main.c +#include #include #include "prioritizers/alua_rtpg.h" - + @@ -859,7 +860,8 @@ map_discovery (struct vectors * vecs) } - + int -uxsock_trigger (char * str, char ** reply, int * len, void * trigger_data) +uxsock_trigger (char * str, char ** reply, int * len, bool is_root, + void * trigger_data) { - struct vectors * vecs; - int r; + struct vectors * vecs; + int r; @@ -872,6 +874,15 @@ uxsock_trigger (char * str, char ** repl - lock(vecs->lock); - pthread_testcancel(); - + lock(vecs->lock); + pthread_testcancel(); + + if ((str != NULL) && (is_root == false) && + (strncmp(str, "list", strlen("list")) != 0) && + (strncmp(str, "show", strlen("show")) != 0)) { @@ -181,17 +181,17 @@ Index: multipath-tools-130222/multipathd/main.c + goto out; + } + - r = parse_cmd(str, reply, len, vecs); - - if (r > 0) { + r = parse_cmd(str, reply, len, vecs); + + if (r > 0) { @@ -885,7 +896,7 @@ uxsock_trigger (char * str, char ** repl - r = 0; - } - /* else if (r < 0) leave *reply alone */ + r = 0; + } + /* else if (r < 0) leave *reply alone */ - +out: - lock_cleanup_pop(vecs->lock); - return r; + lock_cleanup_pop(vecs->lock); + return r; } Index: multipath-tools-130222/multipathd/uxlsnr.c =================================================================== @@ -208,7 +208,7 @@ Index: multipath-tools-130222/multipathd/uxlsnr.c @@ -48,6 +49,23 @@ struct pollfd *polls; volatile sig_atomic_t reconfig_sig = 0; volatile sig_atomic_t log_reset_sig = 0; - + +static bool _socket_client_is_root(int fd); + +static bool _socket_client_is_root(int fd) @@ -237,28 +237,28 @@ Index: multipath-tools-130222/multipathd/uxlsnr.c - void * trigger_data) +void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, void * trigger_data) { - int ux_sock; - int rlen; + int ux_sock; + int rlen; @@ -171,12 +188,16 @@ void * uxsock_listen(int (*uxsock_trigge - struct client *next = c->next; - - if (polls[i].revents & POLLIN) { + struct client *next = c->next; + + if (polls[i].revents & POLLIN) { - if (recv_packet(c->fd, &inbuf) != 0) { + if (recv_packet_from_client(c->fd, + &inbuf) != 0) { - dead_client(c); + dead_client(c); + } else if (!inbuf) { + condlog(4, "recv_packet_from_client " + "get null request"); + continue; - } else { - condlog(4, "Got request [%s]", inbuf); + } else { + condlog(4, "Got request [%s]", inbuf); - uxsock_trigger(inbuf, &reply, &rlen, - trigger_data); + uxsock_trigger(inbuf, &reply, &rlen, _socket_client_is_root(c->fd), trigger_data); - if (reply) { - if (send_packet(c->fd, - reply) != 0) { + if (reply) { + if (send_packet(c->fd, + reply) != 0) { Index: multipath-tools-130222/multipathd/uxlsnr.h =================================================================== --- multipath-tools-130222.orig/multipathd/uxlsnr.h @@ -266,7 +266,7 @@ Index: multipath-tools-130222/multipathd/uxlsnr.h @@ -1,9 +1,11 @@ #ifndef _UXLSNR_H #define _UXLSNR_H - + -void * uxsock_listen(int (*uxsock_trigger) - (char *, char **, int *, void *), - void * trigger_data); @@ -275,6 +275,6 @@ Index: multipath-tools-130222/multipathd/uxlsnr.h +typedef int (uxsock_trigger_fn)(char *, char **, int *, bool, void *); + +void *uxsock_listen(uxsock_trigger_fn uxsock_trigger, void * trigger_data); - + extern volatile sig_atomic_t reconfig_sig; extern volatile sig_atomic_t log_reset_sig; diff --git a/SOURCES/0209-UPBZ-1430097-multipath-C-API.patch b/SOURCES/0209-UPBZ-1430097-multipath-C-API.patch index e658bfc4..08a6f1d6 100644 --- a/SOURCES/0209-UPBZ-1430097-multipath-C-API.patch +++ b/SOURCES/0209-UPBZ-1430097-multipath-C-API.patch @@ -48,25 +48,25 @@ Changes since V4: Signed-off-by: Gris Ge --- - .gitignore | 8 - Makefile | 1 - Makefile.inc | 6 - libdmmp/DEV_NOTES | 41 + .gitignore | 8 + Makefile | 1 + Makefile.inc | 6 + libdmmp/DEV_NOTES | 41 libdmmp/Makefile | 84 + - libdmmp/docs/doc-preclean.pl | 28 + libdmmp/docs/doc-preclean.pl | 28 libdmmp/docs/kernel-doc | 3156 ++++++++++++++++++++++++++++++++++++++ libdmmp/docs/libdmmp.h.3 | 113 + - libdmmp/docs/split-man.pl | 40 + libdmmp/docs/split-man.pl | 40 libdmmp/libdmmp.c | 285 +++ - libdmmp/libdmmp.pc.in | 9 + libdmmp/libdmmp.pc.in | 9 libdmmp/libdmmp/libdmmp.h | 653 +++++++ libdmmp/libdmmp_misc.c | 87 + libdmmp/libdmmp_mp.c | 159 + libdmmp/libdmmp_path.c | 115 + libdmmp/libdmmp_pg.c | 208 ++ libdmmp/libdmmp_private.h | 208 ++ - libdmmp/test/Makefile | 30 - libdmmp/test/libdmmp_speed_test.c | 49 + libdmmp/test/Makefile | 30 + libdmmp/test/libdmmp_speed_test.c | 49 libdmmp/test/libdmmp_test.c | 147 + 20 files changed, 5426 insertions(+), 1 deletion(-) create mode 100644 libdmmp/DEV_NOTES @@ -108,13 +108,13 @@ Index: multipath-tools-130222/Makefile --- multipath-tools-130222.orig/Makefile +++ multipath-tools-130222/Makefile @@ -25,6 +25,7 @@ BUILDDIRS = \ - libmultipath/prioritizers \ - libmultipath/checkers \ - libmpathpersist \ + libmultipath/prioritizers \ + libmultipath/checkers \ + libmpathpersist \ + libdmmp \ - multipath \ - multipathd \ - mpathpersist \ + multipath \ + multipathd \ + mpathpersist \ Index: multipath-tools-130222/Makefile.inc =================================================================== --- multipath-tools-130222.orig/Makefile.inc @@ -125,13 +125,13 @@ Index: multipath-tools-130222/Makefile.inc mpathcmddir = $(TOPDIR)/libmpathcmd +libdmmpdir = $(TOPDIR)/libdmmp +pkgconfdir = $(prefix)/usr/$(LIB)/pkgconfig - + -GZIP = /bin/gzip -9 -c +GZIP = /bin/gzip -9 -c +RM = rm -f +LN = ln -sf INSTALL_PROGRAM = install - + ifndef RPM_OPT_FLAGS Index: multipath-tools-130222/libdmmp/DEV_NOTES =================================================================== @@ -722,7 +722,7 @@ Index: multipath-tools-130222/libdmmp/docs/kernel-doc +my $doc_com_body = '\s*\* ?'; +my $doc_decl = $doc_com . '(\w+)'; +# @params and a strictly limited set of supported section names -+my $doc_sect = $doc_com . ++my $doc_sect = $doc_com . + '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:(.*)'; +my $doc_content = $doc_com_body . '(.*)'; +my $doc_block = $doc_com . 'DOC:\s*(.*)?'; diff --git a/SOURCES/0210-RH-fix-uninstall.patch b/SOURCES/0210-RH-fix-uninstall.patch index 7483a26a..7083dedb 100644 --- a/SOURCES/0210-RH-fix-uninstall.patch +++ b/SOURCES/0210-RH-fix-uninstall.patch @@ -7,19 +7,19 @@ Index: multipath-tools-130222/libmpathpersist/Makefile --- multipath-tools-130222.orig/libmpathpersist/Makefile +++ multipath-tools-130222/libmpathpersist/Makefile @@ -33,12 +33,14 @@ install: $(LIBS) - ln -sf $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB) - install -m 644 mpath_persistent_reserve_in.3.gz $(DESTDIR)$(man3dir) - install -m 644 mpath_persistent_reserve_out.3.gz $(DESTDIR)$(man3dir) + ln -sf $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB) + install -m 644 mpath_persistent_reserve_in.3.gz $(DESTDIR)$(man3dir) + install -m 644 mpath_persistent_reserve_out.3.gz $(DESTDIR)$(man3dir) + $(INSTALL_PROGRAM) -m 644 mpath_persist.h $(DESTDIR)$(includedir) - + uninstall: - rm -f $(DESTDIR)$(syslibdir)/$(LIBS) - rm -f $(DESTDIR)$(syslibdir)/$(DEVLIB) -- rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_in.3.gz -- rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_out.3.gz + rm -f $(DESTDIR)$(syslibdir)/$(LIBS) + rm -f $(DESTDIR)$(syslibdir)/$(DEVLIB) +- rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_in.3.gz +- rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_out.3.gz + rm $(DESTDIR)$(man3dir)/mpath_persistent_reserve_in.3.gz + rm $(DESTDIR)$(man3dir)/mpath_persistent_reserve_out.3.gz + rm -f $(DESTDIR)$(includedir)/mpath_persist.h - + clean: - rm -f core *.a *.o + rm -f core *.a *.o diff --git a/SOURCES/0211-RH-strlen-fix.patch b/SOURCES/0211-RH-strlen-fix.patch index eb7336fe..2c12fe87 100644 --- a/SOURCES/0211-RH-strlen-fix.patch +++ b/SOURCES/0211-RH-strlen-fix.patch @@ -7,29 +7,29 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -878,7 +878,8 @@ uxsock_trigger (char * str, char ** repl - (strncmp(str, "list", strlen("list")) != 0) && - (strncmp(str, "show", strlen("show")) != 0)) { - *reply = STRDUP("permission deny: need to be root"); + (strncmp(str, "list", strlen("list")) != 0) && + (strncmp(str, "show", strlen("show")) != 0)) { + *reply = STRDUP("permission deny: need to be root"); - *len = strlen(*reply) + 1; + if (*reply) + *len = strlen(*reply) + 1; - r = 1; - goto out; - } + r = 1; + goto out; + } @@ -887,12 +888,14 @@ uxsock_trigger (char * str, char ** repl - - if (r > 0) { - *reply = STRDUP("fail\n"); + + if (r > 0) { + *reply = STRDUP("fail\n"); - *len = strlen(*reply) + 1; + if (*reply) + *len = strlen(*reply) + 1; - r = 1; - } - else if (!r && *len == 0) { - *reply = STRDUP("ok\n"); + r = 1; + } + else if (!r && *len == 0) { + *reply = STRDUP("ok\n"); - *len = strlen(*reply) + 1; + if (*reply) + *len = strlen(*reply) + 1; - r = 0; - } - /* else if (r < 0) leave *reply alone */ + r = 0; + } + /* else if (r < 0) leave *reply alone */ diff --git a/SOURCES/0212-RHBZ-1431562-for-read-only.patch b/SOURCES/0212-RHBZ-1431562-for-read-only.patch index b9d315d2..b398100f 100644 --- a/SOURCES/0212-RHBZ-1431562-for-read-only.patch +++ b/SOURCES/0212-RHBZ-1431562-for-read-only.patch @@ -11,7 +11,7 @@ Index: multipath-tools-130222/libmultipath/devmapper.c @@ -358,10 +358,12 @@ dm_addmap_create (struct multipath *mpp, extern int dm_addmap_reload (struct multipath *mpp, char *params) { - sysfs_set_max_sectors_kb(mpp, 1); + sysfs_set_max_sectors_kb(mpp, 1); - if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW, SKIP_KPARTX_OFF)) - return 1; - if (errno != EROFS) @@ -22,35 +22,35 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + if (errno != EROFS) + return 0; + } - return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RO, SKIP_KPARTX_OFF); + return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RO, SKIP_KPARTX_OFF); } - + Index: multipath-tools-130222/libmultipath/structs.h =================================================================== --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -259,6 +259,7 @@ struct multipath { - int force_udev_reload; - int skip_kpartx; - int max_sectors_kb; + int force_udev_reload; + int skip_kpartx; + int max_sectors_kb; + int force_readonly; - unsigned int dev_loss; - uid_t uid; - gid_t gid; + unsigned int dev_loss; + uid_t uid; + gid_t gid; Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -831,9 +831,10 @@ uev_update_path (struct uevent *uev, str - pp->mpp->wait_for_udev = 2; - return 0; - } + pp->mpp->wait_for_udev = 2; + return 0; + } - + if (ro == 1) + pp->mpp->force_readonly = 1; - retval = reload_map(vecs, pp->mpp, 0); + retval = reload_map(vecs, pp->mpp, 0); - + pp->mpp->force_readonly = 0; - condlog(2, "%s: map %s reloaded (retval %d)", - uev->kernel, pp->mpp->alias, retval); - } + condlog(2, "%s: map %s reloaded (retval %d)", + uev->kernel, pp->mpp->alias, retval); + } diff --git a/SOURCES/0213-RHBZ-1430908-merge-dell-configs.patch b/SOURCES/0213-RHBZ-1430908-merge-dell-configs.patch index 4961180b..920547eb 100644 --- a/SOURCES/0213-RHBZ-1430908-merge-dell-configs.patch +++ b/SOURCES/0213-RHBZ-1430908-merge-dell-configs.patch @@ -8,20 +8,20 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -731,91 +731,16 @@ static struct hwentry default_hw[] = { - .prio_args = NULL, - }, - { + .prio_args = NULL, + }, + { - /* DELL MD3000 */ + /* DELL MD3xxxx family */ - .vendor = "DELL", + .vendor = "DELL", - .product = "MD3000", + .product = "^MD3", - .bl_product = "Universal Xport", - .features = "2 pg_init_retries 50", - .hwhandler = "1 rdac", - .pgpolicy = GROUP_BY_PRIO, - .pgfailback = -FAILBACK_IMMEDIATE, - .rr_weight = RR_WEIGHT_NONE, + .bl_product = "Universal Xport", + .features = "2 pg_init_retries 50", + .hwhandler = "1 rdac", + .pgpolicy = GROUP_BY_PRIO, + .pgfailback = -FAILBACK_IMMEDIATE, + .rr_weight = RR_WEIGHT_NONE, - .no_path_retry = 15, - .checker_name = RDAC, - .prio_name = PRIO_RDAC, @@ -99,9 +99,9 @@ Index: multipath-tools-130222/libmultipath/hwtable.c - .rr_weight = RR_WEIGHT_NONE, - .no_path_retry = 15, + .no_path_retry = 30, - .checker_name = RDAC, - .prio_name = PRIO_RDAC, - .prio_args = NULL, + .checker_name = RDAC, + .prio_name = PRIO_RDAC, + .prio_args = NULL, Index: multipath-tools-130222/multipath.conf.defaults =================================================================== --- multipath-tools-130222.orig/multipath.conf.defaults diff --git a/SOURCES/0214-RHBZ-1392115-set-paths-not-ready.patch b/SOURCES/0214-RHBZ-1392115-set-paths-not-ready.patch index 0b0bad04..a37bc24d 100644 --- a/SOURCES/0214-RHBZ-1392115-set-paths-not-ready.patch +++ b/SOURCES/0214-RHBZ-1392115-set-paths-not-ready.patch @@ -7,7 +7,7 @@ Index: multipath-tools-130222/multipath/multipath.rules --- multipath-tools-130222.orig/multipath/multipath.rules +++ multipath-tools-130222/multipath/multipath.rules @@ -4,8 +4,14 @@ SUBSYSTEM!="block", GOTO="end_mpath" - + IMPORT{cmdline}="nompath" ENV{nompath}=="?*", GOTO="end_mpath" -ENV{DEVTYPE}=="partition", IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH", \ @@ -25,9 +25,9 @@ Index: multipath-tools-130222/multipath/multipath.rules TEST!="/etc/multipath.conf", GOTO="check_kpartx" @@ -33,6 +39,7 @@ ENV{DM_MULTIPATH_DEVICE_PATH}="" ENV{DM_MULTIPATH_WIPE_PARTS}="" - + LABEL="update_timestamp" +ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{SYSTEMD_READY}="0" ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DM_MULTIPATH_WIPE_PARTS}!="1", \ - ENV{DM_MULTIPATH_WIPE_PARTS}="1", \ - RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}" + ENV{DM_MULTIPATH_WIPE_PARTS}="1", \ + RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}" diff --git a/SOURCES/0215-RHBZ-1444194-fix-check-partitions.patch b/SOURCES/0215-RHBZ-1444194-fix-check-partitions.patch index b35fcfde..10d511e4 100644 --- a/SOURCES/0215-RHBZ-1444194-fix-check-partitions.patch +++ b/SOURCES/0215-RHBZ-1444194-fix-check-partitions.patch @@ -14,8 +14,8 @@ Index: multipath-tools-130222/libmultipath/devmapper.c - - if (dm_get_prefixed_uuid(name, uuidtmp)) + if (dm_get_prefixed_uuid(name, uuid)) - return 1; - + return 1; + - if (!strncmp(uuidtmp, UUID_PREFIX, UUID_PREFIX_LEN)) - strcpy(uuid, uuidtmp + UUID_PREFIX_LEN); - else @@ -24,9 +24,9 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + if (!strncmp(uuid, UUID_PREFIX, UUID_PREFIX_LEN)) + memmove(uuid, uuid + UUID_PREFIX_LEN, + strlen(uuid + UUID_PREFIX_LEN) + 1); - return 0; + return 0; } - + -/* - * returns: - * 0 : if both uuids end with same suffix which starts with UUID_PREFIX @@ -41,23 +41,23 @@ Index: multipath-tools-130222/libmultipath/devmapper.c - char uuid1[WWID_SIZE], uuid2[WWID_SIZE]; + char *p; + char part_uuid[WWID_SIZE], map_uuid[WWID_SIZE]; - + - if (dm_get_prefixed_uuid(mapname1, uuid1)) - return 1; + if (dm_get_prefixed_uuid(part_name, part_uuid)) + return 0; - + - if (dm_get_prefixed_uuid(mapname2, uuid2)) - return 1; + if (dm_get_prefixed_uuid(map_name, map_uuid)) + return 0; - + - p1 = strstr(uuid1, UUID_PREFIX); - p2 = strstr(uuid2, UUID_PREFIX); - if (p1 && p2 && !strcmp(p1, p2)) + if (strncmp(part_uuid, "part", 4) != 0) - return 0; - + return 0; + - return 1; + p = strstr(part_uuid, UUID_PREFIX); + if (p && !strcmp(p, map_uuid)) @@ -65,37 +65,37 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + + return 0; } - + extern int @@ -1143,6 +1136,7 @@ do_foreach_partmaps (const char * mapnam - unsigned long long size; - char dev_t[32]; - int r = 1; + unsigned long long size; + char dev_t[32]; + int r = 1; + char *p; - - if (!(dmt = dm_task_create(DM_DEVICE_LIST))) - return 1; + + if (!(dmt = dm_task_create(DM_DEVICE_LIST))) + return 1; @@ -1171,10 +1165,10 @@ do_foreach_partmaps (const char * mapnam - (dm_type(names->name, TGT_PART) > 0) && - - /* + (dm_type(names->name, TGT_PART) > 0) && + + /* - * and both uuid end with same suffix starting - * at UUID_PREFIX + * and the uuid of the target is a partition of the + * uuid of the multipath device - */ + */ - (!dm_compare_uuid(names->name, mapname)) && + is_mpath_part(names->name, mapname) && - - /* - * and we can fetch the map table from the kernel + + /* + * and we can fetch the map table from the kernel @@ -1184,7 +1178,8 @@ do_foreach_partmaps (const char * mapnam - /* - * and the table maps over the multipath map - */ + /* + * and the table maps over the multipath map + */ - strstr(params, dev_t) + (p = strstr(params, dev_t)) && + !isdigit(*(p + strlen(dev_t))) - ) { - if (partmap_func(names->name, data) != 0) - goto out; + ) { + if (partmap_func(names->name, data) != 0) + goto out; diff --git a/SOURCES/0216-RHBZ-1448562-fix-reserve.patch b/SOURCES/0216-RHBZ-1448562-fix-reserve.patch index d4850f99..b68376bc 100644 --- a/SOURCES/0216-RHBZ-1448562-fix-reserve.patch +++ b/SOURCES/0216-RHBZ-1448562-fix-reserve.patch @@ -8,24 +8,24 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c --- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c +++ multipath-tools-130222/libmpathpersist/mpath_persist.c @@ -440,7 +440,7 @@ int mpath_prout_reg(struct multipath *mp - thread[i].param.rq_type = rq_type; - thread[i].param.paramp = paramp; - thread[i].param.noisy = noisy; + thread[i].param.rq_type = rq_type; + thread[i].param.paramp = paramp; + thread[i].param.noisy = noisy; - thread[i].param.status = -1; + thread[i].param.status = MPATH_PR_SKIP; - - condlog (3, "THRED ID [%d] INFO]", i); - condlog (3, "rq_servact=%d ", thread[i].param.rq_servact); + + condlog (3, "THRED ID [%d] INFO]", i); + condlog (3, "rq_servact=%d ", thread[i].param.rq_servact); @@ -476,14 +476,17 @@ int mpath_prout_reg(struct multipath *mp - rc = pthread_create(&thread[count].id, &attr, mpath_prout_pthread_fn, (void *)(&thread[count].param)); - if (rc){ - condlog (0, "%s: failed to create thread %d", mpp->wwid, rc); + rc = pthread_create(&thread[count].id, &attr, mpath_prout_pthread_fn, (void *)(&thread[count].param)); + if (rc){ + condlog (0, "%s: failed to create thread %d", mpp->wwid, rc); + thread[count].param.status = MPATH_PR_THREAD_ERROR; - } - count = count +1; - } - } - for( i=0; i < active_pathcount ; i++){ + } + count = count +1; + } + } + for( i=0; i < active_pathcount ; i++){ - rc = pthread_join(thread[i].id, NULL); - if (rc){ - condlog (0, "%s: Thread[%d] failed to join thread %d", mpp->wwid, i, rc); @@ -34,31 +34,31 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c + if (rc){ + condlog (0, "%s: Thread[%d] failed to join thread %d", mpp->wwid, i, rc); + } - } - if (!rollback && (thread[i].param.status == MPATH_PR_RESERV_CONFLICT)){ - rollback = 1; + } + if (!rollback && (thread[i].param.status == MPATH_PR_RESERV_CONFLICT)){ + rollback = 1; @@ -502,23 +505,27 @@ 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++){ + 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++){ - if((thread[i].param.status == MPATH_PR_SUCCESS) && - ((pp->state == PATH_UP) || (pp->state == PATH_GHOST))){ + 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); - thread[i].param.status = MPATH_PR_SUCCESS; - rc = pthread_create(&thread[i].id, &attr, mpath_prout_pthread_fn, + memcpy(&thread[i].param.paramp->key, &thread[i].param.paramp->sa_key, 8); + memset(&thread[i].param.paramp->sa_key, 0, 8); + thread[i].param.status = MPATH_PR_SUCCESS; + rc = pthread_create(&thread[i].id, &attr, mpath_prout_pthread_fn, - (void *)(&thread[count].param)); + (void *)(&thread[i].param)); - if (rc){ - condlog (0, "%s: failed to create thread for rollback. %d", mpp->wwid, rc); + if (rc){ + condlog (0, "%s: failed to create thread for rollback. %d", mpp->wwid, rc); + thread[i].param.status = MPATH_PR_THREAD_ERROR; - } + } - } + } else + thread[i].param.status = MPATH_PR_SKIP; - } - for(i=0; i < active_pathcount ; i++){ + } + for(i=0; i < active_pathcount ; i++){ - rc = pthread_join(thread[i].id, NULL); - if (rc){ - condlog (3, "%s: failed to join thread while rolling back %d", @@ -70,23 +70,23 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c + condlog (3, "%s: failed to join thread while rolling back %d", + mpp->wwid, i); + } - } - } - } + } + } + } @@ -649,16 +656,20 @@ int mpath_prout_rel(struct multipath *mp - condlog (3, "%s: sending pr out command to %s", mpp->wwid, pp->dev); - rc = pthread_create (&thread[count].id, &attr, mpath_prout_pthread_fn, - (void *) (&thread[count].param)); + condlog (3, "%s: sending pr out command to %s", mpp->wwid, pp->dev); + rc = pthread_create (&thread[count].id, &attr, mpath_prout_pthread_fn, + (void *) (&thread[count].param)); - if (rc) + if (rc) { - condlog (0, "%s: failed to create thread. %d", mpp->wwid, rc); + condlog (0, "%s: failed to create thread. %d", mpp->wwid, rc); + thread[count].param.status = MPATH_PR_THREAD_ERROR; + } - count = count + 1; - } - } - pthread_attr_destroy (&attr); - for (i = 0; i < active_pathcount; i++){ + count = count + 1; + } + } + pthread_attr_destroy (&attr); + for (i = 0; i < active_pathcount; i++){ - rc = pthread_join (thread[i].id, NULL); - if (rc){ - condlog (1, "%s: failed to join thread. %d", mpp->wwid, rc); @@ -95,21 +95,21 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c + if (rc){ + condlog (1, "%s: failed to join thread. %d", mpp->wwid, rc); + } - } - } - + } + } + Index: multipath-tools-130222/libmpathpersist/mpath_persist.h =================================================================== --- multipath-tools-130222.orig/libmpathpersist/mpath_persist.h +++ multipath-tools-130222/libmpathpersist/mpath_persist.h @@ -43,6 +43,7 @@ extern "C" { - - + + /* PR RETURN_STATUS */ +#define MPATH_PR_SKIP -1 /* skipping this path */ #define MPATH_PR_SUCCESS 0 #define MPATH_PR_SYNTAX_ERROR 1 /* syntax error or invalid parameter */ - /* status for check condition */ + /* status for check condition */ @@ -59,7 +60,8 @@ extern "C" { #define MPATH_PR_RESERV_CONFLICT 11 /* Reservation conflict on the device */ #define MPATH_PR_FILE_ERROR 12 /* file (device node) problems(e.g. not found)*/ @@ -117,6 +117,6 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.h -#define MPATH_PR_OTHER 14 /*other error/warning has occurred(transport +#define MPATH_PR_THREAD_ERROR 14 /* pthreads error (e.g. unable to create new thread) */ +#define MPATH_PR_OTHER 15 /*other error/warning has occurred(transport - or driver error) */ - + or driver error) */ + /* PR MASK */ diff --git a/SOURCES/0217-RHBZ-1448576-3PAR-config.patch b/SOURCES/0217-RHBZ-1448576-3PAR-config.patch index 976a93b3..a1c982fb 100644 --- a/SOURCES/0217-RHBZ-1448576-3PAR-config.patch +++ b/SOURCES/0217-RHBZ-1448576-3PAR-config.patch @@ -7,26 +7,26 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -65,14 +65,17 @@ static struct hwentry default_hw[] = { - .vendor = "3PARdata", - .product = "VV", - .features = DEFAULT_FEATURES, + .vendor = "3PARdata", + .product = "VV", + .features = DEFAULT_FEATURES, - .hwhandler = DEFAULT_HWHANDLER, - .pgpolicy = MULTIBUS, - .pgfailback = FAILBACK_UNDEF, + .hwhandler = "1 alua", + .pgpolicy = GROUP_BY_PRIO, + .pgfailback = -FAILBACK_IMMEDIATE, - .rr_weight = RR_WEIGHT_NONE, + .rr_weight = RR_WEIGHT_NONE, - .no_path_retry = 12, - .checker_name = DEFAULT_CHECKER, - .prio_name = DEFAULT_PRIO, + .no_path_retry = 18, + .checker_name = TUR, + .prio_name = PRIO_ALUA, - .prio_args = NULL, + .prio_args = NULL, + .selector = "service-time 0", + .fast_io_fail = 10, + .dev_loss = MAX_DEV_LOSS_TMO, - }, - { - .vendor = "DEC", + }, + { + .vendor = "DEC", diff --git a/SOURCES/0218-RHBZ-1459370-add-feature-fix.patch b/SOURCES/0218-RHBZ-1459370-add-feature-fix.patch index 851de127..e40abc81 100644 --- a/SOURCES/0218-RHBZ-1459370-add-feature-fix.patch +++ b/SOURCES/0218-RHBZ-1459370-add-feature-fix.patch @@ -7,9 +7,9 @@ Index: multipath-tools-130222/libmultipath/structs.c --- multipath-tools-130222.orig/libmultipath/structs.c +++ multipath-tools-130222/libmultipath/structs.c @@ -511,6 +511,16 @@ add_feature (char **f, char *n) - if (!n || *n == '0') - return 0; - + if (!n || *n == '0') + return 0; + + /* default feature is null */ + if (!*f) + { @@ -20,6 +20,6 @@ Index: multipath-tools-130222/libmultipath/structs.c + return 0; + } + - /* Check if feature is already present */ - if (strstr(*f, n)) - return 0; + /* Check if feature is already present */ + if (strstr(*f, n)) + return 0; diff --git a/SOURCES/0219-RHBZ-1448970-fix-resize.patch b/SOURCES/0219-RHBZ-1448970-fix-resize.patch index 4cfcd22a..b7531196 100644 --- a/SOURCES/0219-RHBZ-1448970-fix-resize.patch +++ b/SOURCES/0219-RHBZ-1448970-fix-resize.patch @@ -11,35 +11,35 @@ Index: multipath-tools-130222/libmultipath/configure.c @@ -616,7 +616,6 @@ extern int domap (struct multipath * mpp, char * params) { - int r = 0; + int r = 0; - uint16_t udev_flags = ((mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG) | ((mpp->skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0) | ((mpp->nr_active)? 0 : MPATH_UDEV_NO_PATHS_FLAG); - - /* - * last chance to quit before touching the devmaps + + /* + * last chance to quit before touching the devmaps @@ -660,17 +659,11 @@ domap (struct multipath * mpp, char * pa - break; - - case ACT_RELOAD: + break; + + case ACT_RELOAD: - r = dm_addmap_reload(mpp, params); - if (r) - r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, - udev_flags); + r = dm_addmap_reload(mpp, params, 0); - break; - - case ACT_RESIZE: + break; + + case ACT_RESIZE: - r = dm_addmap_reload(mpp, params); - if (r) - r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1, - udev_flags); + r = dm_addmap_reload(mpp, params, 1); - break; - - case ACT_RENAME: + break; + + case ACT_RENAME: @@ -679,11 +672,8 @@ domap (struct multipath * mpp, char * pa - - case ACT_RENAME2: - r = dm_rename(mpp->alias_old, mpp->alias, mpp->skip_kpartx); + + case ACT_RENAME2: + r = dm_rename(mpp->alias_old, mpp->alias, mpp->skip_kpartx); - if (r) { - r = dm_addmap_reload(mpp, params); - if (r) @@ -47,16 +47,16 @@ Index: multipath-tools-130222/libmultipath/configure.c - } + if (r) + r = dm_addmap_reload(mpp, params, 0); - break; - - default: + break; + + default: Index: multipath-tools-130222/libmultipath/devmapper.c =================================================================== --- multipath-tools-130222.orig/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -356,15 +356,33 @@ dm_addmap_create (struct multipath *mpp, #define ADDMAP_RO 1 - + extern int -dm_addmap_reload (struct multipath *mpp, char *params) { +dm_addmap_reload (struct multipath *mpp, char *params, int flush) { @@ -67,7 +67,7 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + MPATH_UDEV_NO_KPARTX_FLAG : 0) | + ((mpp->nr_active)? 0 : MPATH_UDEV_NO_PATHS_FLAG); + - sysfs_set_max_sectors_kb(mpp, 1); + sysfs_set_max_sectors_kb(mpp, 1); - if (!mpp->force_readonly) { - if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW, SKIP_KPARTX_OFF)) - return 1; @@ -77,10 +77,10 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + ADDMAP_RW, SKIP_KPARTX_OFF); + if (!r) { + if (!mpp->force_readonly && errno != EROFS) - return 0; + return 0; + r = dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, + ADDMAP_RO, SKIP_KPARTX_OFF); - } + } - return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RO, SKIP_KPARTX_OFF); + if (r) + r = dm_simplecmd(DM_DEVICE_RESUME, mpp->alias, !flush, @@ -92,12 +92,12 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + udev_flags, 0); + return 0; } - + extern int @@ -613,6 +631,31 @@ dm_is_mpath(const char * name) out: - dm_task_destroy(dmt); - return r; + dm_task_destroy(dmt); + return r; +} + +int @@ -124,7 +124,7 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + dm_task_destroy(dmt); + return r; } - + static int Index: multipath-tools-130222/libmultipath/devmapper.h =================================================================== diff --git a/SOURCES/0220-RHBZ-1448223-fix-kpartx.patch b/SOURCES/0220-RHBZ-1448223-fix-kpartx.patch index b1fde639..3061a2fd 100644 --- a/SOURCES/0220-RHBZ-1448223-fix-kpartx.patch +++ b/SOURCES/0220-RHBZ-1448223-fix-kpartx.patch @@ -8,50 +8,51 @@ Index: multipath-tools-130222/kpartx/kpartx.c +++ multipath-tools-130222/kpartx/kpartx.c @@ -114,10 +114,13 @@ set_delimiter (char * device, char * del { - char * p = device; - + char * p = device; + - while (*(p++) != 0x0) + if (*p == 0x0) + return; + + while (*(++p) != 0x0) - continue; - + continue; + - if (isdigit(*(p - 2))) + if (isdigit(*(p - 1))) - *delimiter = 'p'; + *delimiter = 'p'; } - + @@ -136,15 +139,17 @@ strip_slash (char * device) static int find_devname_offset (char * device) { - char *p, *q = NULL; + char *p, *q; - + - p = device; + q = p = device; - + - while (*p++) + while (*p) { - if (*p == '/') + if (*p == '/') - q = p; + q = p + 1; + p++; + } - + - return (int)(q - device) + 1; + return (int)(q - device); } - + static char * @@ -343,6 +348,10 @@ main(int argc, char **argv){ - } - device = loopdev; - } + } + device = loopdev; + } + else if (!S_ISBLK(buf.st_mode)) { + fprintf(stderr, "invalid device: %s\n", device); + exit(1); + } - - off = find_devname_offset(device); + + off = find_devname_offset(device); + diff --git a/SOURCES/0221-RH-harden-files.patch b/SOURCES/0221-RH-harden-files.patch index e0431ace..46099d0e 100644 --- a/SOURCES/0221-RH-harden-files.patch +++ b/SOURCES/0221-RH-harden-files.patch @@ -12,9 +12,9 @@ Index: multipath-tools-130222/Makefile.inc --- multipath-tools-130222.orig/Makefile.inc +++ multipath-tools-130222/Makefile.inc @@ -48,7 +48,7 @@ ifndef RPM_OPT_FLAGS - RPM_OPT_FLAGS = -O2 -g -pipe -Wformat-security -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 + RPM_OPT_FLAGS = -O2 -g -pipe -Wformat-security -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 endif - + -LDFLAGS += -Wl,-z,relro +LDFLAGS += -Wl,-z,relro -Wl,-z,now OPTFLAGS = $(RPM_OPT_FLAGS) -Wunused -Wstrict-prototypes @@ -27,16 +27,16 @@ Index: multipath-tools-130222/kpartx/Makefile @@ -4,7 +4,7 @@ # include ../Makefile.inc - + -CFLAGS += -fPIC -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +CFLAGS += -fPIE -DPIE -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 - + LIBDM_API_COOKIE = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_set_cookie' /usr/include/libdevmapper.h) - + @@ -12,7 +12,7 @@ ifneq ($(strip $(LIBDM_API_COOKIE)),0) - CFLAGS += -DLIBDM_API_COOKIE + CFLAGS += -DLIBDM_API_COOKIE endif - + -LDFLAGS = -ldevmapper +LDFLAGS += -ldevmapper -pie OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \ @@ -47,45 +47,45 @@ Index: multipath-tools-130222/libmpathpersist/Makefile --- multipath-tools-130222.orig/libmpathpersist/Makefile +++ multipath-tools-130222/libmpathpersist/Makefile @@ -21,7 +21,7 @@ all: $(LIBS) - - $(LIBS): - $(CC) -Wall -c $(CFLAGS) *.c + + $(LIBS): + $(CC) -Wall -c $(CFLAGS) *.c - $(CC) -shared $(LIBDEPS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) + $(CC) $(LDFLAGS) -shared $(LIBDEPS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) - ln -s $(LIBS) $(DEVLIB) - $(GZIP) mpath_persistent_reserve_in.3 > mpath_persistent_reserve_in.3.gz - $(GZIP) mpath_persistent_reserve_out.3 > mpath_persistent_reserve_out.3.gz + ln -s $(LIBS) $(DEVLIB) + $(GZIP) mpath_persistent_reserve_in.3 > mpath_persistent_reserve_in.3.gz + $(GZIP) mpath_persistent_reserve_out.3 > mpath_persistent_reserve_out.3.gz Index: multipath-tools-130222/mpathpersist/Makefile =================================================================== --- multipath-tools-130222.orig/mpathpersist/Makefile +++ multipath-tools-130222/mpathpersist/Makefile @@ -4,8 +4,8 @@ include ../Makefile.inc - - OBJS = main.o - --CFLAGS += -I$(multipathdir) -I$(mpathpersistdir) + + OBJS = main.o + +-CFLAGS += -I$(multipathdir) -I$(mpathpersistdir) -LDFLAGS += -lpthread -ldevmapper -L$(mpathpersistdir) -lmpathpersist -L$(multipathdir) -L$(mpathcmddir) -lmpathcmd -lmultipath -ludev +CFLAGS += -fPIE -DPIE -I$(multipathdir) -I$(mpathpersistdir) +LDFLAGS += -lpthread -ldevmapper -L$(mpathpersistdir) -lmpathpersist -L$(multipathdir) -L$(mpathcmddir) -lmpathcmd -lmultipath -ludev -pie - + EXEC = mpathpersist - + Index: multipath-tools-130222/multipath/Makefile =================================================================== --- multipath-tools-130222.orig/multipath/Makefile +++ multipath-tools-130222/multipath/Makefile @@ -6,9 +6,9 @@ include ../Makefile.inc - + OBJS = main.o - + -CFLAGS += -I$(multipathdir) -I$(mpathcmddir) +CFLAGS += -fPIE -DPIE -I$(multipathdir) -I$(mpathcmddir) LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath -ludev \ - -L$(mpathcmddir) -lmpathcmd + -L$(mpathcmddir) -lmpathcmd -pie - + EXEC = multipath - + Index: multipath-tools-130222/multipathd/Makefile =================================================================== --- multipath-tools-130222.orig/multipathd/Makefile @@ -93,9 +93,9 @@ Index: multipath-tools-130222/multipathd/Makefile @@ -8,7 +8,7 @@ include ../Makefile.inc CFLAGS += -fPIE -DPIE -I$(multipathdir) -I$(mpathpersistdir) -I$(mpathcmddir) LDFLAGS += -lpthread -ldevmapper -lreadline -ludev -ldl \ - -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \ + -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \ - -L$(mpathcmddir) -lmpathcmd -Wl,-z,now -pie + -L$(mpathcmddir) -lmpathcmd -pie - + # # debuging stuff diff --git a/SOURCES/0222-RHBZ-1457288-fix-show-maps-json.patch b/SOURCES/0222-RHBZ-1457288-fix-show-maps-json.patch index fb5571e1..90f37b8f 100644 --- a/SOURCES/0222-RHBZ-1457288-fix-show-maps-json.patch +++ b/SOURCES/0222-RHBZ-1457288-fix-show-maps-json.patch @@ -7,17 +7,17 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c --- multipath-tools-130222.orig/multipathd/cli_handlers.c +++ multipath-tools-130222/multipathd/cli_handlers.c @@ -133,10 +133,12 @@ show_maps_json (char ** r, int * len, st - struct multipath * mpp; - char * c; - char * reply; + struct multipath * mpp; + char * c; + char * reply; - unsigned int maxlen = INITIAL_REPLY_LEN * - PRINT_JSON_MULTIPLIER * VECTOR_SIZE(vecs->mpvec); + unsigned int maxlen = INITIAL_REPLY_LEN; - int again = 1; - + int again = 1; + + if (VECTOR_SIZE(vecs->mpvec) > 0) + maxlen *= PRINT_JSON_MULTIPLIER * VECTOR_SIZE(vecs->mpvec); + - vector_foreach_slot(vecs->mpvec, mpp, i) { - if (update_multipath(vecs, mpp->alias, 0)) { - return 1; + vector_foreach_slot(vecs->mpvec, mpp, i) { + if (update_multipath(vecs, mpp->alias, 0)) { + return 1; diff --git a/SOURCES/0223-RHBZ-1452210-unpriv-sgio.patch b/SOURCES/0223-RHBZ-1452210-unpriv-sgio.patch index 69e0b731..7a5b4b1c 100644 --- a/SOURCES/0223-RHBZ-1452210-unpriv-sgio.patch +++ b/SOURCES/0223-RHBZ-1452210-unpriv-sgio.patch @@ -1,13 +1,13 @@ --- libmultipath/config.c | 3 + libmultipath/config.h | 3 + - libmultipath/configure.c | 2 - libmultipath/defaults.h | 1 + libmultipath/configure.c | 2 + libmultipath/defaults.h | 1 libmultipath/dict.c | 113 +++++++++++++++++++++++++++++++++++++++++++++ libmultipath/discovery.c | 44 +++++++++++++++++ - libmultipath/discovery.h | 1 + libmultipath/discovery.h | 1 libmultipath/propsel.c | 26 ++++++++++ - libmultipath/propsel.h | 1 + libmultipath/propsel.h | 1 libmultipath/structs.h | 8 ++- multipath/multipath.conf.5 | 9 +++ 11 files changed, 210 insertions(+), 1 deletion(-) @@ -17,77 +17,77 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -347,6 +347,7 @@ merge_hwe (struct hwentry * dst, struct - merge_num(delay_wait_checks); - merge_num(skip_kpartx); - merge_num(max_sectors_kb); + merge_num(delay_wait_checks); + merge_num(skip_kpartx); + merge_num(max_sectors_kb); + merge_num(unpriv_sgio); - - /* - * Make sure features is consistent with + + /* + * Make sure features is consistent with @@ -410,6 +411,7 @@ overwrite_hwe (struct hwentry * dst, str - overwrite_num(delay_wait_checks); - overwrite_num(skip_kpartx); - overwrite_num(max_sectors_kb); + overwrite_num(delay_wait_checks); + overwrite_num(skip_kpartx); + overwrite_num(max_sectors_kb); + overwrite_num(unpriv_sgio); - - /* - * Make sure features is consistent with + + /* + * Make sure features is consistent with @@ -690,6 +692,7 @@ load_config (char * file, struct udev *u - conf->remove_retries = 0; - conf->disable_changed_wwids = 0; - conf->max_sectors_kb = DEFAULT_MAX_SECTORS_KB; + conf->remove_retries = 0; + conf->disable_changed_wwids = 0; + conf->max_sectors_kb = DEFAULT_MAX_SECTORS_KB; + conf->unpriv_sgio = DEFAULT_UNPRIV_SGIO; - - /* - * preload default hwtable + + /* + * preload default hwtable Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -67,6 +67,7 @@ struct hwentry { - int delay_wait_checks; - int skip_kpartx; - int max_sectors_kb; + int delay_wait_checks; + int skip_kpartx; + int max_sectors_kb; + int unpriv_sgio; - char * bl_product; + char * bl_product; }; - + @@ -95,6 +96,7 @@ struct mpentry { - int delay_wait_checks; - int skip_kpartx; - int max_sectors_kb; + int delay_wait_checks; + int skip_kpartx; + int max_sectors_kb; + int unpriv_sgio; - uid_t uid; - gid_t gid; - mode_t mode; + uid_t uid; + gid_t gid; + mode_t mode; @@ -153,6 +155,7 @@ struct config { - int remove_retries; - int disable_changed_wwids; - int max_sectors_kb; + int remove_retries; + int disable_changed_wwids; + int max_sectors_kb; + int unpriv_sgio; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/libmultipath/configure.c =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -297,6 +297,7 @@ setup_map (struct multipath * mpp, char - select_delay_wait_checks(mpp); - select_skip_kpartx(mpp); - select_max_sectors_kb(mpp); + select_delay_wait_checks(mpp); + select_skip_kpartx(mpp); + select_max_sectors_kb(mpp); + select_unpriv_sgio(mpp); - - sysfs_set_scsi_tmo(mpp); - /* + + sysfs_set_scsi_tmo(mpp); + /* @@ -711,6 +712,7 @@ domap (struct multipath * mpp, char * pa - } - } - dm_setgeometry(mpp); + } + } + dm_setgeometry(mpp); + sysfs_set_unpriv_sgio(mpp); - return DOMAP_OK; - } - return DOMAP_FAIL; + return DOMAP_OK; + } + return DOMAP_FAIL; Index: multipath-tools-130222/libmultipath/defaults.h =================================================================== --- multipath-tools-130222.orig/libmultipath/defaults.h @@ -97,7 +97,7 @@ Index: multipath-tools-130222/libmultipath/defaults.h #define DEFAULT_SKIP_KPARTX SKIP_KPARTX_OFF #define DEFAULT_MAX_SECTORS_KB MAX_SECTORS_KB_UNDEF +#define DEFAULT_UNPRIV_SGIO UNPRIV_SGIO_OFF - + #define DEFAULT_CHECKINT 5 #define MAX_CHECKINT(a) (a << 2) Index: multipath-tools-130222/libmultipath/dict.c @@ -105,9 +105,9 @@ Index: multipath-tools-130222/libmultipath/dict.c --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -1015,6 +1015,28 @@ def_max_sectors_kb_handler(vector strvec - return 0; + return 0; } - + +static int +def_unpriv_sgio_handler(vector strvec) +{ @@ -134,9 +134,9 @@ Index: multipath-tools-130222/libmultipath/dict.c * blacklist block handlers */ @@ -1851,6 +1873,33 @@ hw_max_sectors_kb_handler(vector strvec) - return 0; + return 0; } - + +static int +hw_unpriv_sgio_handler(vector strvec) +{ @@ -168,9 +168,9 @@ Index: multipath-tools-130222/libmultipath/dict.c * multipaths block handlers */ @@ -2422,6 +2471,32 @@ mp_max_sectors_kb_handler(vector strvec) - return 0; + return 0; } - + +static int +mp_unpriv_sgio_handler(vector strvec) +{ @@ -202,7 +202,7 @@ Index: multipath-tools-130222/libmultipath/dict.c */ @@ -2731,6 +2806,19 @@ snprint_mp_max_sectors_kb(char * buff, i } - + static int +snprint_mp_unpriv_sgio (char * buff, int len, void * data) +{ @@ -219,10 +219,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_hw_fast_io_fail(char * buff, int len, void * data) { - struct hwentry * hwe = (struct hwentry *)data; + struct hwentry * hwe = (struct hwentry *)data; @@ -3132,6 +3220,19 @@ snprint_hw_max_sectors_kb(char * buff, i } - + static int +snprint_hw_unpriv_sgio(char * buff, int len, void * data) +{ @@ -239,10 +239,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_def_polling_interval (char * buff, int len, void * data) { - return snprintf(buff, len, "%i", conf->checkint); + return snprintf(buff, len, "%i", conf->checkint); @@ -3617,6 +3718,15 @@ snprint_def_max_sectors_kb(char * buff, } - + static int +snprint_def_unpriv_sgio(char * buff, int len, void * data) +{ @@ -255,37 +255,37 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_ble_simple (char * buff, int len, void * data) { - struct blentry * ble = (struct blentry *)data; + struct blentry * ble = (struct blentry *)data; @@ -3699,6 +3809,7 @@ init_keywords(void) - install_keyword("remove_retries", &def_remove_retries_handler, &snprint_def_remove_retries); - install_keyword("disable_changed_wwids", &def_disable_changed_wwids_handler, &snprint_def_disable_changed_wwids); - install_keyword("max_sectors_kb", &def_max_sectors_kb_handler, &snprint_def_max_sectors_kb); + install_keyword("remove_retries", &def_remove_retries_handler, &snprint_def_remove_retries); + install_keyword("disable_changed_wwids", &def_disable_changed_wwids_handler, &snprint_def_disable_changed_wwids); + 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); - __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); + __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); @@ -3769,6 +3880,7 @@ init_keywords(void) - install_keyword("delay_wait_checks", &hw_delay_wait_checks_handler, &snprint_hw_delay_wait_checks); - install_keyword("skip_kpartx", &hw_skip_kpartx_handler, &snprint_hw_skip_kpartx); - install_keyword("max_sectors_kb", &hw_max_sectors_kb_handler, &snprint_hw_max_sectors_kb); + install_keyword("delay_wait_checks", &hw_delay_wait_checks_handler, &snprint_hw_delay_wait_checks); + install_keyword("skip_kpartx", &hw_skip_kpartx_handler, &snprint_hw_skip_kpartx); + 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_sublevel_end(); - - install_keyword_root("multipaths", &multipaths_handler); + install_sublevel_end(); + + install_keyword_root("multipaths", &multipaths_handler); @@ -3798,5 +3910,6 @@ init_keywords(void) - install_keyword("delay_wait_checks", &mp_delay_wait_checks_handler, &snprint_mp_delay_wait_checks); - install_keyword("skip_kpartx", &mp_skip_kpartx_handler, &snprint_mp_skip_kpartx); - install_keyword("max_sectors_kb", &mp_max_sectors_kb_handler, &snprint_mp_max_sectors_kb); + install_keyword("delay_wait_checks", &mp_delay_wait_checks_handler, &snprint_mp_delay_wait_checks); + install_keyword("skip_kpartx", &mp_skip_kpartx_handler, &snprint_mp_skip_kpartx); + install_keyword("max_sectors_kb", &mp_max_sectors_kb_handler, &snprint_mp_max_sectors_kb); + install_keyword("unpriv_sgio", &mp_unpriv_sgio_handler, &snprint_mp_unpriv_sgio); - install_sublevel_end(); + install_sublevel_end(); } Index: multipath-tools-130222/libmultipath/propsel.c =================================================================== --- multipath-tools-130222.orig/libmultipath/propsel.c +++ multipath-tools-130222/libmultipath/propsel.c @@ -944,3 +944,29 @@ select_max_sectors_kb (struct multipath - mp->max_sectors_kb = MAX_SECTORS_KB_UNDEF; - return 0; + mp->max_sectors_kb = MAX_SECTORS_KB_UNDEF; + return 0; } + +extern int @@ -327,15 +327,15 @@ Index: multipath-tools-130222/libmultipath/structs.h --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -134,12 +134,17 @@ enum skip_kpartx_states { - SKIP_KPARTX_ON, + SKIP_KPARTX_ON, }; - + - enum max_sectors_kb_states { - MAX_SECTORS_KB_UNDEF = 0, - MAX_SECTORS_KB_MIN = 4, /* can't be smaller than page size */ + MAX_SECTORS_KB_UNDEF = 0, + MAX_SECTORS_KB_MIN = 4, /* can't be smaller than page size */ }; - + +enum unpriv_sgio_states { + UNPRIV_SGIO_UNDEF, + UNPRIV_SGIO_OFF, @@ -343,23 +343,23 @@ Index: multipath-tools-130222/libmultipath/structs.h +}; + enum scsi_protocol { - SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */ - SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */ + SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */ + SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */ @@ -260,6 +265,7 @@ struct multipath { - int skip_kpartx; - int max_sectors_kb; - int force_readonly; + int skip_kpartx; + int max_sectors_kb; + int force_readonly; + int unpriv_sgio; - unsigned int dev_loss; - uid_t uid; - gid_t gid; + unsigned int dev_loss; + uid_t uid; + gid_t gid; Index: multipath-tools-130222/libmultipath/discovery.c =================================================================== --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -222,6 +222,50 @@ fail_reload: } - + int +sysfs_set_unpriv_sgio(struct multipath *mpp) +{ @@ -407,13 +407,13 @@ Index: multipath-tools-130222/libmultipath/discovery.c +int sysfs_get_timeout(struct path *pp, unsigned int *timeout) { - const char *attr = NULL; + const char *attr = NULL; Index: multipath-tools-130222/libmultipath/discovery.h =================================================================== --- multipath-tools-130222.orig/libmultipath/discovery.h +++ multipath-tools-130222/libmultipath/discovery.h @@ -42,6 +42,7 @@ int store_pathinfo (vector pathvec, vect - struct path **pp_ptr); + struct path **pp_ptr); int sysfs_set_scsi_tmo (struct multipath *mpp); int sysfs_set_max_sectors_kb(struct multipath *mpp, int is_reload); +int sysfs_set_unpriv_sgio(struct multipath *mpp); diff --git a/SOURCES/0224-RHBZ-1452210-prkey.patch b/SOURCES/0224-RHBZ-1452210-prkey.patch index 1df91b8b..e981971a 100644 --- a/SOURCES/0224-RHBZ-1452210-prkey.patch +++ b/SOURCES/0224-RHBZ-1452210-prkey.patch @@ -2,25 +2,25 @@ libmpathpersist/mpath_persist.c | 79 +++++++++--------- libmpathpersist/mpath_updatepr.c | 40 +++++---- libmpathpersist/mpathpr.h | 5 - - libmultipath/Makefile | 2 + libmultipath/Makefile | 2 libmultipath/byteorder.h | 43 ++++++++++ libmultipath/checkers/rbd.c | 16 --- libmultipath/config.c | 9 +- libmultipath/config.h | 9 +- - libmultipath/defaults.h | 1 + libmultipath/defaults.h | 1 libmultipath/dict.c | 140 ++++++++++++-------------------- libmultipath/prkey.c | 167 +++++++++++++++++++++++++++++++++++++++ libmultipath/prkey.h | 19 ++++ libmultipath/propsel.c | 58 ++++++------- libmultipath/structs.h | 14 ++- libmultipath/util.c | 34 +++++++ - libmultipath/util.h | 4 + libmultipath/util.h | 4 mpathpersist/main.c | 5 - multipath/multipath.conf.5 | 18 +++- multipathd/cli.c | 7 + multipathd/cli.h | 8 + multipathd/cli_handlers.c | 69 ++++++++++++++++ - multipathd/cli_handlers.h | 4 + multipathd/cli_handlers.h | 4 multipathd/main.c | 29 ++---- multipathd/multipathd.8 | 13 +++ 24 files changed, 576 insertions(+), 217 deletions(-) @@ -30,20 +30,20 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c --- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c +++ multipath-tools-130222/libmpathpersist/mpath_persist.c @@ -221,9 +221,7 @@ int mpath_persistent_reserve_out ( int f - int map_present; - int major, minor; - int ret; + int map_present; + int major, minor; + int ret; - int j; - unsigned char *keyp; -- uint64_t prkey; +- uint64_t prkey; + uint64_t prkey; - - conf->verbosity = verbose; - + + conf->verbosity = verbose; + @@ -290,6 +288,27 @@ int mpath_persistent_reserve_out ( int f - - select_reservation_key(mpp); - + + select_reservation_key(mpp); + + memcpy(&prkey, paramp->sa_key, 8); + if (mpp->prkey_source == PRKEY_SOURCE_FILE && prkey && + ((!get_be64(mpp->reservation_key) && @@ -65,16 +65,16 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c + goto out1; + } + - switch(rq_servact) - { - case MPATH_PROUT_REG_SA: + switch(rq_servact) + { + case MPATH_PROUT_REG_SA: @@ -311,24 +330,19 @@ int mpath_persistent_reserve_out ( int f - } - - if ((ret == MPATH_PR_SUCCESS) && ((rq_servact == MPATH_PROUT_REG_SA) || + } + + if ((ret == MPATH_PR_SUCCESS) && ((rq_servact == MPATH_PROUT_REG_SA) || - (rq_servact == MPATH_PROUT_REG_IGN_SA))) + (rq_servact == MPATH_PROUT_REG_IGN_SA))) - { + { - keyp=paramp->sa_key; - prkey = 0; - for (j = 0; j < 8; ++j) { @@ -85,82 +85,82 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c + if (!prkey) { + update_prflag(alias, 0); + update_prkey(alias, 0); - } + } - if (prkey == 0) - update_prflag(alias, "unset", noisy); - else + else - update_prflag(alias, "set", noisy); + update_prflag(alias, 1); - } else { -- if ((ret == MPATH_PR_SUCCESS) && ((rq_servact == MPATH_PROUT_CLEAR_SA) || + } else { +- if ((ret == MPATH_PR_SUCCESS) && ((rq_servact == MPATH_PROUT_CLEAR_SA) || - (rq_servact == MPATH_PROUT_PREE_AB_SA ))){ - update_prflag(alias, "unset", noisy); + if ((ret == MPATH_PR_SUCCESS) && + (rq_servact == MPATH_PROUT_CLEAR_SA)) { + update_prflag(alias, 0); + update_prkey(alias, 0); - } - } + } + } out1: @@ -729,8 +743,8 @@ int mpath_prout_rel(struct multipath *mp - goto out1; - } - + goto out1; + } + - if (mpp->reservation_key ){ - memcpy (pamp->key, mpp->reservation_key, 8); + if (get_be64(mpp->reservation_key)){ + memcpy (pamp->key, &mpp->reservation_key, 8); - condlog (3, "%s: reservation key set.", mpp->wwid); - } - + condlog (3, "%s: reservation key set.", mpp->wwid); + } + @@ -741,9 +755,9 @@ int mpath_prout_rel(struct multipath *mp - pptr=pamp->trnptid_list[0]; - - for (i = 0; i < num; i++){ -- if (mpp->reservation_key && + pptr=pamp->trnptid_list[0]; + + for (i = 0; i < num; i++){ +- if (mpp->reservation_key && + if (get_be64(mpp->reservation_key) && - memcmp(pr_buff->prin_descriptor.prin_readfd.descriptors[i]->key, -- mpp->reservation_key, 8)){ + memcmp(pr_buff->prin_descriptor.prin_readfd.descriptors[i]->key, +- mpp->reservation_key, 8)){ + &mpp->reservation_key, 8)){ - /*register with tarnsport id*/ - memset(pamp, 0, length); - pamp->trnptid_list[0] = pptr; + /*register with tarnsport id*/ + memset(pamp, 0, length); + pamp->trnptid_list[0] = pptr; @@ -768,7 +782,7 @@ int mpath_prout_rel(struct multipath *mp - } - else - { + } + else + { - if (mpp->reservation_key) + if (get_be64(mpp->reservation_key)) - found = 1; - } - + found = 1; + } + @@ -777,7 +791,7 @@ int mpath_prout_rel(struct multipath *mp - - if (found){ - memset (pamp, 0, length); + + if (found){ + memset (pamp, 0, length); - memcpy (pamp->sa_key, mpp->reservation_key, 8); + memcpy (pamp->sa_key, &mpp->reservation_key, 8); - memset (pamp->key, 0, 8); - status = mpath_prout_reg(mpp, MPATH_PROUT_REG_SA, rq_scope, rq_type, pamp, noisy); - } + memset (pamp->key, 0, 8); + status = mpath_prout_reg(mpp, MPATH_PROUT_REG_SA, rq_scope, rq_type, pamp, noisy); + } @@ -826,11 +840,9 @@ int update_map_pr(struct multipath *mpp) { - int noisy=0; - struct prin_resp *resp; + int noisy=0; + struct prin_resp *resp; - int i,j, ret, isFound; - unsigned char *keyp; - uint64_t prkey; + int i, ret, isFound; - + - if (!mpp->reservation_key) + if (!get_be64(mpp->reservation_key)) - { - /* Nothing to do. Assuming pr mgmt feature is disabled*/ - condlog(3, "%s: reservation_key not set in multipath.conf", mpp->alias); + { + /* Nothing to do. Assuming pr mgmt feature is disabled*/ + condlog(3, "%s: reservation_key not set in multipath.conf", mpp->alias); @@ -859,15 +871,8 @@ int update_map_pr(struct multipath *mpp) - return MPATH_PR_SUCCESS; - } - + return MPATH_PR_SUCCESS; + } + - prkey = 0; - keyp = mpp->reservation_key; - for (j = 0; j < 8; ++j) { @@ -172,18 +172,18 @@ Index: multipath-tools-130222/libmpathpersist/mpath_persist.c - condlog(2, "%s: Multipath reservation_key: 0x%" PRIx64 " ", mpp->alias, prkey); + condlog(2, "%s: Multipath reservation_key: 0x%" PRIx64 " ", mpp->alias, + get_be64(mpp->reservation_key)); - - isFound =0; - for (i = 0; i < resp->prin_descriptor.prin_readkeys.additional_length/8; i++ ) + + isFound =0; + for (i = 0; i < resp->prin_descriptor.prin_readkeys.additional_length/8; i++ ) @@ -875,7 +880,7 @@ int update_map_pr(struct multipath *mpp) - condlog(2, "%s: PR IN READKEYS[%d] reservation key:", mpp->alias, i); - dumpHex((char *)&resp->prin_descriptor.prin_readkeys.key_list[i*8], 8 , 1); - + condlog(2, "%s: PR IN READKEYS[%d] reservation key:", mpp->alias, i); + dumpHex((char *)&resp->prin_descriptor.prin_readkeys.key_list[i*8], 8 , 1); + - if (!memcmp(mpp->reservation_key, &resp->prin_descriptor.prin_readkeys.key_list[i*8], 8)) + if (!memcmp(&mpp->reservation_key, &resp->prin_descriptor.prin_readkeys.key_list[i*8], 8)) - { - condlog(2, "%s: reservation key found in pr in readkeys response", mpp->alias); - isFound =1; + { + condlog(2, "%s: reservation key found in pr in readkeys response", mpp->alias); + isFound =1; Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c =================================================================== --- multipath-tools-130222.orig/libmpathpersist/mpath_updatepr.c @@ -200,36 +200,36 @@ Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c #include #include @@ -18,10 +18,10 @@ - + unsigned long mem_allocated; /* Total memory used in Bytes */ - + -int update_prflag(char * arg1, char * arg2, int noisy) +static int do_update_pr(char * mapname, char * arg) { - int fd; + int fd; - char str[64]; + char str[256]; - char *reply; - int ret = 0; - + char *reply; + int ret = 0; + @@ -31,25 +31,35 @@ int update_prflag(char * arg1, char * ar - return 1 ; - } - + return 1 ; + } + - snprintf(str,sizeof(str),"map %s %s", arg1, arg2); - condlog (2, "%s: pr flag message=%s", arg1, str); + snprintf(str,sizeof(str),"map %s %s", mapname, arg); + condlog (2, "%s: pr message=%s", mapname, arg); - send_packet(fd, str); - ret = recv_packet(fd, &reply); - if (ret < 0) { + send_packet(fd, str); + ret = recv_packet(fd, &reply); + if (ret < 0) { - condlog(2, "%s: message=%s recv error=%d", arg1, str, errno); + condlog(2, "%s: message=%s recv error=%d", mapname, str, errno); - ret = -2; - } else { + ret = -2; + } else { - condlog (2, "%s: message=%s reply=%s", arg1, str, reply); + condlog (2, "%s: message=%s reply=%s", mapname, str, reply); - if (!reply || strncmp(reply,"ok", 2) == 0) + if (!reply || strncmp(reply,"ok", 2) == 0) - ret = -1; - else if (strncmp(reply, "fail", 4) == 0) - ret = -2; @@ -238,11 +238,11 @@ Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c - } + ret = 0; + else ret = -1; - } - - free(reply); - mpath_disconnect(fd); - return ret; + } + + free(reply); + mpath_disconnect(fd); + return ret; } + +int update_prflag(char *mapname, int set) { @@ -265,16 +265,16 @@ Index: multipath-tools-130222/libmpathpersist/mpathpr.h @@ -1,6 +1,8 @@ #ifndef MPATHPR_H #define MPATHPR_H - + +#include + struct prin_param { - char dev[FILE_NAME_SIZE]; + char dev[FILE_NAME_SIZE]; int rq_servact; @@ -47,7 +49,8 @@ int mpath_prout_rel(struct multipath *mp int send_prout_activepath(char * dev, int rq_servact, int rq_scope, unsigned int rq_type, struct prout_param_descriptor * paramp, int noisy); - + -int update_prflag(char * arg1, char * arg2, int noisy); +int update_prflag(char *mapname, int set); +int update_prkey(char *mapname, uint64_t prkey); @@ -334,17 +334,17 @@ Index: multipath-tools-130222/libmultipath/checkers/rbd.c --- multipath-tools-130222.orig/libmultipath/checkers/rbd.c +++ multipath-tools-130222/libmultipath/checkers/rbd.c @@ -27,6 +27,7 @@ - + #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); @@ -355,21 +356,6 @@ int rbd_check(struct rbd_checker_context - return PATH_UP; + return PATH_UP; } - + -int safe_write(int fd, const void *buf, size_t count) -{ - while (count > 0) { @@ -361,88 +361,88 @@ Index: multipath-tools-130222/libmultipath/checkers/rbd.c -} - static int sysfs_write_rbd_bus(const char *which, const char *buf, - size_t buf_len) + size_t buf_len) { Index: multipath-tools-130222/libmultipath/config.c =================================================================== --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -574,6 +574,9 @@ free_config (struct config * conf) - if (conf->wwids_file) - FREE(conf->wwids_file); - + if (conf->wwids_file) + FREE(conf->wwids_file); + + if (conf->prkeys_file) + FREE(conf->prkeys_file); + - if (conf->prio_name) - FREE(conf->prio_name); - + if (conf->prio_name) + FREE(conf->prio_name); + @@ -589,9 +592,6 @@ free_config (struct config * conf) - if (conf->config_dir) - FREE(conf->config_dir); - + if (conf->config_dir) + FREE(conf->config_dir); + - if (conf->reservation_key) - FREE(conf->reservation_key); - - free_blacklist(conf->blist_devnode); - free_blacklist(conf->blist_wwid); - free_blacklist_device(conf->blist_device); + free_blacklist(conf->blist_devnode); + free_blacklist(conf->blist_wwid); + free_blacklist_device(conf->blist_device); @@ -666,6 +666,7 @@ load_config (char * file, struct udev *u - get_sys_max_fds(&conf->max_fds); - conf->bindings_file = set_default(DEFAULT_BINDINGS_FILE); - conf->wwids_file = set_default(DEFAULT_WWIDS_FILE); + get_sys_max_fds(&conf->max_fds); + conf->bindings_file = set_default(DEFAULT_BINDINGS_FILE); + conf->wwids_file = set_default(DEFAULT_WWIDS_FILE); + conf->prkeys_file = set_default(DEFAULT_PRKEYS_FILE); - conf->bindings_read_only = 0; - conf->multipath_dir = set_default(DEFAULT_MULTIPATHDIR); - conf->features = set_default(DEFAULT_FEATURES); + conf->bindings_read_only = 0; + conf->multipath_dir = set_default(DEFAULT_MULTIPATHDIR); + conf->features = set_default(DEFAULT_FEATURES); @@ -806,7 +807,7 @@ load_config (char * file, struct udev *u - conf->bindings_file = set_default(DEFAULT_BINDINGS_FILE); - - if (!conf->multipath_dir || !conf->bindings_file || + conf->bindings_file = set_default(DEFAULT_BINDINGS_FILE); + + if (!conf->multipath_dir || !conf->bindings_file || - !conf->wwids_file) + !conf->wwids_file || !conf->prkeys_file) - goto out; - - if (conf->ignore_new_boot_devs) + goto out; + + if (conf->ignore_new_boot_devs) Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -3,6 +3,8 @@ - + #include #include +#include +#include "byteorder.h" - + #define ORIGIN_DEFAULT 0 #define ORIGIN_CONFIG 1 @@ -80,7 +82,8 @@ struct mpentry { - - char * prio_name; - char * prio_args; + + char * prio_name; + char * prio_args; - unsigned char * reservation_key; + int prkey_source; + struct be64 reservation_key; - int pgpolicy; - int pgfailback; - int rr_weight; + int pgpolicy; + int pgfailback; + int rr_weight; @@ -167,12 +170,14 @@ struct config { - char * hwhandler; - char * bindings_file; - char * wwids_file; + char * hwhandler; + char * bindings_file; + char * wwids_file; + char * prkeys_file; - char * prio_name; - char * prio_args; - char * checker_name; - char * alias_prefix; - char * config_dir; + char * prio_name; + char * prio_args; + char * checker_name; + char * alias_prefix; + char * config_dir; - unsigned char * reservation_key; + int prkey_source; + struct be64 reservation_key; - - vector keywords; - vector mptable; + + vector keywords; + vector mptable; Index: multipath-tools-130222/libmultipath/defaults.h =================================================================== --- multipath-tools-130222.orig/libmultipath/defaults.h @@ -453,7 +453,7 @@ Index: multipath-tools-130222/libmultipath/defaults.h #define DEFAULT_WWIDS_FILE "/etc/multipath/wwids" +#define DEFAULT_PRKEYS_FILE "/etc/multipath/prkeys" #define DEFAULT_CONFIG_DIR "/etc/multipath/conf.d" - + char * set_default (char * str); Index: multipath-tools-130222/libmultipath/dict.c =================================================================== @@ -466,22 +466,22 @@ Index: multipath-tools-130222/libmultipath/dict.c +#include "util.h" +#include "prkey.h" #include - + /* @@ -554,46 +556,26 @@ static int def_reservation_key_handler(vector strvec) { - char *buff; + char *buff; - char *tbuff; - int j, k; - int len; - uint64_t prkey; + uint64_t prkey = 0; - - buff = set_value(strvec); - if (!buff) - return 1; - + + buff = set_value(strvec); + if (!buff) + return 1; + - tbuff = buff; - - if (!memcmp("0x",buff, 2)) @@ -499,16 +499,16 @@ Index: multipath-tools-130222/libmultipath/dict.c + put_be64(conf->reservation_key, 0); + FREE(buff); + return 0; - } + } - - if (1 != sscanf (buff, "%" SCNx64 "", &prkey)) - { - FREE(tbuff); + else if (parse_prkey(buff, &prkey) != 0) { + FREE(buff); - return 1; - } - + return 1; + } + - if (!conf->reservation_key) - conf->reservation_key = (unsigned char *) malloc(8); - @@ -523,12 +523,12 @@ Index: multipath-tools-130222/libmultipath/dict.c + conf->prkey_source = PRKEY_SOURCE_CONF; + put_be64(conf->reservation_key, prkey); + FREE(buff); - return 0; + return 0; } - + @@ -668,6 +650,19 @@ wwids_file_handler(vector strvec) } - + static int +prkeys_file_handler(vector strvec) +{ @@ -545,22 +545,22 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int def_retain_hwhandler_handler(vector strvec) { - char * buff; + char * buff; @@ -2282,10 +2277,7 @@ static int mp_reservation_key_handler (vector strvec) { - char *buff; + char *buff; - char *tbuff; - struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable); + struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable); - - int j, k, len; - uint64_t prkey; - - if (!mpe) + uint64_t prkey; + + if (!mpe) @@ -2295,35 +2287,20 @@ mp_reservation_key_handler (vector strve - if (!buff) - return 1; - + if (!buff) + return 1; + - tbuff = buff; - if (!memcmp(buff, "0x", 2)) - buff = buff + 2; @@ -576,16 +576,16 @@ Index: multipath-tools-130222/libmultipath/dict.c + put_be64(mpe->reservation_key, 0); + FREE(buff); + return 0; - } + } - - if (1 != sscanf (buff, "%" SCNx64 "", &prkey)) - { - FREE(tbuff); + else if (parse_prkey(buff, &prkey) != 0) { + FREE(buff); - return 1; - } - + return 1; + } + - if (!mpe->reservation_key) - mpe->reservation_key = (unsigned char *) malloc(8); - @@ -600,9 +600,9 @@ Index: multipath-tools-130222/libmultipath/dict.c + mpe->prkey_source = PRKEY_SOURCE_CONF; + put_be64(mpe->reservation_key, prkey); + FREE(buff); - return 0; + return 0; } - + @@ -2714,22 +2691,14 @@ snprint_mp_prio_args(char * buff, int le static int snprint_mp_reservation_key (char * buff, int len, void * data) @@ -610,11 +610,11 @@ Index: multipath-tools-130222/libmultipath/dict.c - int i; - unsigned char *keyp; - uint64_t prkey = 0; - struct mpentry * mpe = (struct mpentry *)data; - + struct mpentry * mpe = (struct mpentry *)data; + - if (!mpe->reservation_key) + if (mpe->prkey_source == PRKEY_SOURCE_NONE) - return 0; + return 0; - keyp = (unsigned char *)mpe->reservation_key; - for (i = 0; i < 8; i++) { - if (i > 0) @@ -629,11 +629,11 @@ Index: multipath-tools-130222/libmultipath/dict.c + return snprintf(buff, len, "0x%" PRIx64, + get_be64(mpe->reservation_key)); } - + static int @@ -3551,22 +3520,22 @@ snprint_def_wwids_file (char * buff, int } - + static int -snprint_def_reservation_key(char * buff, int len, void * data) +snprint_def_prkeys_file (char * buff, int len, void * data) @@ -645,13 +645,13 @@ Index: multipath-tools-130222/libmultipath/dict.c + return 0; + return snprintf(buff, len, "%s", conf->prkeys_file); +} - + - if (!conf->reservation_key) +static int +snprint_def_reservation_key(char * buff, int len, void * data) +{ + if (conf->prkey_source == PRKEY_SOURCE_NONE) - return 0; + return 0; - keyp = (unsigned char *)conf->reservation_key; - for (i = 0; i < 8; i++) { - if (i > 0) @@ -665,16 +665,16 @@ Index: multipath-tools-130222/libmultipath/dict.c + return snprintf(buff, len, "0x%" PRIx64, + get_be64(conf->reservation_key)); } - + static int @@ -3788,6 +3757,7 @@ init_keywords(void) - install_keyword("dev_loss_tmo", &def_dev_loss_handler, &snprint_def_dev_loss); - install_keyword("bindings_file", &bindings_file_handler, &snprint_def_bindings_file); - install_keyword("wwids_file", &wwids_file_handler, &snprint_def_wwids_file); + install_keyword("dev_loss_tmo", &def_dev_loss_handler, &snprint_def_dev_loss); + install_keyword("bindings_file", &bindings_file_handler, &snprint_def_bindings_file); + install_keyword("wwids_file", &wwids_file_handler, &snprint_def_wwids_file); + install_keyword("prkeys_file", &prkeys_file_handler, &snprint_def_prkeys_file); - install_keyword("log_checker_err", &def_log_checker_err_handler, &snprint_def_log_checker_err); - install_keyword("reservation_key", &def_reservation_key_handler, &snprint_def_reservation_key); - install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths); + install_keyword("log_checker_err", &def_log_checker_err_handler, &snprint_def_log_checker_err); + install_keyword("reservation_key", &def_reservation_key_handler, &snprint_def_reservation_key); + install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths); Index: multipath-tools-130222/libmultipath/prkey.c =================================================================== --- /dev/null @@ -881,7 +881,7 @@ Index: multipath-tools-130222/libmultipath/propsel.c #include "prioritizers/alua_rtpg.h" +#include "prkey.h" #include - + pgpolicyfn *pgpolicies[] = { @@ -711,44 +712,39 @@ select_flush_on_last_del(struct multipat extern int @@ -907,15 +907,15 @@ Index: multipath-tools-130222/libmultipath/propsel.c + uint64_t prkey; + char *origin = NULL; + char *from_file = ""; - + + 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->reservation_key = mp->mpe->reservation_key; - return 0; + origin = "multipath setting"; + goto out; - } - + } + - if (conf->reservation_key) { - keyp = conf->reservation_key; - for (j = 0; j < 8; ++j) { @@ -930,12 +930,12 @@ Index: multipath-tools-130222/libmultipath/propsel.c - + if (conf->prkey_source != PRKEY_SOURCE_NONE) { + mp->prkey_source = conf->prkey_source; - mp->reservation_key = conf->reservation_key; + mp->reservation_key = conf->reservation_key; - return 0; + origin = "config file default"; + goto out; - } - + } + + put_be64(mp->reservation_key, 0); + mp->prkey_source = PRKEY_SOURCE_NONE; + return 0; @@ -951,36 +951,36 @@ Index: multipath-tools-130222/libmultipath/propsel.c + condlog(0, "%s: reservation_key = 0x%" PRIx64 " (%s)%s", + mp->alias, get_be64(mp->reservation_key), origin, + from_file); - return 0; + return 0; } - + Index: multipath-tools-130222/libmultipath/structs.h =================================================================== --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -2,8 +2,10 @@ #define _STRUCTS_H - + #include +#include - + #include "prio.h" +#include "byteorder.h" - + #define WWID_SIZE 128 #define SERIAL_SIZE 65 @@ -27,7 +29,6 @@ #define NO_PATH_RETRY_FAIL -1 #define NO_PATH_RETRY_QUEUE -2 - + - enum free_path_mode { - KEEP_PATHS, - FREE_PATHS + KEEP_PATHS, + FREE_PATHS @@ -169,6 +170,12 @@ enum missing_udev_info_states { - INFO_REQUESTED, + INFO_REQUESTED, }; - + +enum prkey_sources { + PRKEY_SOURCE_NONE, + PRKEY_SOURCE_CONF, @@ -988,20 +988,20 @@ Index: multipath-tools-130222/libmultipath/structs.h +}; + struct sg_id { - int host_no; - int channel; + int host_no; + int channel; @@ -298,8 +305,9 @@ struct multipath { - /* checkers shared data */ - void * mpcontext; - + /* checkers shared data */ + void * mpcontext; + - /* persistent management data*/ - unsigned char * reservation_key; + /* persistent management data */ + int prkey_source; + struct be64 reservation_key; - unsigned char prflag; + unsigned char prflag; }; - + Index: multipath-tools-130222/libmultipath/util.c =================================================================== --- multipath-tools-130222.orig/libmultipath/util.c @@ -1011,19 +1011,19 @@ Index: multipath-tools-130222/libmultipath/util.c #include #include +#include - + #include "debug.h" #include "memory.h" #include "checkers.h" #include "vector.h" #include "structs.h" +#include "util.h" - + void strchop(char *str) @@ -297,3 +299,35 @@ int in_initrd(void) { - - return saved; + + return saved; } + +int parse_prkey(char *ptr, uint64_t *prkey) @@ -1064,7 +1064,7 @@ Index: multipath-tools-130222/libmultipath/util.h @@ -1,6 +1,8 @@ #ifndef _UTIL_H #define _UTIL_H - + +#include + void strchop(char *); @@ -1076,48 +1076,48 @@ Index: multipath-tools-130222/libmultipath/util.h int in_initrd(void); +int parse_prkey(char *ptr, uint64_t *prkey); +int safe_write(int fd, const void *buf, size_t count); - + #define safe_sprintf(var, format, args...) \ - snprintf(var, sizeof(var), format, ##args) >= sizeof(var) + snprintf(var, sizeof(var), format, ##args) >= sizeof(var) Index: multipath-tools-130222/multipathd/cli.c =================================================================== --- multipath-tools-130222.orig/multipathd/cli.c +++ multipath-tools-130222/multipathd/cli.c @@ -190,6 +190,10 @@ load_keys (void) - r += add_key(keys, "unsetprstatus", UNSETPRSTATUS, 0); - r += add_key(keys, "format", FMT, 1); - r += add_key(keys, "json", JSON, 0); + r += add_key(keys, "unsetprstatus", UNSETPRSTATUS, 0); + r += add_key(keys, "format", FMT, 1); + r += add_key(keys, "json", JSON, 0); + r += add_key(keys, "getprkey", GETPRKEY, 0); + r += add_key(keys, "setprkey", SETPRKEY, 0); + r += add_key(keys, "unsetprkey", UNSETPRKEY, 0); + r += add_key(keys, "key", KEY, 1); - - if (r) { - free_keys(keys); + + if (r) { + free_keys(keys); @@ -506,6 +510,9 @@ cli_init (void) { - add_handler(GETPRSTATUS+MAP, NULL); - add_handler(SETPRSTATUS+MAP, NULL); - add_handler(UNSETPRSTATUS+MAP, NULL); + add_handler(GETPRSTATUS+MAP, NULL); + add_handler(SETPRSTATUS+MAP, NULL); + add_handler(UNSETPRSTATUS+MAP, NULL); + add_handler(GETPRKEY+MAP, NULL); + add_handler(SETPRKEY+MAP+KEY, NULL); + add_handler(UNSETPRKEY+MAP, NULL); - add_handler(FORCEQ+DAEMON, NULL); - add_handler(RESTOREQ+DAEMON, NULL); - + add_handler(FORCEQ+DAEMON, NULL); + add_handler(RESTOREQ+DAEMON, NULL); + Index: multipath-tools-130222/multipathd/cli.h =================================================================== --- multipath-tools-130222.orig/multipathd/cli.h +++ multipath-tools-130222/multipathd/cli.h @@ -37,6 +37,10 @@ enum { - __UNSETPRSTATUS, - __FMT, - __JSON, + __UNSETPRSTATUS, + __FMT, + __JSON, + __GETPRKEY, + __SETPRKEY, + __UNSETPRKEY, + __KEY, }; - + #define LIST (1 << __LIST) @@ -76,6 +80,10 @@ enum { #define UNSETPRSTATUS (1ULL << __UNSETPRSTATUS) @@ -1127,9 +1127,9 @@ Index: multipath-tools-130222/multipathd/cli.h +#define SETPRKEY (1ULL << __SETPRKEY) +#define UNSETPRKEY (1ULL << __UNSETPRKEY) +#define KEY (1ULL << __KEY) - + #define INITIAL_REPLY_LEN 1200 - + Index: multipath-tools-130222/multipathd/cli_handlers.c =================================================================== --- multipath-tools-130222.orig/multipathd/cli_handlers.c @@ -1139,12 +1139,12 @@ Index: multipath-tools-130222/multipathd/cli_handlers.c #include #include +#include - + #include "main.h" #include "cli.h" @@ -1234,3 +1235,71 @@ cli_unsetprstatus(void * v, char ** repl - - return 0; + + return 0; } + +int @@ -1235,35 +1235,35 @@ Index: multipath-tools-130222/multipathd/main.c #include #include +#include - + #include "main.h" #include "pidfile.h" @@ -1050,6 +1051,9 @@ uxlsnrloop (void * ap) - set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus); - set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus); - set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus); + set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus); + set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus); + set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus); + set_handler_callback(GETPRKEY+MAP, cli_getprkey); + set_handler_callback(SETPRKEY+MAP+KEY, cli_setprkey); + set_handler_callback(UNSETPRKEY+MAP, cli_unsetprkey); - set_handler_callback(FORCEQ+DAEMON, cli_force_no_daemon_q); - set_handler_callback(RESTOREQ+DAEMON, cli_restore_no_daemon_q); - + set_handler_callback(FORCEQ+DAEMON, cli_force_no_daemon_q); + set_handler_callback(RESTOREQ+DAEMON, cli_restore_no_daemon_q); + @@ -2266,10 +2270,8 @@ main (int argc, char *argv[]) void * mpath_pr_event_handler_fn (void * pathp ) { - struct multipath * mpp; + struct multipath * mpp; - int i,j, ret, isFound; + int i, ret, isFound; - struct path * pp = (struct path *)pathp; + struct path * pp = (struct path *)pathp; - unsigned char *keyp; - uint64_t prkey; - struct prout_param_descriptor *param; - struct prin_resp *resp; - + struct prout_param_descriptor *param; + struct prin_resp *resp; + @@ -2297,22 +2299,15 @@ void * mpath_pr_event_handler_fn (void - ret = MPATH_PR_SUCCESS; - goto out; - } + ret = MPATH_PR_SUCCESS; + goto out; + } - prkey = 0; - keyp = (unsigned char *)mpp->reservation_key; - for (j = 0; j < 8; ++j) { @@ -1275,39 +1275,39 @@ Index: multipath-tools-130222/multipathd/main.c - condlog(2, "Multipath reservation_key: 0x%" PRIx64 " ", prkey); + condlog(2, "Multipath reservation_key: 0x%" PRIx64 " ", + get_be64(mpp->reservation_key)); - - isFound =0; - for (i = 0; i < resp->prin_descriptor.prin_readkeys.additional_length/8; i++ ) - { - condlog(2, "PR IN READKEYS[%d] reservation key:",i); - dumpHex((char *)&resp->prin_descriptor.prin_readkeys.key_list[i*8], 8 , -1); + + isFound =0; + for (i = 0; i < resp->prin_descriptor.prin_readkeys.additional_length/8; i++ ) + { + condlog(2, "PR IN READKEYS[%d] reservation key:",i); + dumpHex((char *)&resp->prin_descriptor.prin_readkeys.key_list[i*8], 8 , -1); - if (!memcmp(mpp->reservation_key, &resp->prin_descriptor.prin_readkeys.key_list[i*8], 8)) + if (!memcmp(&mpp->reservation_key, &resp->prin_descriptor.prin_readkeys.key_list[i*8], 8)) - { - condlog(2, "%s: pr key found in prin readkeys response", mpp->alias); - isFound =1; + { + condlog(2, "%s: pr key found in prin readkeys response", mpp->alias); + isFound =1; @@ -2329,11 +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= malloc(sizeof(struct prout_param_descriptor)); + memset(param, 0 , sizeof(struct prout_param_descriptor)); - - for (j = 7; j >= 0; --j) { - param->sa_key[j] = (prkey & 0xff); - prkey >>= 8; - } + memcpy(param->sa_key, &mpp->reservation_key, 8); - param->num_transportid = 0; - - condlog(3, "device %s:%s", pp->dev, pp->mpp->wwid); + param->num_transportid = 0; + + condlog(3, "device %s:%s", pp->dev, pp->mpp->wwid); @@ -2360,7 +2351,7 @@ int mpath_pr_event_handle(struct path *p - - mpp = pp->mpp; - + + mpp = pp->mpp; + - if (!mpp->reservation_key) + if (!get_be64(mpp->reservation_key)) - return -1; - - pthread_attr_init(&attr); + return -1; + + pthread_attr_init(&attr); Index: multipath-tools-130222/libmultipath/Makefile =================================================================== --- multipath-tools-130222.orig/libmultipath/Makefile @@ -1318,9 +1318,9 @@ Index: multipath-tools-130222/libmultipath/Makefile log.o configure.o structs_vec.o sysfs.o prio.o checkers.o \ - lock.o waiter.o file.o wwids.o prioritizers/alua_rtpg.o + lock.o waiter.o file.o wwids.o prioritizers/alua_rtpg.o prkey.o - + LIBDM_API_FLUSH = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_no_flush' /usr/include/libdevmapper.h) - + Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.conf.5 @@ -1394,20 +1394,20 @@ Index: multipath-tools-130222/mpathpersist/main.c #include #include @@ -139,7 +140,7 @@ int main (int argc, char * argv[]) - ++num_prout_param; - break; - case 'K': + ++num_prout_param; + break; + case 'K': - if (1 != sscanf (optarg, "%" SCNx64 "", ¶m_rk)) + if (parse_prkey(optarg, ¶m_rk) != 0) - { - fprintf (stderr, "bad argument to '--param-rk'\n"); - return MPATH_PR_SYNTAX_ERROR; + { + fprintf (stderr, "bad argument to '--param-rk'\n"); + return MPATH_PR_SYNTAX_ERROR; @@ -148,7 +149,7 @@ int main (int argc, char * argv[]) - break; - - case 'S': + break; + + case 'S': - if (1 != sscanf (optarg, "%" SCNx64 "", ¶m_sark)) + if (parse_prkey(optarg, ¶m_sark) != 0) - { - fprintf (stderr, "bad argument to '--param-sark'\n"); - return MPATH_PR_SYNTAX_ERROR; + { + fprintf (stderr, "bad argument to '--param-sark'\n"); + return MPATH_PR_SYNTAX_ERROR; diff --git a/SOURCES/0225-RH-udevdir.patch b/SOURCES/0225-RH-udevdir.patch index b52dafa1..b3c891fe 100644 --- a/SOURCES/0225-RH-udevdir.patch +++ b/SOURCES/0225-RH-udevdir.patch @@ -8,35 +8,35 @@ Index: multipath-tools-130222/multipath/Makefile --- multipath-tools-130222.orig/multipath/Makefile +++ multipath-tools-130222/multipath/Makefile @@ -24,9 +24,9 @@ install: - $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ - $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ - $(INSTALL_PROGRAM) -d $(DESTDIR)/usr/lib/udev/rules.d - $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules - $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)/usr/lib/udev/rules.d/11-dm-mpath.rules + $(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)/rules.d + $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules + $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(libudevdir)/rules.d/11-dm-mpath.rules - $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) + $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) @@ -34,8 +34,8 @@ install: - $(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(mandir) - + $(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(mandir) + uninstall: - rm $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules - rm $(DESTDIR)/usr/lib/udev/rules.d/11-dm-mpath.rules + rm $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules + rm $(DESTDIR)$(libudevdir)/rules.d/11-dm-mpath.rules - rm $(DESTDIR)$(bindir)/$(EXEC) - rm $(DESTDIR)$(bindir)/mpathconf - rm $(DESTDIR)$(mandir)/$(EXEC).8.gz + rm $(DESTDIR)$(bindir)/$(EXEC) + rm $(DESTDIR)$(bindir)/mpathconf + rm $(DESTDIR)$(mandir)/$(EXEC).8.gz Index: multipath-tools-130222/Makefile.inc =================================================================== --- multipath-tools-130222.orig/Makefile.inc +++ multipath-tools-130222/Makefile.inc @@ -24,7 +24,7 @@ endif - prefix = + prefix = exec_prefix = $(prefix) bindir = $(exec_prefix)/usr/sbin -libudevdir = ${prefix}/lib/udev diff --git a/SOURCES/0226-RH-allow-overrides-section.patch b/SOURCES/0226-RH-allow-overrides-section.patch index 52da55c1..6b1dec1a 100644 --- a/SOURCES/0226-RH-allow-overrides-section.patch +++ b/SOURCES/0226-RH-allow-overrides-section.patch @@ -7,9 +7,9 @@ Index: multipath-tools-130222/libmultipath/dict.c --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -3721,6 +3721,18 @@ snprint_bled_product (char * buff, int l - + #define __deprecated - + +static int +nop_handler(vector strvec) +{ @@ -26,9 +26,9 @@ Index: multipath-tools-130222/libmultipath/dict.c init_keywords(void) { @@ -3853,6 +3865,36 @@ init_keywords(void) - install_keyword("unpriv_sgio", &hw_unpriv_sgio_handler, &snprint_hw_unpriv_sgio); - install_sublevel_end(); - + install_keyword("unpriv_sgio", &hw_unpriv_sgio_handler, &snprint_hw_unpriv_sgio); + install_sublevel_end(); + + install_keyword_root("overrides", &nop_handler); + install_keyword("path_grouping_policy", &nop_handler, &snprint_nop); + install_keyword("uid_attribute", &nop_handler, &snprint_nop); @@ -59,6 +59,6 @@ Index: multipath-tools-130222/libmultipath/dict.c + install_keyword("skip_kpartx", &nop_handler, &snprint_nop); + install_keyword("max_sectors_kb", &nop_handler, &snprint_nop); + - install_keyword_root("multipaths", &multipaths_handler); - install_keyword_multi("multipath", &multipath_handler, NULL); - install_sublevel(); + install_keyword_root("multipaths", &multipaths_handler); + install_keyword_multi("multipath", &multipath_handler, NULL); + install_sublevel(); diff --git a/SOURCES/0227-RHBZ-1465773-fix-path-delay-msg.patch b/SOURCES/0227-RHBZ-1465773-fix-path-delay-msg.patch index b91a8afd..ed24a17f 100644 --- a/SOURCES/0227-RHBZ-1465773-fix-path-delay-msg.patch +++ b/SOURCES/0227-RHBZ-1465773-fix-path-delay-msg.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -538,7 +538,7 @@ ev_add_path (struct path * pp, struct ve - pp->tpgs == TPGS_IMPLICIT)) - mpp->force_udev_reload = 1; - else { + pp->tpgs == TPGS_IMPLICIT)) + mpp->force_udev_reload = 1; + else { - condlog(2, "%s : delaying path addition until %s is fully initialized", pp->dev, mpp->alias); + condlog(2, "%s [%s]: delaying path addition until %s is fully initialized", pp->dev, pp->dev_t, mpp->alias); - mpp->wait_for_udev = 2; - orphan_path(pp); - return 0; + mpp->wait_for_udev = 2; + orphan_path(pp); + return 0; diff --git a/SOURCES/0228-RHBZ-1464634-hauwei-config-update.patch b/SOURCES/0228-RHBZ-1464634-hauwei-config-update.patch index d5464ad6..a72c39b4 100644 --- a/SOURCES/0228-RHBZ-1464634-hauwei-config-update.patch +++ b/SOURCES/0228-RHBZ-1464634-hauwei-config-update.patch @@ -7,16 +7,16 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -1163,9 +1163,12 @@ static struct hwentry default_hw[] = { - .product = "XSG1", - .features = DEFAULT_FEATURES, - .hwhandler = DEFAULT_HWHANDLER, + .product = "XSG1", + .features = DEFAULT_FEATURES, + .hwhandler = DEFAULT_HWHANDLER, - .pgpolicy = MULTIBUS, + .pgpolicy = GROUP_BY_PRIO, + .prio_name = PRIO_ALUA, + .prio_args = NULL, - .pgfailback = -FAILBACK_IMMEDIATE, - .checker_name = TUR, + .pgfailback = -FAILBACK_IMMEDIATE, + .checker_name = TUR, + .dev_loss = 30, - }, - { - /* + }, + { + /* diff --git a/SOURCES/0229-RHBZ-1467987-poll-on-udev-monitor.patch b/SOURCES/0229-RHBZ-1467987-poll-on-udev-monitor.patch index 26863cfd..46723d79 100644 --- a/SOURCES/0229-RHBZ-1467987-poll-on-udev-monitor.patch +++ b/SOURCES/0229-RHBZ-1467987-poll-on-udev-monitor.patch @@ -11,12 +11,12 @@ Index: multipath-tools-130222/libmultipath/uevent.c #include #include +#include - + #include "memory.h" #include "debug.h" @@ -460,6 +461,21 @@ int uevent_listen(struct udev *udev) - struct uevent *uev; - struct udev_device *dev; + struct uevent *uev; + struct udev_device *dev; struct udev_list_entry *list_entry; + struct pollfd ev_poll; + int fdcount; @@ -33,6 +33,6 @@ Index: multipath-tools-130222/libmultipath/uevent.c + err = -errno; + break; + } - - dev = udev_monitor_receive_device(monitor); - if (!dev) { + + dev = udev_monitor_receive_device(monitor); + if (!dev) { diff --git a/SOURCES/0230-UP-allow-invalid-creates.patch b/SOURCES/0230-UP-allow-invalid-creates.patch index c8213648..6f6cb4d6 100644 --- a/SOURCES/0230-UP-allow-invalid-creates.patch +++ b/SOURCES/0230-UP-allow-invalid-creates.patch @@ -7,27 +7,27 @@ Index: multipath-tools-130222/libmultipath/devmapper.c --- multipath-tools-130222.orig/libmultipath/devmapper.c +++ multipath-tools-130222/libmultipath/devmapper.c @@ -264,12 +264,15 @@ dm_device_remove (const char *name, int - + static int dm_addmap (int task, const char *target, struct multipath *mpp, char * params, - int use_uuid, int ro, int skip_kpartx) { + int use_uuid, int ro, uint16_t udev_flags) { - int r = 0; - struct dm_task *dmt; - char *prefixed_uuid = NULL; - uint32_t cookie = 0; + int r = 0; + struct dm_task *dmt; + char *prefixed_uuid = NULL; + uint32_t cookie = 0; - uint16_t udev_flags = ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | ((skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0); + + /* Need to add this here to allow 0 to be passed in udev_flags */ + if (conf->daemon) + udev_flags |= DM_UDEV_DISABLE_LIBRARY_FALLBACK; - - if (!(dmt = dm_task_create (task))) - return 0; + + if (!(dmt = dm_task_create (task))) + return 0; @@ -326,16 +329,28 @@ dm_addmap (int task, const char *target, - return r; + return r; } - + +static uint16_t build_udev_flags(const struct multipath *mpp, int reload) +{ + /* DM_UDEV_DISABLE_LIBRARY_FALLBACK is added in dm_addmap */ @@ -41,41 +41,41 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + extern int dm_addmap_create (struct multipath *mpp, char * params) { - int ro; + int ro; + uint16_t udev_flags = build_udev_flags(mpp, 0); - - sysfs_set_max_sectors_kb(mpp, 0); - for (ro = 0; ro <= 1; ro++) { - int err; - - if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, + + sysfs_set_max_sectors_kb(mpp, 0); + for (ro = 0; ro <= 1; ro++) { + int err; + + if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, - mpp, params, 1, ro, mpp->skip_kpartx)) + mpp, params, 1, ro, udev_flags)) - return 1; - /* - * DM_DEVICE_CREATE is actually DM_DEV_CREATE + DM_TABLE_LOAD. + return 1; + /* + * DM_DEVICE_CREATE is actually DM_DEV_CREATE + DM_TABLE_LOAD. @@ -358,21 +373,17 @@ dm_addmap_create (struct multipath *mpp, extern int dm_addmap_reload (struct multipath *mpp, char *params, int flush) { - int r = 0; + int r = 0; - uint16_t udev_flags = ((mpp->force_udev_reload)? - 0 : MPATH_UDEV_RELOAD_FLAG) | - ((mpp->skip_kpartx == SKIP_KPARTX_ON)? - MPATH_UDEV_NO_KPARTX_FLAG : 0) | - ((mpp->nr_active)? 0 : MPATH_UDEV_NO_PATHS_FLAG); + uint16_t udev_flags = build_udev_flags(mpp, 1); - - sysfs_set_max_sectors_kb(mpp, 1); - if (!mpp->force_readonly) - r = dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, + + sysfs_set_max_sectors_kb(mpp, 1); + if (!mpp->force_readonly) + r = dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, - ADDMAP_RW, SKIP_KPARTX_OFF); + ADDMAP_RW, 0); - if (!r) { - if (!mpp->force_readonly && errno != EROFS) - return 0; - r = dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, + if (!r) { + if (!mpp->force_readonly && errno != EROFS) + return 0; + r = dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, - ADDMAP_RO, SKIP_KPARTX_OFF); + ADDMAP_RO, 0); - } - if (r) - r = dm_simplecmd(DM_DEVICE_RESUME, mpp->alias, !flush, + } + if (r) + r = dm_simplecmd(DM_DEVICE_RESUME, mpp->alias, !flush, diff --git a/SOURCES/0231-RHBZ-1458852-delay-readying.patch b/SOURCES/0231-RHBZ-1458852-delay-readying.patch index 5daf39a0..953fd3c8 100644 --- a/SOURCES/0231-RHBZ-1458852-delay-readying.patch +++ b/SOURCES/0231-RHBZ-1458852-delay-readying.patch @@ -1,14 +1,14 @@ --- libmultipath/config.c | 4 + libmultipath/config.h | 3 + - libmultipath/defaults.h | 1 + libmultipath/defaults.h | 1 libmultipath/devmapper.c | 19 ++++++-- libmultipath/dict.c | 104 +++++++++++++++++++++++++++++++++++++++++++++ libmultipath/propsel.c | 26 +++++++++++ - libmultipath/propsel.h | 1 + libmultipath/propsel.h | 1 libmultipath/structs.h | 7 +++ multipath/multipath.conf.5 | 13 +++++ - multipath/multipath.rules | 1 + multipath/multipath.rules | 1 multipathd/main.c | 27 +++++++++++ 11 files changed, 202 insertions(+), 4 deletions(-) @@ -17,65 +17,65 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -348,6 +348,7 @@ merge_hwe (struct hwentry * dst, struct - merge_num(skip_kpartx); - merge_num(max_sectors_kb); - merge_num(unpriv_sgio); + merge_num(skip_kpartx); + merge_num(max_sectors_kb); + merge_num(unpriv_sgio); + merge_num(ghost_delay); - - /* - * Make sure features is consistent with + + /* + * Make sure features is consistent with @@ -412,6 +413,7 @@ overwrite_hwe (struct hwentry * dst, str - overwrite_num(skip_kpartx); - overwrite_num(max_sectors_kb); - overwrite_num(unpriv_sgio); + overwrite_num(skip_kpartx); + overwrite_num(max_sectors_kb); + overwrite_num(unpriv_sgio); + overwrite_num(ghost_delay); - - /* - * Make sure features is consistent with + + /* + * Make sure features is consistent with @@ -482,6 +484,7 @@ store_hwe (vector hwtable, struct hwentr - hwe->retain_hwhandler = dhwe->retain_hwhandler; - hwe->detect_prio = dhwe->detect_prio; - hwe->detect_checker = dhwe->detect_checker; + hwe->retain_hwhandler = dhwe->retain_hwhandler; + hwe->detect_prio = dhwe->detect_prio; + hwe->detect_checker = dhwe->detect_checker; + hwe->ghost_delay = dhwe->ghost_delay; - - if (dhwe->bl_product && !(hwe->bl_product = set_param_str(dhwe->bl_product))) - goto out; + + if (dhwe->bl_product && !(hwe->bl_product = set_param_str(dhwe->bl_product))) + goto out; @@ -694,6 +697,7 @@ load_config (char * file, struct udev *u - conf->disable_changed_wwids = 0; - conf->max_sectors_kb = DEFAULT_MAX_SECTORS_KB; - conf->unpriv_sgio = DEFAULT_UNPRIV_SGIO; + conf->disable_changed_wwids = 0; + conf->max_sectors_kb = DEFAULT_MAX_SECTORS_KB; + conf->unpriv_sgio = DEFAULT_UNPRIV_SGIO; + conf->ghost_delay = DEFAULT_GHOST_DELAY; - - /* - * preload default hwtable + + /* + * preload default hwtable Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -70,6 +70,7 @@ struct hwentry { - int skip_kpartx; - int max_sectors_kb; - int unpriv_sgio; + int skip_kpartx; + int max_sectors_kb; + int unpriv_sgio; + int ghost_delay; - char * bl_product; + char * bl_product; }; - + @@ -100,6 +101,7 @@ struct mpentry { - int skip_kpartx; - int max_sectors_kb; - int unpriv_sgio; + int skip_kpartx; + int max_sectors_kb; + int unpriv_sgio; + int ghost_delay; - uid_t uid; - gid_t gid; - mode_t mode; + uid_t uid; + gid_t gid; + mode_t mode; @@ -159,6 +161,7 @@ struct config { - int disable_changed_wwids; - int max_sectors_kb; - int unpriv_sgio; + int disable_changed_wwids; + int max_sectors_kb; + int unpriv_sgio; + int ghost_delay; - unsigned int version[3]; - - char * dev; + unsigned int version[3]; + + char * dev; Index: multipath-tools-130222/libmultipath/defaults.h =================================================================== --- multipath-tools-130222.orig/libmultipath/defaults.h @@ -85,7 +85,7 @@ Index: multipath-tools-130222/libmultipath/defaults.h #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_CHECKINT 5 #define MAX_CHECKINT(a) (a << 2) Index: multipath-tools-130222/libmultipath/devmapper.c @@ -99,23 +99,23 @@ Index: multipath-tools-130222/libmultipath/devmapper.c +#include "propsel.h" #include #include - + @@ -334,7 +335,7 @@ static uint16_t build_udev_flags(const s - /* DM_UDEV_DISABLE_LIBRARY_FALLBACK is added in dm_addmap */ - return (mpp->skip_kpartx == SKIP_KPARTX_ON ? - MPATH_UDEV_NO_KPARTX_FLAG : 0) | + /* DM_UDEV_DISABLE_LIBRARY_FALLBACK is added in dm_addmap */ + return (mpp->skip_kpartx == SKIP_KPARTX_ON ? + MPATH_UDEV_NO_KPARTX_FLAG : 0) | - (mpp->nr_active == 0 ? + ((mpp->nr_active == 0 || mpp->ghost_delay_tick > 0)? - MPATH_UDEV_NO_PATHS_FLAG : 0) | - (reload && !mpp->force_udev_reload ? - MPATH_UDEV_RELOAD_FLAG : 0); + MPATH_UDEV_NO_PATHS_FLAG : 0) | + (reload && !mpp->force_udev_reload ? + MPATH_UDEV_RELOAD_FLAG : 0); @@ -343,8 +344,16 @@ static uint16_t build_udev_flags(const s extern int dm_addmap_create (struct multipath *mpp, char * params) { - int ro; + int ro; - uint16_t udev_flags = build_udev_flags(mpp, 0); + uint16_t udev_flags; - + + select_ghost_delay(mpp); + if (conf->daemon && mpp->ghost_delay > 0 && mpp->nr_active && + pathcount(mpp, PATH_GHOST) == mpp->nr_active) @@ -124,30 +124,30 @@ Index: multipath-tools-130222/libmultipath/devmapper.c + mpp->ghost_delay = 0; + + udev_flags = build_udev_flags(mpp, 0); - sysfs_set_max_sectors_kb(mpp, 0); - for (ro = 0; ro <= 1; ro++) { - int err; + sysfs_set_max_sectors_kb(mpp, 0); + for (ro = 0; ro <= 1; ro++) { + int err; @@ -373,7 +382,11 @@ dm_addmap_create (struct multipath *mpp, extern int dm_addmap_reload (struct multipath *mpp, char *params, int flush) { - int r = 0; + int r = 0; - uint16_t udev_flags = build_udev_flags(mpp, 1); + uint16_t udev_flags; + + if (mpp->ghost_delay_tick > 0 && pathcount(mpp, PATH_UP)) + mpp->ghost_delay_tick = mpp->ghost_delay = 0; + udev_flags = build_udev_flags(mpp, 1); - - sysfs_set_max_sectors_kb(mpp, 1); - if (!mpp->force_readonly) + + sysfs_set_max_sectors_kb(mpp, 1); + if (!mpp->force_readonly) Index: multipath-tools-130222/libmultipath/dict.c =================================================================== --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -1032,6 +1032,25 @@ def_unpriv_sgio_handler(vector strvec) - return 0; + return 0; } - + +static int +def_ghost_delay_handler(vector strvec) +{ @@ -171,9 +171,9 @@ Index: multipath-tools-130222/libmultipath/dict.c * blacklist block handlers */ @@ -1895,6 +1914,29 @@ hw_unpriv_sgio_handler(vector strvec) - return 0; + return 0; } - + +static int +hw_ghost_delay_handler(vector strvec) +{ @@ -201,9 +201,9 @@ Index: multipath-tools-130222/libmultipath/dict.c * multipaths block handlers */ @@ -2474,6 +2516,29 @@ mp_unpriv_sgio_handler(vector strvec) - return 0; + return 0; } - + +static int +mp_ghost_delay_handler(vector strvec) +{ @@ -232,7 +232,7 @@ Index: multipath-tools-130222/libmultipath/dict.c */ @@ -2788,6 +2853,19 @@ snprint_mp_unpriv_sgio (char * buff, int } - + static int +snprint_mp_ghost_delay (char * buff, int len, void * data) +{ @@ -249,10 +249,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_hw_fast_io_fail(char * buff, int len, void * data) { - struct hwentry * hwe = (struct hwentry *)data; + struct hwentry * hwe = (struct hwentry *)data; @@ -3202,6 +3280,19 @@ snprint_hw_unpriv_sgio(char * buff, int } - + static int +snprint_hw_ghost_delay (char * buff, int len, void * data) +{ @@ -269,10 +269,10 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_def_polling_interval (char * buff, int len, void * data) { - return snprintf(buff, len, "%i", conf->checkint); + return snprintf(buff, len, "%i", conf->checkint); @@ -3696,6 +3787,16 @@ snprint_def_unpriv_sgio(char * buff, int } - + static int +snprint_def_ghost_delay (char * buff, int len, void * data) +{ @@ -286,37 +286,37 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int snprint_ble_simple (char * buff, int len, void * data) { - struct blentry * ble = (struct blentry *)data; + struct blentry * ble = (struct blentry *)data; @@ -3792,6 +3893,7 @@ init_keywords(void) - install_keyword("disable_changed_wwids", &def_disable_changed_wwids_handler, &snprint_def_disable_changed_wwids); - 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("disable_changed_wwids", &def_disable_changed_wwids_handler, &snprint_def_disable_changed_wwids); + 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); - __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); + __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); @@ -3863,6 +3965,7 @@ init_keywords(void) - install_keyword("skip_kpartx", &hw_skip_kpartx_handler, &snprint_hw_skip_kpartx); - 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("skip_kpartx", &hw_skip_kpartx_handler, &snprint_hw_skip_kpartx); + 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_sublevel_end(); - - install_keyword_root("overrides", &nop_handler); + install_sublevel_end(); + + install_keyword_root("overrides", &nop_handler); @@ -3923,5 +4026,6 @@ init_keywords(void) - install_keyword("skip_kpartx", &mp_skip_kpartx_handler, &snprint_mp_skip_kpartx); - install_keyword("max_sectors_kb", &mp_max_sectors_kb_handler, &snprint_mp_max_sectors_kb); - install_keyword("unpriv_sgio", &mp_unpriv_sgio_handler, &snprint_mp_unpriv_sgio); + install_keyword("skip_kpartx", &mp_skip_kpartx_handler, &snprint_mp_skip_kpartx); + install_keyword("max_sectors_kb", &mp_max_sectors_kb_handler, &snprint_mp_max_sectors_kb); + install_keyword("unpriv_sgio", &mp_unpriv_sgio_handler, &snprint_mp_unpriv_sgio); + install_keyword("ghost_delay", &mp_ghost_delay_handler, &snprint_mp_ghost_delay); - install_sublevel_end(); + install_sublevel_end(); } Index: multipath-tools-130222/libmultipath/propsel.c =================================================================== --- multipath-tools-130222.orig/libmultipath/propsel.c +++ multipath-tools-130222/libmultipath/propsel.c @@ -966,3 +966,29 @@ select_unpriv_sgio (struct multipath * m - condlog(3, "unpriv_sgio = DISABLED (internal default)"); - return 0; + condlog(3, "unpriv_sgio = DISABLED (internal default)"); + return 0; } + +extern int @@ -358,51 +358,51 @@ Index: multipath-tools-130222/libmultipath/structs.h --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -176,6 +176,11 @@ enum prkey_sources { - PRKEY_SOURCE_FILE, + PRKEY_SOURCE_FILE, }; - + +enum ghost_delay_states { + GHOST_DELAY_OFF = -1, + GHOST_DELAY_UNDEF = 0, +}; + struct sg_id { - int host_no; - int channel; + int host_no; + int channel; @@ -273,6 +278,8 @@ struct multipath { - int max_sectors_kb; - int force_readonly; - int unpriv_sgio; + int max_sectors_kb; + int force_readonly; + int unpriv_sgio; + int ghost_delay; + int ghost_delay_tick; - unsigned int dev_loss; - uid_t uid; - gid_t gid; + unsigned int dev_loss; + uid_t uid; + gid_t gid; Index: multipath-tools-130222/multipathd/main.c =================================================================== --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -195,6 +195,8 @@ sync_map_state(struct multipath *mpp) - pp->state == PATH_WILD || - pp->state == PATH_DELAYED) - continue; + pp->state == PATH_WILD || + pp->state == PATH_DELAYED) + continue; + if (mpp->ghost_delay_tick > 0) + continue; - if ((pp->dmstate == PSTATE_FAILED || - pp->dmstate == PSTATE_UNDEF) && - (pp->state == PATH_UP || pp->state == PATH_GHOST)) + if ((pp->dmstate == PSTATE_FAILED || + pp->dmstate == PSTATE_UNDEF) && + (pp->state == PATH_UP || pp->state == PATH_GHOST)) @@ -535,7 +537,7 @@ ev_add_path (struct path * pp, struct ve - if (mpp && mpp->wait_for_udev) { - if (pathcount(mpp, PATH_UP) == 0 && - (pathcount(mpp, PATH_GHOST) == 0 || + if (mpp && mpp->wait_for_udev) { + if (pathcount(mpp, PATH_UP) == 0 && + (pathcount(mpp, PATH_GHOST) == 0 || - pp->tpgs == TPGS_IMPLICIT)) + mpp->ghost_delay_tick > 0 || pp->tpgs == TPGS_IMPLICIT)) - mpp->force_udev_reload = 1; - else { - condlog(2, "%s [%s]: delaying path addition until %s is fully initialized", pp->dev, pp->dev_t, mpp->alias); + mpp->force_udev_reload = 1; + else { + condlog(2, "%s [%s]: delaying path addition until %s is fully initialized", pp->dev, pp->dev_t, mpp->alias); @@ -1215,6 +1217,28 @@ missing_uev_wait_tick(struct vectors *ve } - + static void +ghost_delay_tick(struct vectors *vecs) +{ @@ -428,15 +428,15 @@ Index: multipath-tools-130222/multipathd/main.c +static void defered_failback_tick (vector mpvec) { - struct multipath * mpp; + struct multipath * mpp; @@ -1560,6 +1584,7 @@ checkerloop (void *ap) - defered_failback_tick(vecs->mpvec); - retry_count_tick(vecs->mpvec); - missing_uev_wait_tick(vecs); + defered_failback_tick(vecs->mpvec); + retry_count_tick(vecs->mpvec); + missing_uev_wait_tick(vecs); + ghost_delay_tick(vecs); - } - if (count) - count--; + } + if (count) + count--; Index: multipath-tools-130222/multipath/multipath.rules =================================================================== --- multipath-tools-130222.orig/multipath/multipath.rules @@ -448,7 +448,7 @@ Index: multipath-tools-130222/multipath/multipath.rules +ENV{DM_NOSCAN}=="1", GOTO="end_mpath" ENV{DM_ACTIVATION}!="1", ENV{DM_MULTIPATH_NEED_KPARTX}!="1", GOTO="end_mpath" RUN+="$env{MPATH_SBIN_PATH}/kpartx -an $tempnode", \ - ENV{DM_MULTIPATH_NEED_KPARTX}="" + ENV{DM_MULTIPATH_NEED_KPARTX}="" Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.conf.5 diff --git a/SOURCES/0232-RHBZ-1456955-property-blacklist.patch b/SOURCES/0232-RHBZ-1456955-property-blacklist.patch index 98ab71fd..bebaa4e1 100644 --- a/SOURCES/0232-RHBZ-1456955-property-blacklist.patch +++ b/SOURCES/0232-RHBZ-1456955-property-blacklist.patch @@ -19,93 +19,93 @@ Index: multipath-tools-130222/libmultipath/blacklist.c */ #include +#include - + #include "checkers.h" #include "memory.h" @@ -102,7 +103,7 @@ set_ble_device (vector blist, char * ven } - + int -_blacklist_exceptions (vector elist, char * str) +_blacklist_exceptions (vector elist, const char * str) { - int i; - struct blentry * ele; + int i; + struct blentry * ele; @@ -115,7 +116,7 @@ _blacklist_exceptions (vector elist, cha } - + int -_blacklist (vector blist, char * str) +_blacklist (vector blist, const char * str) { - int i; - struct blentry * ble; + int i; + struct blentry * ble; @@ -208,11 +209,14 @@ setup_default_blist (struct config * con - condlog(3, "%s: (%s:%s) %s", dev, vendor, product, (M)); \ - else if (wwid) \ - condlog(3, "%s: (%s) %s", dev, wwid, (M)); \ + condlog(3, "%s: (%s:%s) %s", dev, vendor, product, (M)); \ + else if (wwid) \ + condlog(3, "%s: (%s) %s", dev, wwid, (M)); \ + else if (env) \ + condlog(3, "%s: (%s) %s", dev, env, (M)); \ - else \ - condlog(3, "%s: %s", dev, (M)) - + else \ + condlog(3, "%s: %s", dev, (M)) + void -log_filter (char *dev, char *vendor, char *product, char *wwid, int r) +log_filter (const char *dev, char *vendor, char *product, char *wwid, + const char *env, int r) { - /* - * Try to sort from most likely to least. + /* + * Try to sort from most likely to least. @@ -229,6 +233,9 @@ log_filter (char *dev, char *vendor, cha - case MATCH_DEVNODE_BLIST: - LOG_BLIST("device node name blacklisted"); - break; + case MATCH_DEVNODE_BLIST: + LOG_BLIST("device node name blacklisted"); + break; + case MATCH_PROPERTY_BLIST: + LOG_BLIST("udev property blacklisted"); + break; - case MATCH_DEVICE_BLIST_EXCEPT: - LOG_BLIST("vendor/product whitelisted"); - break; + case MATCH_DEVICE_BLIST_EXCEPT: + LOG_BLIST("vendor/product whitelisted"); + break; @@ -238,6 +245,12 @@ log_filter (char *dev, char *vendor, cha - case MATCH_DEVNODE_BLIST_EXCEPT: - LOG_BLIST("device node name whitelisted"); - break; + case MATCH_DEVNODE_BLIST_EXCEPT: + LOG_BLIST("device node name whitelisted"); + break; + case MATCH_PROPERTY_BLIST_EXCEPT: + LOG_BLIST("udev property whitelisted"); + break; + case MATCH_PROPERTY_BLIST_MISSING: + LOG_BLIST("blacklisted, udev property missing"); + break; - } + } } - + @@ -257,7 +270,7 @@ int filter_device (vector blist, vector elist, char * vendor, char * product) { - int r = _filter_device(blist, elist, vendor, product); + int r = _filter_device(blist, elist, vendor, product); - log_filter(NULL, vendor, product, NULL, r); + log_filter(NULL, vendor, product, NULL, NULL, r); - return r; + return r; } - + @@ -277,7 +290,7 @@ int filter_devnode (vector blist, vector elist, char * dev) { - int r = _filter_devnode(blist, elist, dev); + int r = _filter_devnode(blist, elist, dev); - log_filter(dev, NULL, NULL, NULL, r); + log_filter(dev, NULL, NULL, NULL, NULL, r); - return r; + return r; } - + @@ -297,15 +310,67 @@ int filter_wwid (vector blist, vector elist, char * wwid) { - int r = _filter_wwid(blist, elist, wwid); + int r = _filter_wwid(blist, elist, wwid); - log_filter(NULL, NULL, NULL, wwid, r); + log_filter(NULL, NULL, NULL, wwid, NULL, r); - return r; + return r; } - + int +_filter_property (struct config *conf, const char *env) +{ @@ -158,23 +158,23 @@ Index: multipath-tools-130222/libmultipath/blacklist.c +int _filter_path (struct config * conf, struct path * pp) { - int r; - + int r; + + r = filter_property(conf, pp->udev); + if (r > 0) + return r; - r = _filter_devnode(conf->blist_devnode, conf->elist_devnode,pp->dev); - if (r > 0) - return r; + r = _filter_devnode(conf->blist_devnode, conf->elist_devnode,pp->dev); + if (r > 0) + return r; @@ -321,7 +386,7 @@ int filter_path (struct config * conf, struct path * pp) { - int r=_filter_path(conf, pp); + int r=_filter_path(conf, pp); - log_filter(pp->dev, pp->vendor_id, pp->product_id, pp->wwid, r); + log_filter(pp->dev, pp->vendor_id, pp->product_id, pp->wwid, NULL, r); - return r; + return r; } - + Index: multipath-tools-130222/libmultipath/blacklist.h =================================================================== --- multipath-tools-130222.orig/libmultipath/blacklist.h @@ -182,10 +182,10 @@ Index: multipath-tools-130222/libmultipath/blacklist.h @@ -1,15 +1,19 @@ #ifndef _BLACKLIST_H #define _BLACKLIST_H - + +#include #include "regex.h" - + #define MATCH_NOTHING 0 #define MATCH_WWID_BLIST 1 #define MATCH_DEVICE_BLIST 2 @@ -196,9 +196,9 @@ Index: multipath-tools-130222/libmultipath/blacklist.h #define MATCH_DEVICE_BLIST_EXCEPT -MATCH_DEVICE_BLIST #define MATCH_DEVNODE_BLIST_EXCEPT -MATCH_DEVNODE_BLIST +#define MATCH_PROPERTY_BLIST_EXCEPT -MATCH_PROPERTY_BLIST - + struct blentry { - char * str; + char * str; @@ -31,6 +35,7 @@ int filter_devnode (vector, vector, char int filter_wwid (vector, vector, char *); int filter_device (vector, vector, char *, char *); @@ -212,22 +212,22 @@ Index: multipath-tools-130222/libmultipath/config.c --- multipath-tools-130222.orig/libmultipath/config.c +++ multipath-tools-130222/libmultipath/config.c @@ -597,10 +597,12 @@ free_config (struct config * conf) - - free_blacklist(conf->blist_devnode); - free_blacklist(conf->blist_wwid); + + free_blacklist(conf->blist_devnode); + free_blacklist(conf->blist_wwid); + free_blacklist(conf->blist_property); - free_blacklist_device(conf->blist_device); - - free_blacklist(conf->elist_devnode); - free_blacklist(conf->elist_wwid); + free_blacklist_device(conf->blist_device); + + free_blacklist(conf->elist_devnode); + free_blacklist(conf->elist_wwid); + free_blacklist(conf->elist_property); - free_blacklist_device(conf->elist_device); - - free_mptable(conf->mptable); + free_blacklist_device(conf->elist_device); + + free_mptable(conf->mptable); @@ -779,8 +781,12 @@ load_config (char * file, struct udev *u - if (!conf->blist_device) - goto out; - } + if (!conf->blist_device) + goto out; + } - if (setup_default_blist(conf)) - goto out; + if (conf->blist_property == NULL) { @@ -236,13 +236,13 @@ Index: multipath-tools-130222/libmultipath/config.c + if (!conf->blist_property) + goto out; + } - - if (conf->elist_devnode == NULL) { - conf->elist_devnode = vector_alloc(); + + if (conf->elist_devnode == NULL) { + conf->elist_devnode = vector_alloc(); @@ -802,6 +808,16 @@ load_config (char * file, struct udev *u - goto out; - } - + goto out; + } + + if (conf->elist_property == NULL) { + conf->elist_property = vector_alloc(); + @@ -253,84 +253,84 @@ Index: multipath-tools-130222/libmultipath/config.c + if (setup_default_blist(conf)) + goto out; + - if (conf->mptable == NULL) { - conf->mptable = vector_alloc(); - if (!conf->mptable) + if (conf->mptable == NULL) { + conf->mptable = vector_alloc(); + if (!conf->mptable) Index: multipath-tools-130222/libmultipath/config.h =================================================================== --- multipath-tools-130222.orig/libmultipath/config.h +++ multipath-tools-130222/libmultipath/config.h @@ -189,9 +189,11 @@ struct config { - vector blist_devnode; - vector blist_wwid; - vector blist_device; + vector blist_devnode; + vector blist_wwid; + vector blist_device; + vector blist_property; - vector elist_devnode; - vector elist_wwid; - vector elist_device; + vector elist_devnode; + vector elist_wwid; + vector elist_device; + vector elist_property; }; - + struct config * conf; Index: multipath-tools-130222/libmultipath/configure.c =================================================================== --- multipath-tools-130222.orig/libmultipath/configure.c +++ multipath-tools-130222/libmultipath/configure.c @@ -1027,6 +1027,10 @@ get_refwwid (char * dev, enum devtypes d - return ret; - } - } + return ret; + } + } + if (pp->udev && pp->uid_attribute && + filter_property(conf, pp->udev) > 0) + return 2; + - refwwid = pp->wwid; - goto out; - } + refwwid = pp->wwid; + goto out; + } @@ -1051,6 +1055,10 @@ get_refwwid (char * dev, enum devtypes d - return ret; - } - } + return ret; + } + } + if (pp->udev && pp->uid_attribute && + filter_property(conf, pp->udev) > 0) + return 2; + - refwwid = pp->wwid; - goto out; - } + refwwid = pp->wwid; + goto out; + } Index: multipath-tools-130222/libmultipath/dict.c =================================================================== --- multipath-tools-130222.orig/libmultipath/dict.c +++ multipath-tools-130222/libmultipath/dict.c @@ -1063,8 +1063,11 @@ blacklist_handler(vector strvec) - conf->blist_wwid = vector_alloc(); - if (!conf->blist_device) - conf->blist_device = vector_alloc(); + conf->blist_wwid = vector_alloc(); + if (!conf->blist_device) + conf->blist_device = vector_alloc(); + if (!conf->blist_property) + conf->blist_property = vector_alloc(); - + - if (!conf->blist_devnode || !conf->blist_wwid || !conf->blist_device) + if (!conf->blist_devnode || !conf->blist_wwid || + !conf->blist_device || !conf->blist_property) - return 1; - - return 0; + return 1; + + return 0; @@ -1079,8 +1082,11 @@ blacklist_exceptions_handler(vector strv - conf->elist_wwid = vector_alloc(); - if (!conf->elist_device) - conf->elist_device = vector_alloc(); + conf->elist_wwid = vector_alloc(); + if (!conf->elist_device) + conf->elist_device = vector_alloc(); + if (!conf->elist_property) + conf->elist_property = vector_alloc(); - + - if (!conf->elist_devnode || !conf->elist_wwid || !conf->elist_device) + if (!conf->elist_devnode || !conf->elist_wwid || + !conf->elist_device || !conf->elist_property) - return 1; - - return 0; + return 1; + + return 0; @@ -1139,6 +1145,32 @@ ble_except_wwid_handler(vector strvec) } - + static int +ble_property_handler(vector strvec) +{ @@ -360,44 +360,44 @@ Index: multipath-tools-130222/libmultipath/dict.c +static int ble_device_handler(vector strvec) { - return alloc_ble_device(conf->blist_device); + return alloc_ble_device(conf->blist_device); @@ -3903,6 +3935,7 @@ init_keywords(void) - install_keyword_root("blacklist", &blacklist_handler); - install_keyword_multi("devnode", &ble_devnode_handler, &snprint_ble_simple); - install_keyword_multi("wwid", &ble_wwid_handler, &snprint_ble_simple); + install_keyword_root("blacklist", &blacklist_handler); + 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("device", &ble_device_handler, NULL); - install_sublevel(); - install_keyword("vendor", &ble_vendor_handler, &snprint_bled_vendor); + install_keyword_multi("device", &ble_device_handler, NULL); + install_sublevel(); + install_keyword("vendor", &ble_vendor_handler, &snprint_bled_vendor); @@ -3911,6 +3944,7 @@ init_keywords(void) - install_keyword_root("blacklist_exceptions", &blacklist_exceptions_handler); - install_keyword_multi("devnode", &ble_except_devnode_handler, &snprint_ble_simple); - install_keyword_multi("wwid", &ble_except_wwid_handler, &snprint_ble_simple); + install_keyword_root("blacklist_exceptions", &blacklist_exceptions_handler); + 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("device", &ble_except_device_handler, NULL); - install_sublevel(); - install_keyword("vendor", &ble_except_vendor_handler, &snprint_bled_vendor); + 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/discovery.c =================================================================== --- multipath-tools-130222.orig/libmultipath/discovery.c +++ multipath-tools-130222/libmultipath/discovery.c @@ -1332,6 +1332,8 @@ pathinfo (struct path *pp, vector hwtabl - * limited by DI_BLACKLIST and occurs before this debug - * message with the mask value. - */ + * limited by DI_BLACKLIST and occurs before this debug + * message with the mask value. + */ + if (pp->udev && filter_property(conf, pp->udev) > 0) + return PATHINFO_SKIPPED; - if (filter_devnode(conf->blist_devnode, - conf->elist_devnode, - pp->dev) > 0) + if (filter_devnode(conf->blist_devnode, + conf->elist_devnode, + pp->dev) > 0) Index: multipath-tools-130222/libmultipath/print.c =================================================================== --- multipath-tools-130222.orig/libmultipath/print.c +++ multipath-tools-130222/libmultipath/print.c @@ -1415,6 +1415,19 @@ snprint_blacklist_report (char * buff, i - - if ((len - fwd - threshold) <= 0) - return len; + + if ((len - fwd - threshold) <= 0) + return len; + fwd += snprintf(buff + fwd, len - fwd, "udev property rules:\n" + "- blacklist:\n"); + if (!snprint_blacklist_group(buff, len, &fwd, &conf->blist_property)) @@ -411,13 +411,13 @@ Index: multipath-tools-130222/libmultipath/print.c + + 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) + fwd += snprintf(buff + fwd, len - fwd, "wwid rules:\n" + "- blacklist:\n"); + if (snprint_blacklist_group(buff, len, &fwd, &conf->blist_wwid) == 0) @@ -1480,6 +1493,15 @@ snprint_blacklist (char * buff, int len) - if (fwd > len) - return len; - } + if (fwd > len) + return len; + } + vector_foreach_slot (conf->blist_property, ble, i) { + kw = find_keyword(rootkw->sub, "property"); + if (!kw) @@ -427,13 +427,13 @@ Index: multipath-tools-130222/libmultipath/print.c + if (fwd > len) + return len; + } - rootkw = find_keyword(rootkw->sub, "device"); - if (!rootkw) - return 0; + rootkw = find_keyword(rootkw->sub, "device"); + if (!rootkw) + return 0; @@ -1544,6 +1566,15 @@ snprint_blacklist_except (char * buff, i - if (!kw) - return 0; - fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n", + if (!kw) + return 0; + fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n", + kw, ele); + if (fwd > len) + return len; @@ -443,9 +443,9 @@ Index: multipath-tools-130222/libmultipath/print.c + if (!kw) + return 0; + fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n", - kw, ele); - if (fwd > len) - return len; + kw, ele); + if (fwd > len) + return len; Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.conf.5 diff --git a/SOURCES/0233-RHBZ-1451852-1482629-nimble-config.patch b/SOURCES/0233-RHBZ-1451852-1482629-nimble-config.patch index 81753bc8..96c99855 100644 --- a/SOURCES/0233-RHBZ-1451852-1482629-nimble-config.patch +++ b/SOURCES/0233-RHBZ-1451852-1482629-nimble-config.patch @@ -7,14 +7,14 @@ Index: multipath-tools-130222/libmultipath/hwtable.c --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -1125,9 +1125,10 @@ static struct hwentry default_hw[] = { - .prio_name = PRIO_ALUA, - .prio_args = NULL, - .pgfailback = -FAILBACK_IMMEDIATE, + .prio_name = PRIO_ALUA, + .prio_args = NULL, + .pgfailback = -FAILBACK_IMMEDIATE, + .checker_name = TUR, - .selector = "round-robin 0", - .dev_loss = MAX_DEV_LOSS_TMO, + .selector = "round-robin 0", + .dev_loss = MAX_DEV_LOSS_TMO, - .fast_io_fail = 1, + .fast_io_fail = 5, - }, - { - .vendor = "XtremIO", + }, + { + .vendor = "XtremIO", diff --git a/SOURCES/0235-RHBZ-1480638-NVMe-support.patch b/SOURCES/0235-RHBZ-1480638-NVMe-support.patch index a807ad48..bf1d5800 100644 --- a/SOURCES/0235-RHBZ-1480638-NVMe-support.patch +++ b/SOURCES/0235-RHBZ-1480638-NVMe-support.patch @@ -1,12 +1,12 @@ --- libmultipath/checkers.c | 19 +++- - libmultipath/checkers.h | 3 + libmultipath/checkers.h | 3 libmultipath/discovery.c | 183 +++++++++++++++++++++++++++++++++++++++------ - libmultipath/discovery.h | 2 + libmultipath/discovery.h | 2 libmultipath/hwtable.c | 10 ++ - libmultipath/structs.h | 1 - libmultipath/uevent.c | 2 - multipath/multipath.conf.5 | 3 + libmultipath/structs.h | 1 + libmultipath/uevent.c | 2 + multipath/multipath.conf.5 | 3 multipathd/main.c | 27 ------ 9 files changed, 194 insertions(+), 56 deletions(-) @@ -19,12 +19,12 @@ Index: multipath-tools-130222/libmultipath/discovery.c #include #include +#include - + #include "checkers.h" #include "vector.h" @@ -881,6 +882,46 @@ scsi_sysfs_pathinfo (struct path * pp) } - + static int +nvme_sysfs_pathinfo (struct path * pp) +{ @@ -68,34 +68,34 @@ Index: multipath-tools-130222/libmultipath/discovery.c +static int rbd_sysfs_pathinfo (struct path * pp) { - sprintf(pp->vendor_id, "Ceph"); + sprintf(pp->vendor_id, "Ceph"); @@ -1040,14 +1081,20 @@ path_offline (struct path * pp) { - struct udev_device * parent; - char buff[SCSI_STATE_SIZE]; + struct udev_device * parent; + char buff[SCSI_STATE_SIZE]; + const char *subsys_type; - + - if (pp->bus != SYSFS_BUS_SCSI) + if (pp->bus == SYSFS_BUS_SCSI) + subsys_type = "scsi"; + else if (pp->bus == SYSFS_BUS_NVME) + subsys_type = "nvme"; + else - return PATH_UP; - - parent = pp->udev; - while (parent) { - const char *subsys = udev_device_get_subsystem(parent); + return PATH_UP; + + parent = pp->udev; + while (parent) { + const char *subsys = udev_device_get_subsystem(parent); - if (subsys && !strncmp(subsys, "scsi", 4)) + if (subsys && !strncmp(subsys, subsys_type, + strlen(subsys_type))) - break; - parent = udev_device_get_parent(parent); - } + break; + parent = udev_device_get_parent(parent); + } @@ -1063,15 +1110,30 @@ path_offline (struct path * pp) - - condlog(3, "%s: path state = %s", pp->dev, buff); - + + condlog(3, "%s: path state = %s", pp->dev, buff); + - if (!strncmp(buff, "offline", 7)) { - pp->offline = 1; - return PATH_DOWN; @@ -122,59 +122,59 @@ Index: multipath-tools-130222/libmultipath/discovery.c + return PATH_PENDING; + else if (!strncmp(buff, "live", 4)) + return PATH_UP; - } + } - pp->offline = 0; - if (!strncmp(buff, "blocked", 7) || !strncmp(buff, "quiesce", 7)) - return PATH_PENDING; - else if (!strncmp(buff, "running", 7)) - return PATH_UP; - - return PATH_DOWN; + + return PATH_DOWN; } @@ -1091,6 +1153,8 @@ sysfs_pathinfo(struct path * pp) - pp->bus = SYSFS_BUS_SCSI; - if (!strncmp(pp->dev,"rbd", 3)) - pp->bus = SYSFS_BUS_RBD; + 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; - - if (pp->bus == SYSFS_BUS_UNDEF) - return 0; + + if (pp->bus == SYSFS_BUS_UNDEF) + return 0; @@ -1106,6 +1170,9 @@ sysfs_pathinfo(struct path * pp) - } else if (pp->bus == SYSFS_BUS_RBD) { - if (rbd_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; - } - return 0; + } + return 0; } @@ -1132,7 +1199,7 @@ cciss_ioctl_pathinfo (struct path * pp, } - + int -get_state (struct path * pp, int daemon) +get_state (struct path * pp, int daemon, int oldstate) { - struct checker * c = &pp->checker; - int state; + struct checker * c = &pp->checker; + int state; @@ -1171,8 +1238,9 @@ get_state (struct path * pp, int daemon) - (pp->bus != SYSFS_BUS_SCSI || - sysfs_get_timeout(pp, &(c->timeout)))) - c->timeout = DEF_TIMEOUT; + (pp->bus != SYSFS_BUS_SCSI || + sysfs_get_timeout(pp, &(c->timeout)))) + c->timeout = DEF_TIMEOUT; - state = checker_check(c); - condlog(3, "%s: state = %s", pp->dev, checker_state_name(state)); + state = checker_check(c, oldstate); + condlog(3, "%s: %s state = %s", pp->dev, + checker_name(c), checker_state_name(state)); - if (state != PATH_UP && state != PATH_GHOST && - strlen(checker_message(c))) - condlog(3, "%s: checker msg is \"%s\"", + if (state != PATH_UP && state != PATH_GHOST && + strlen(checker_message(c))) + condlog(3, "%s: checker msg is \"%s\"", @@ -1256,6 +1324,82 @@ free_dev: - return ret; + return ret; } - + +/* + * Mangle string of length *len starting at start + * by removing character sequence "00" (hex for a 0 byte), @@ -255,41 +255,41 @@ Index: multipath-tools-130222/libmultipath/discovery.c get_uid (struct path * pp, struct udev_device *udev) { @@ -1287,14 +1431,10 @@ get_uid (struct path * pp, struct udev_d - conf->cmd == CMD_VALID_PATH) - value = getenv(pp->uid_attribute); - if (value && strlen(value)) { + conf->cmd == CMD_VALID_PATH) + value = getenv(pp->uid_attribute); + if (value && strlen(value)) { - size_t len = WWID_SIZE; - - if (strlen(value) + 1 > WWID_SIZE) { + 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(0, "%s: wwid overflow", pp->dev); - } else { - len = strlen(value); - } - strncpy(pp->wwid, value, len); - condlog(4, "%s: got wwid of '%s'", pp->dev, pp->wwid); - pp->missing_udev_info = INFO_OK; - pp->tick = 0; + condlog(4, "%s: got wwid of '%s'", pp->dev, pp->wwid); + pp->missing_udev_info = INFO_OK; + pp->tick = 0; @@ -1381,7 +1521,8 @@ pathinfo (struct path *pp, vector hwtabl - - if (mask & DI_CHECKER) { - if (path_state == PATH_UP) { + + if (mask & DI_CHECKER) { + if (path_state == PATH_UP) { - pp->chkrstate = pp->state = get_state(pp, 0); + pp->chkrstate = pp->state = get_state(pp, 0, + path_state); - if (pp->state == PATH_UNCHECKED || - pp->state == PATH_WILD) - goto blank; + if (pp->state == PATH_UNCHECKED || + pp->state == PATH_WILD) + goto blank; Index: multipath-tools-130222/libmultipath/hwtable.c =================================================================== --- multipath-tools-130222.orig/libmultipath/hwtable.c +++ multipath-tools-130222/libmultipath/hwtable.c @@ -1185,7 +1185,15 @@ static struct hwentry default_hw[] = { - .checker_name = RBD, - .deferred_remove = DEFERRED_REMOVE_ON, - }, + .checker_name = RBD, + .deferred_remove = DEFERRED_REMOVE_ON, + }, - + /* + * Generic NVMe devices @@ -300,94 +300,94 @@ Index: multipath-tools-130222/libmultipath/hwtable.c + .uid_attribute = "ID_WWN", + .checker_name = NONE, + }, - /* - * EOL - */ + /* + * EOL + */ Index: multipath-tools-130222/libmultipath/structs.h =================================================================== --- multipath-tools-130222.orig/libmultipath/structs.h +++ multipath-tools-130222/libmultipath/structs.h @@ -54,6 +54,7 @@ enum sysfs_buses { - SYSFS_BUS_CCW, - SYSFS_BUS_CCISS, - SYSFS_BUS_RBD, + SYSFS_BUS_CCW, + SYSFS_BUS_CCISS, + SYSFS_BUS_RBD, + SYSFS_BUS_NVME, }; - + enum pathstates { Index: multipath-tools-130222/libmultipath/checkers.c =================================================================== --- multipath-tools-130222.orig/libmultipath/checkers.c +++ multipath-tools-130222/libmultipath/checkers.c @@ -101,6 +101,8 @@ struct checker * add_checker (char * nam - if (!c) - return NULL; - snprintf(c->name, CHECKER_NAME_LEN, "%s", name); + if (!c) + return NULL; + snprintf(c->name, CHECKER_NAME_LEN, "%s", name); + if (!strncmp(c->name, NONE, 4)) + goto done; - snprintf(libname, LIB_CHECKER_NAMELEN, "%s/libcheck%s.so", - conf->multipath_dir, name); - if (stat(libname,&stbuf) < 0) { + snprintf(libname, LIB_CHECKER_NAMELEN, "%s/libcheck%s.so", + conf->multipath_dir, name); + if (stat(libname,&stbuf) < 0) { @@ -144,7 +146,7 @@ struct checker * add_checker (char * nam - condlog(0, "A dynamic linking error occurred: (%s)", errstr); - if (!c->repair) - goto out; + condlog(0, "A dynamic linking error occurred: (%s)", errstr); + if (!c->repair) + goto out; - +done: - c->fd = 0; - c->sync = 1; - list_add(&c->node, &checkers); + c->fd = 0; + c->sync = 1; + list_add(&c->node, &checkers); @@ -194,14 +196,16 @@ int checker_init (struct checker * c, vo - if (!c) - return 1; - c->mpcontext = mpctxt_addr; + if (!c) + return 1; + c->mpcontext = mpctxt_addr; - return c->init(c); + if (c->init) + return c->init(c); + return 0; } - + void checker_put (struct checker * dst) { - struct checker * src; - + struct checker * src; + - if (!dst) + if (!dst || !strlen(dst->name)) - return; - src = checker_lookup(dst->name); - if (dst->free) + return; + src = checker_lookup(dst->name); + if (dst->free) @@ -221,10 +225,11 @@ void checker_repair (struct checker * c) - return; - } - + return; + } + - c->repair(c); + if (c->repair) + c->repair(c); } - + -int checker_check (struct checker * c) +int checker_check (struct checker * c, int path_state) { - int r; - + int r; + @@ -236,6 +241,8 @@ int checker_check (struct checker * c) - MSG(c, "checker disabled"); - return PATH_UNCHECKED; - } + MSG(c, "checker disabled"); + return PATH_UNCHECKED; + } + if (!strncmp(c->name, NONE, 4)) + return path_state; - if (c->fd <= 0) { - MSG(c, "no usable fd"); - return PATH_WILD; + if (c->fd <= 0) { + MSG(c, "no usable fd"); + return PATH_WILD; @@ -249,6 +256,8 @@ int checker_selected (struct checker * c { - if (!c) - return 0; + if (!c) + return 0; + if (!strncmp(c->name, NONE, 4)) + return 1; - return (c->check) ? 1 : 0; + return (c->check) ? 1 : 0; } - + Index: multipath-tools-130222/libmultipath/checkers.h =================================================================== --- multipath-tools-130222.orig/libmultipath/checkers.h @@ -398,7 +398,7 @@ Index: multipath-tools-130222/libmultipath/checkers.h #define CCISS_TUR "cciss_tur" +#define NONE "none" #define RBD "rbd" - + #define DEFAULT_CHECKER DIRECTIO @@ -129,7 +130,7 @@ void checker_set_fd (struct checker *, i void checker_enable (struct checker *); @@ -414,27 +414,27 @@ Index: multipath-tools-130222/libmultipath/discovery.h --- multipath-tools-130222.orig/libmultipath/discovery.h +++ multipath-tools-130222/libmultipath/discovery.h @@ -35,7 +35,7 @@ int path_discovery (vector pathvec, stru - + int do_tur (char *); int path_offline (struct path *); -int get_state (struct path * pp, int daemon); +int get_state (struct path * pp, int daemon, int state); int pathinfo (struct path *, vector hwtable, int mask); int store_pathinfo (vector pathvec, vector hwtable, - struct udev_device *udevice, int flag, + struct udev_device *udevice, int flag, Index: multipath-tools-130222/libmultipath/uevent.c =================================================================== --- multipath-tools-130222.orig/libmultipath/uevent.c +++ multipath-tools-130222/libmultipath/uevent.c @@ -447,7 +447,7 @@ int uevent_listen(struct udev *udev) - goto out; - } - err = udev_monitor_filter_add_match_subsystem_devtype(monitor, "block", + goto out; + } + err = udev_monitor_filter_add_match_subsystem_devtype(monitor, "block", - NULL); + "disk"); - if (err) - condlog(2, "failed to create filter : %s", strerror(-err)); - err = udev_monitor_enable_receiving(monitor); + if (err) + condlog(2, "failed to create filter : %s", strerror(-err)); + err = udev_monitor_enable_receiving(monitor); Index: multipath-tools-130222/multipath/multipath.conf.5 =================================================================== --- multipath-tools-130222.orig/multipath/multipath.conf.5 @@ -454,9 +454,9 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -908,28 +908,6 @@ out: - return r; + return r; } - + -static int -uev_discard(char * devpath) -{ @@ -483,20 +483,21 @@ Index: multipath-tools-130222/multipathd/main.c uev_trigger (struct uevent * uev, void * trigger_data) { @@ -938,9 +916,6 @@ uev_trigger (struct uevent * uev, void * - - vecs = (struct vectors *)trigger_data; - + + vecs = (struct vectors *)trigger_data; + - if (uev_discard(uev->devpath)) - return 0; - - pthread_cleanup_push(cleanup_lock, &vecs->lock); - lock(vecs->lock); - pthread_testcancel(); + pthread_cleanup_push(cleanup_lock, &vecs->lock); + lock(vecs->lock); + pthread_testcancel(); @@ -1358,7 +1333,7 @@ check_path (struct vectors * vecs, struc - - newstate = path_offline(pp); - if (newstate == PATH_UP) + + newstate = path_offline(pp); + if (newstate == PATH_UP) - newstate = get_state(pp, 1); + newstate = get_state(pp, 1, newstate); - else - checker_clear_message(&pp->checker); + else + checker_clear_message(&pp->checker); + diff --git a/SOURCES/0236-RHBZ-1525348-fix-msg.patch b/SOURCES/0236-RHBZ-1525348-fix-msg.patch index 2a479a3b..04f9fe7d 100644 --- a/SOURCES/0236-RHBZ-1525348-fix-msg.patch +++ b/SOURCES/0236-RHBZ-1525348-fix-msg.patch @@ -7,11 +7,11 @@ Index: multipath-tools-130222/multipathd/main.c --- multipath-tools-130222.orig/multipathd/main.c +++ multipath-tools-130222/multipathd/main.c @@ -471,7 +471,7 @@ uev_add_path (struct uevent *uev, struct - - pp = find_path_by_dev(vecs->pathvec, uev->kernel); - if (pp) { + + pp = find_path_by_dev(vecs->pathvec, uev->kernel); + if (pp) { - condlog(0, "%s: spurious uevent, path already in pathvec", + condlog(2, "%s: spurious uevent, path already in pathvec", - uev->kernel); - if (pp->mpp) - return 0; + uev->kernel); + if (pp->mpp) + return 0;