device-mapper-multipath-0.7.7-1

Update Source to 0.7.7
  * Previous patches 0001-0009 & 0018 are included in this commit
Add upstream patches since 0.7.7
  * patches 0001-0012 are from upstream commits since 0.7.7
Add 0015-mpathpersist-add-all_tg_pt-option.patch
  * add new all_tg_pt multpiath.conf option. posted upstream
Add 0016-libmultipath-remove-rbd-code.patch
  * remove unused rbd code. posted upstream
Add 0017-mpathpersist-fix-aptpl-support.patch
  * add ":aptpl" suffix for reservation_key to fix aptpl support.
    posted upstream
Add 0018-multipath-don-t-check-timestamps-without-a-path.patch
  * fix multipath null dereference crash. posted upstream
Add 0019-libmultipath-fix-detect-alua-corner-case.patch
  * fix alua detection with retain_hardware_handler set to off. posted
    upstream
Add 0020-multipath-fix-setting-conf-version.patch
  * multipath wasn't setting the kernel version correctly. posted
    upstream
Add 0028-RH-reset-default-find_mutipaths-value-to-off.patch
  * default to RHEL7 and older device detection style. Redhat specific,
    to keep customer experience the same.
Rename files
  * Previous patches 0010-0011 are now patches 0013-0014
  * Previous patches 0012-0017 & 0019 are now patches 0021-0027
Modify 0021-RH-fixup-udev-rules-for-redhat.patch
  * Fix spurious compile warning with redhat compile options
This commit is contained in:
Benjamin Marzinski 2018-06-12 14:11:55 -05:00
parent b8e90c4bbc
commit 64b1cb0e21
41 changed files with 3757 additions and 1000 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ multipath-tools-091027.tar.gz
/multipath-tools-0.7.3.tgz /multipath-tools-0.7.3.tgz
/multipath-tools-07e7bd5.tgz /multipath-tools-07e7bd5.tgz
/multipath-tools-1cb704b.tgz /multipath-tools-1cb704b.tgz
/multipath-tools-0.7.7.tgz

View File

@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Wed, 11 Apr 2018 15:14:13 +0200
Subject: [PATCH] multipath-tools: add RDAC SUN/ArrayStorage to hwtable
Already in scsi_dh: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/scsi/scsi_dh.c#n70
Cc: NetApp RDAC team <ng-eseries-upstream-maintainers@netapp.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 88b4700..827e899 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -890,6 +890,18 @@ static struct hwentry default_hw[] = {
.no_path_retry = 30,
},
{
+ .vendor = "SUN",
+ .product = "ArrayStorage",
+ .bl_product = "Universal Xport",
+ .pgpolicy = GROUP_BY_PRIO,
+ .checker_name = RDAC,
+ .features = "2 pg_init_retries 50",
+ .hwhandler = "1 rdac",
+ .prio_name = PRIO_RDAC,
+ .pgfailback = -FAILBACK_IMMEDIATE,
+ .no_path_retry = 30,
+ },
+ {
/* ZFS Storage Appliances */
.vendor = "SUN",
.product = "(Sun Storage|ZFS Storage|COMSTAR)",
--
2.7.4

View File

@ -1,30 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 28 Mar 2018 16:47:05 -0500
Subject: [PATCH] multipathd: remove incorrect pthread_testcancel
As Martin Wilck pointed out, a thread that's trying to stop the waiter
thread should not cancel itself before it gets a chance to do so
Cc: Martin Wilck <mwilck@suse.com>
Fixes: c7625f92 "multipathd: fix waiter thread cancelling"
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/waiter.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/multipathd/waiter.c b/multipathd/waiter.c
index 595c69a..0ef8b25 100644
--- a/multipathd/waiter.c
+++ b/multipathd/waiter.c
@@ -68,7 +68,6 @@ void stop_waiter_thread (struct multipath *mpp, struct vectors *vecs)
mpp->waiter = (pthread_t)0;
pthread_cleanup_push(cleanup_lock, &waiter_lock);
lock(&waiter_lock);
- pthread_testcancel();
pthread_kill(thread, SIGUSR2);
pthread_cancel(thread);
lock_cleanup_pop(&waiter_lock);
--
2.7.4

View File

@ -1,389 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 29 Mar 2018 12:07:11 -0500
Subject: [PATCH] multipath: add comments
This commit simply adds a number of comments based on suggestions by
Martin Wilck.
Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/dmevents.c | 4 ++-
tests/dmevents.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++-
tests/util.c | 2 ++
3 files changed, 76 insertions(+), 2 deletions(-)
diff --git a/multipathd/dmevents.c b/multipathd/dmevents.c
index 2281a10..0b0d0ce 100644
--- a/multipathd/dmevents.c
+++ b/multipathd/dmevents.c
@@ -122,6 +122,8 @@ static int arm_dm_event_poll(int fd)
dmi.version[0] = DM_VERSION_MAJOR;
dmi.version[1] = DM_VERSION_MINOR;
dmi.version[2] = DM_VERSION_PATCHLEVEL;
+ /* This flag currently does nothing. It simply exists to
+ * duplicate the behavior of libdevmapper */
dmi.flags = 0x4;
dmi.data_start = offsetof(struct dm_ioctl, data);
dmi.data_size = sizeof(dmi);
@@ -189,7 +191,7 @@ fail:
return -1;
}
-/* You must call update_multipath() after calling this function, to
+/* You must call __setup_multipath() after calling this function, to
* deal with any events that came in before the device was added */
int watch_dmevents(char *name)
{
diff --git a/tests/dmevents.c b/tests/dmevents.c
index 4442fc2..bba51dc 100644
--- a/tests/dmevents.c
+++ b/tests/dmevents.c
@@ -33,10 +33,13 @@
/* I have to do this to get at the static variables */
#include "../multipathd/dmevents.c"
+/* pretend dm device */
struct dm_device {
char name[WWID_SIZE];
+ /* is this a mpath device, or other dm device */
int is_mpath;
uint32_t evt_nr;
+ /* tracks the event number when the multipath device was updated */
uint32_t update_nr;
};
@@ -48,6 +51,9 @@ struct test_data {
struct test_data data;
+/* Add a pretend dm device, or update its event number. This is used to build
+ * up the dm devices that the dmevents code queries with dm_task_get_names,
+ * dm_geteventnr, and dm_is_mpath */
int add_dm_device_event(char *name, int is_mpath, uint32_t evt_nr)
{
struct dm_device *dev;
@@ -77,6 +83,7 @@ int add_dm_device_event(char *name, int is_mpath, uint32_t evt_nr)
return 0;
}
+/* helper function for pretend dm devices */
struct dm_device *find_dm_device(const char *name)
{
struct dm_device *dev;
@@ -88,6 +95,7 @@ struct dm_device *find_dm_device(const char *name)
return NULL;
}
+/* helper function for pretend dm devices */
int remove_dm_device_event(const char *name)
{
struct dm_device *dev;
@@ -103,6 +111,7 @@ int remove_dm_device_event(const char *name)
return -1;
}
+/* helper function for pretend dm devices */
void remove_all_dm_device_events(void)
{
struct dm_device *dev;
@@ -122,7 +131,9 @@ static inline void *align_ptr(void *ptr)
return (void *)align_val((size_t)ptr);
}
-/* copied off of list_devices in dm-ioctl.c */
+/* copied off of list_devices in dm-ioctl.c except that it uses
+ * the pretend dm devices, and saves the output to the test_data
+ * structure */
struct dm_names *build_dm_names(void)
{
struct dm_names *names, *np, *old_np = NULL;
@@ -199,12 +210,16 @@ int __wrap_open(const char *pathname, int flags)
return mock_type(int);
}
+/* We never check the result of the close(), so there's no need to
+ * to mock a return value */
int __wrap_close(int fd)
{
assert_int_equal(fd, waiter->fd);
return 0;
}
+/* the pretend dm device code checks the input and supplies the
+ * return value, so there's no need to do that here */
int __wrap_dm_is_mpath(const char *name)
{
struct dm_device *dev;
@@ -216,6 +231,8 @@ int __wrap_dm_is_mpath(const char *name)
return 0;
}
+/* either get return info from the pretend dm device, or
+ * override it to test -1 return */
int __wrap_dm_geteventnr(const char *name)
{
struct dm_device *dev;
@@ -257,6 +274,8 @@ int __wrap_dm_task_run(struct dm_task *dmt)
return mock_type(int);
}
+/* either get return info from the pretend dm device, or
+ * override it to test NULL return */
struct dm_names * __wrap_dm_task_get_names(struct dm_task *dmt)
{
int good = mock_type(int);
@@ -299,6 +318,9 @@ void __wrap_remove_map_by_alias(const char *alias, struct vectors * vecs,
assert_int_equal(purge_vec, 1);
}
+/* pretend update the pretend dm devices. If fail is set, it
+ * simulates having the dm device removed. Otherwise it just sets
+ * update_nr to record when the update happened */
int __wrap_update_multipath(struct vectors *vecs, char *mapname, int reset)
{
int fail;
@@ -325,6 +347,9 @@ int __wrap_update_multipath(struct vectors *vecs, char *mapname, int reset)
return fail;
}
+/* helper function used to check if the dmevents list of devices
+ * includes a specific device. To make sure that dmevents is
+ * in the correct state after running a function */
struct dev_event *find_dmevents(const char *name)
{
struct dev_event *dev_evt;
@@ -336,14 +361,19 @@ struct dev_event *find_dmevents(const char *name)
return NULL;
}
+/* null vecs pointer when initialized dmevents */
static void test_init_waiter_bad0(void **state)
{
+ /* this boilerplate code just skips the test if
+ * dmevents polling is not supported */
struct test_data *datap = (struct test_data *)(*state);
if (datap == NULL)
skip();
+
assert_int_equal(init_dmevent_waiter(NULL), -1);
}
+/* fail to open /dev/mapper/control */
static void test_init_waiter_bad1(void **state)
{
struct test_data *datap = (struct test_data *)(*state);
@@ -354,6 +384,7 @@ static void test_init_waiter_bad1(void **state)
assert_ptr_equal(waiter, NULL);
}
+/* waiter remains initialized after this test */
static void test_init_waiter_good0(void **state)
{
struct test_data *datap = (struct test_data *)(*state);
@@ -364,6 +395,7 @@ static void test_init_waiter_good0(void **state)
assert_ptr_not_equal(waiter, NULL);
}
+/* No dm device named foo */
static void test_watch_dmevents_bad0(void **state)
{
struct test_data *datap = (struct test_data *)(*state);
@@ -373,6 +405,7 @@ static void test_watch_dmevents_bad0(void **state)
assert_ptr_equal(find_dmevents("foo"), NULL);
}
+/* foo is not a multipath device */
static void test_watch_dmevents_bad1(void **state)
{
struct test_data *datap = (struct test_data *)(*state);
@@ -384,6 +417,7 @@ static void test_watch_dmevents_bad1(void **state)
assert_ptr_equal(find_dmevents("foo"), NULL);
}
+/* failed getting the dmevent number */
static void test_watch_dmevents_bad2(void **state)
{
struct test_data *datap = (struct test_data *)(*state);
@@ -396,6 +430,8 @@ static void test_watch_dmevents_bad2(void **state)
assert_int_equal(watch_dmevents("foo"), -1);
assert_ptr_equal(find_dmevents("foo"), NULL);
}
+
+/* verify that you can watch and unwatch dm multipath device "foo" */
static void test_watch_dmevents_good0(void **state)
{
struct dev_event *dev_evt;
@@ -407,16 +443,20 @@ static void test_watch_dmevents_good0(void **state)
assert_int_equal(add_dm_device_event("foo", 1, 5), 0);
will_return(__wrap_dm_geteventnr, 0);
assert_int_equal(watch_dmevents("foo"), 0);
+ /* verify foo is being watched */
dev_evt = find_dmevents("foo");
assert_ptr_not_equal(dev_evt, NULL);
assert_int_equal(dev_evt->evt_nr, 5);
assert_int_equal(dev_evt->action, EVENT_NOTHING);
assert_int_equal(VECTOR_SIZE(waiter->events), 1);
unwatch_dmevents("foo");
+ /* verify foo is no longer being watched */
assert_int_equal(VECTOR_SIZE(waiter->events), 0);
assert_ptr_equal(find_dmevents("foo"), NULL);
}
+/* verify that if you try to watch foo multiple times, it only
+ * is placed on the waiter list once */
static void test_watch_dmevents_good1(void **state)
{
struct dev_event *dev_evt;
@@ -445,6 +485,7 @@ static void test_watch_dmevents_good1(void **state)
assert_ptr_equal(find_dmevents("foo"), NULL);
}
+/* watch and then unwatch multiple devices */
static void test_watch_dmevents_good2(void **state)
{
struct dev_event *dev_evt;
@@ -480,6 +521,7 @@ static void test_watch_dmevents_good2(void **state)
assert_ptr_equal(find_dmevents("bar"), NULL);
}
+/* dm_task_create fails */
static void test_get_events_bad0(void **state)
{
struct test_data *datap = (struct test_data *)(*state);
@@ -493,6 +535,7 @@ static void test_get_events_bad0(void **state)
assert_int_equal(dm_get_events(), -1);
}
+/* dm_task_run fails */
static void test_get_events_bad1(void **state)
{
struct test_data *datap = (struct test_data *)(*state);
@@ -505,6 +548,7 @@ static void test_get_events_bad1(void **state)
assert_int_equal(dm_get_events(), -1);
}
+/* dm_task_get_names fails */
static void test_get_events_bad2(void **state)
{
struct test_data *datap = (struct test_data *)(*state);
@@ -518,6 +562,7 @@ static void test_get_events_bad2(void **state)
assert_int_equal(dm_get_events(), -1);
}
+/* If the device isn't being watched, dm_get_events returns NULL */
static void test_get_events_good0(void **state)
{
struct test_data *datap = (struct test_data *)(*state);
@@ -534,6 +579,11 @@ static void test_get_events_good0(void **state)
assert_int_equal(VECTOR_SIZE(waiter->events), 0);
}
+/* There are 5 dm devices. 4 of them are multipath devices.
+ * Only 3 of them are being watched. "foo" has a new event
+ * "xyzzy" gets removed. Nothing happens to bar. Verify
+ * that all the events are properly set, and that nothing
+ * happens with the two devices that aren't being watched */
static void test_get_events_good1(void **state)
{
struct dev_event *dev_evt;
@@ -577,6 +627,8 @@ static void test_get_events_good1(void **state)
assert_int_equal(VECTOR_SIZE(waiter->events), 3);
}
+/* poll does not return an event. nothing happens. The
+ * devices remain after this test */
static void test_dmevent_loop_bad0(void **state)
{
struct dm_device *dev;
@@ -603,6 +655,7 @@ static void test_dmevent_loop_bad0(void **state)
assert_int_equal(dev->update_nr, 5);
}
+/* arm_dm_event_poll's ioctl fails. Nothing happens */
static void test_dmevent_loop_bad1(void **state)
{
struct dm_device *dev;
@@ -624,6 +677,7 @@ static void test_dmevent_loop_bad1(void **state)
assert_int_equal(dev->update_nr, 5);
}
+/* dm_get_events fails. Nothing happens */
static void test_dmevent_loop_bad2(void **state)
{
struct dm_device *dev;
@@ -646,6 +700,8 @@ static void test_dmevent_loop_bad2(void **state)
assert_int_equal(dev->update_nr, 5);
}
+/* verify dmevent_loop runs successfully when no devices are being
+ * watched */
static void test_dmevent_loop_good0(void **state)
{
struct test_data *datap = (struct test_data *)(*state);
@@ -663,6 +719,11 @@ static void test_dmevent_loop_good0(void **state)
assert_int_equal(dmevent_loop(), 1);
}
+/* Watch 3 devices, where one device has an event (foo), one device is
+ * removed (xyzzy), and one device does nothing (bar). Verify that
+ * the device with the event gets updated, the device that is removed
+ * gets unwatched, and the device with no events stays the same.
+ * The devices remain after this test */
static void test_dmevent_loop_good1(void **state)
{
struct dm_device *dev;
@@ -717,6 +778,10 @@ static void test_dmevent_loop_good1(void **state)
assert_ptr_equal(find_dm_device("xyzzy"), NULL);
}
+/* watch another dm device and add events to two of them, so bar and
+ * baz have new events, and foo doesn't. Set update_multipath to
+ * fail for baz. Verify that baz is unwatched, bar is updated, and
+ * foo stays the same. */
static void test_dmevent_loop_good2(void **state)
{
struct dm_device *dev;
@@ -762,6 +827,8 @@ static void test_dmevent_loop_good2(void **state)
assert_ptr_equal(find_dm_device("baz"), NULL);
}
+/* remove dm device foo, and unwatch events on bar. Verify that
+ * foo is cleaned up and unwatched, and bar is no longer updated */
static void test_dmevent_loop_good3(void **state)
{
struct dm_device *dev;
@@ -790,6 +857,8 @@ static void test_dmevent_loop_good3(void **state)
assert_ptr_equal(find_dm_device("foo"), NULL);
}
+
+/* verify that rearming the dmevents polling works */
static void test_arm_poll(void **state)
{
struct test_data *datap = (struct test_data *)(*state);
@@ -799,6 +868,7 @@ static void test_arm_poll(void **state)
assert_int_equal(arm_dm_event_poll(waiter->fd), 0);
}
+/* verify that the waiter is cleaned up */
static void test_cleanup_waiter(void **state)
{
struct test_data *datap = (struct test_data *)(*state);
diff --git a/tests/util.c b/tests/util.c
index e9a004f..113b134 100644
--- a/tests/util.c
+++ b/tests/util.c
@@ -74,6 +74,8 @@ static void test_basenamecpy_good5(void **state)
assert_string_equal(dst, "bar");
}
+/* multipath expects any trailing whitespace to be stripped off the basename,
+ * so that it will match pp->dev */
static void test_basenamecpy_good6(void **state)
{
char dst[6];
--
2.7.4

View File

@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Tue, 24 Apr 2018 15:03:40 +0200
Subject: [PATCH] multipath-tools: remove "c" from __cpluscplus, misspelled
found by cppcheck(http://cppcheck.sf.net/):
[libmpathcmd/mpath_cmd.h:24]: (error) Invalid number of character '{' when these macros are defined: '__cpluscplus'.
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathcmd/mpath_cmd.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmpathcmd/mpath_cmd.h b/libmpathcmd/mpath_cmd.h
index aaa8da9..df9d938 100644
--- a/libmpathcmd/mpath_cmd.h
+++ b/libmpathcmd/mpath_cmd.h
@@ -20,7 +20,7 @@
#ifndef LIB_MPATH_CMD_H
#define LIB_MPATH_CMD_H
-#ifdef __cpluscplus
+#ifdef __cplusplus
extern "C" {
#endif
--
2.7.4

View File

@ -0,0 +1,43 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Thu, 12 Apr 2018 18:17:13 +0200
Subject: [PATCH] multipath-tools: remove emacs autoconfig of kpartx/gpt.h
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
kpartx/gpt.h | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/kpartx/gpt.h b/kpartx/gpt.h
index 66ce8f1..7bb54b7 100644
--- a/kpartx/gpt.h
+++ b/kpartx/gpt.h
@@ -109,22 +109,3 @@ int read_gpt_pt (int fd, struct slice all, struct slice *sp, int ns);
#endif
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only. This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-indent-level: 4
- * c-brace-imaginary-offset: 0
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * c-continued-statement-offset: 4
- * c-continued-brace-offset: 0
- * indent-tabs-mode: nil
- * tab-width: 8
- * End:
- */
--
2.7.4

View File

@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 29 Mar 2018 12:48:08 -0500
Subject: [PATCH] multipathd: minor dmevents polling code cleanups
Change strncpy to strlcpy and lock_cleanup_pop to pthread_cleanup_pop,
based on suggestions by Martin Wilck
Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/dmevents.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/multipathd/dmevents.c b/multipathd/dmevents.c
index 0b0d0ce..e98a974 100644
--- a/multipathd/dmevents.c
+++ b/multipathd/dmevents.c
@@ -24,6 +24,7 @@
#include "debug.h"
#include "main.h"
#include "dmevents.h"
+#include "util.h"
#ifndef DM_DEV_ARM_POLL
#define DM_DEV_ARM_POLL _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD + 1, struct dm_ioctl)
@@ -214,8 +215,7 @@ int watch_dmevents(char *name)
return -1;
}
- strncpy(dev_evt->name, name, WWID_SIZE);
- dev_evt->name[WWID_SIZE - 1] = 0;
+ strlcpy(dev_evt->name, name, WWID_SIZE);
dev_evt->evt_nr = event_nr;
dev_evt->action = EVENT_NOTHING;
@@ -350,7 +350,7 @@ static int dmevent_loop (void)
remove_map_by_alias(curr_dev.name, waiter->vecs, 1);
else
r = update_multipath(waiter->vecs, curr_dev.name, 1);
- lock_cleanup_pop(&waiter->vecs->lock);
+ pthread_cleanup_pop(1);
if (r) {
condlog(2, "%s: stopped watching dmevents",
--
2.7.4

View File

@ -0,0 +1,191 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Fri, 11 May 2018 15:42:43 +0200
Subject: [PATCH] multipath-tools: replace FSF address with a www pointer
Less prone to future modifications, new FSF licences
point exactly to this url: <http://www.gnu.org/licenses/>.
And sending a smail to FSF is outdated.
First clean up was done in 5619a39c433ac3d10a88079593cec1aa6472cbeb
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/dm-generic.c | 4 +---
libmultipath/dm-generic.h | 4 +---
libmultipath/foreign.c | 4 +---
libmultipath/foreign.h | 4 +---
libmultipath/foreign/nvme.c | 4 +---
libmultipath/generic.c | 4 +---
libmultipath/generic.h | 4 +---
tests/dmevents.c | 2 +-
tests/parser.c | 2 +-
tests/uevent.c | 2 +-
tests/util.c | 2 +-
11 files changed, 11 insertions(+), 25 deletions(-)
diff --git a/libmultipath/dm-generic.c b/libmultipath/dm-generic.c
index bdc9ca0..d752991 100644
--- a/libmultipath/dm-generic.c
+++ b/libmultipath/dm-generic.c
@@ -12,9 +12,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdint.h>
diff --git a/libmultipath/dm-generic.h b/libmultipath/dm-generic.h
index 5d59724..986429f 100644
--- a/libmultipath/dm-generic.h
+++ b/libmultipath/dm-generic.h
@@ -12,9 +12,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef _DM_GENERIC_H
#define _DM_GENERIC_H
diff --git a/libmultipath/foreign.c b/libmultipath/foreign.c
index 7217184..80b399b 100644
--- a/libmultipath/foreign.c
+++ b/libmultipath/foreign.c
@@ -12,9 +12,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <sys/sysmacros.h>
diff --git a/libmultipath/foreign.h b/libmultipath/foreign.h
index 973f368..697f12f 100644
--- a/libmultipath/foreign.h
+++ b/libmultipath/foreign.h
@@ -12,9 +12,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef _FOREIGN_H
#define _FOREIGN_H
diff --git a/libmultipath/foreign/nvme.c b/libmultipath/foreign/nvme.c
index 235f75d..280b6bd 100644
--- a/libmultipath/foreign/nvme.c
+++ b/libmultipath/foreign/nvme.c
@@ -12,9 +12,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <sys/sysmacros.h>
diff --git a/libmultipath/generic.c b/libmultipath/generic.c
index 6f7a2cd..0d1e632 100644
--- a/libmultipath/generic.c
+++ b/libmultipath/generic.c
@@ -12,9 +12,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
diff --git a/libmultipath/generic.h b/libmultipath/generic.h
index 7f7fe66..6346ffe 100644
--- a/libmultipath/generic.h
+++ b/libmultipath/generic.h
@@ -12,9 +12,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef _GENERIC_H
#define _GENERIC_H
diff --git a/tests/dmevents.c b/tests/dmevents.c
index bba51dc..3399c81 100644
--- a/tests/dmevents.c
+++ b/tests/dmevents.c
@@ -12,7 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
diff --git a/tests/parser.c b/tests/parser.c
index a7e7598..29859da 100644
--- a/tests/parser.c
+++ b/tests/parser.c
@@ -12,7 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
diff --git a/tests/uevent.c b/tests/uevent.c
index acfcb14..b0d0bfd 100644
--- a/tests/uevent.c
+++ b/tests/uevent.c
@@ -12,7 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
diff --git a/tests/util.c b/tests/util.c
index 113b134..839effd 100644
--- a/tests/util.c
+++ b/tests/util.c
@@ -12,7 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
--
2.7.4

View File

@ -1,83 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 29 Mar 2018 14:01:30 -0500
Subject: [PATCH] multipathd: remove unneeded function parameter
remove_map_and_stop_waiter was always called with purge_vecs = 1, so
it can simply be removed, as suggested by Martin Wilck
Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 9a4f671..841d3e9 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -311,14 +311,13 @@ wait_for_events(struct multipath *mpp, struct vectors *vecs)
}
static void
-remove_map_and_stop_waiter(struct multipath *mpp, struct vectors *vecs,
- int purge_vec)
+remove_map_and_stop_waiter(struct multipath *mpp, struct vectors *vecs)
{
/* devices are automatically removed by the dmevent polling code,
* so they don't need to be manually removed here */
if (!poll_dmevents)
stop_waiter_thread(mpp, vecs);
- remove_map(mpp, vecs, purge_vec);
+ remove_map(mpp, vecs, PURGE_VEC);
}
static void
@@ -400,7 +399,7 @@ int __setup_multipath(struct vectors *vecs, struct multipath *mpp,
return 0;
out:
- remove_map_and_stop_waiter(mpp, vecs, PURGE_VEC);
+ remove_map_and_stop_waiter(mpp, vecs);
return 1;
}
@@ -637,7 +636,7 @@ flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths)
}
orphan_paths(vecs->pathvec, mpp);
- remove_map_and_stop_waiter(mpp, vecs, 1);
+ remove_map_and_stop_waiter(mpp, vecs);
return 0;
}
@@ -769,7 +768,7 @@ uev_remove_map (struct uevent * uev, struct vectors * vecs)
}
orphan_paths(vecs->pathvec, mpp);
- remove_map_and_stop_waiter(mpp, vecs, 1);
+ remove_map_and_stop_waiter(mpp, vecs);
out:
lock_cleanup_pop(vecs->lock);
FREE(alias);
@@ -1154,7 +1153,7 @@ out:
return retval;
fail:
- remove_map_and_stop_waiter(mpp, vecs, 1);
+ remove_map_and_stop_waiter(mpp, vecs);
return 1;
}
@@ -1612,7 +1611,7 @@ mpvec_garbage_collector (struct vectors * vecs)
vector_foreach_slot (vecs->mpvec, mpp, i) {
if (mpp && mpp->alias && !dm_map_present(mpp->alias)) {
condlog(2, "%s: remove dead map", mpp->alias);
- remove_map_and_stop_waiter(mpp, vecs, 1);
+ remove_map_and_stop_waiter(mpp, vecs);
i--;
}
}
--
2.7.4

View File

@ -1,58 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 29 Mar 2018 15:00:12 -0500
Subject: [PATCH] mpathcmd: fix libmpathcmd license
There is no version 2 of the GNU Lesser General Public License, so
change the license header to version 2.1, which does exist. Also copy
the license header to mpath_cmd.c.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathcmd/mpath_cmd.c | 19 +++++++++++++++++++
libmpathcmd/mpath_cmd.h | 2 +-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/libmpathcmd/mpath_cmd.c b/libmpathcmd/mpath_cmd.c
index 29d148c..61e6a98 100644
--- a/libmpathcmd/mpath_cmd.c
+++ b/libmpathcmd/mpath_cmd.c
@@ -1,3 +1,22 @@
+/*
+ * Copyright (C) 2015 Red Hat, Inc.
+ *
+ * This file is part of the device-mapper multipath userspace tools.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
diff --git a/libmpathcmd/mpath_cmd.h b/libmpathcmd/mpath_cmd.h
index b57b708..aaa8da9 100644
--- a/libmpathcmd/mpath_cmd.h
+++ b/libmpathcmd/mpath_cmd.h
@@ -5,7 +5,7 @@
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2
+ * as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
--
2.7.4

View File

@ -0,0 +1,156 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Fri, 11 May 2018 15:43:11 +0200
Subject: [PATCH] multipath-tools: Remove trailing/leading whitespaces and
reformat code
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 23 +++++++++++------------
kpartx/mac.h | 2 +-
kpartx/test-kpartx | 2 +-
libmpathcmd/Makefile | 2 +-
libmultipath/hwtable.c | 14 +++++++-------
libmultipath/print.h | 2 +-
multipathd/main.h | 6 +++---
7 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 57a1835..af2f5ba 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -103,21 +103,20 @@ LDFLAGS = -Wl,-z,relro -Wl,-z,now
BIN_LDFLAGS = -pie
# Check whether a function with name $1 has been declared in header file $2.
-check_func = \
- $(shell \
+check_func = $(shell \
if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
- found=1; \
- status="yes"; \
- else \
- found=0; \
- status="no"; \
- fi; \
- echo 1>&2 "Checking for $1 in $2 ... $$status"; \
- echo "$$found" \
- )
+ found=1; \
+ status="yes"; \
+ else \
+ found=0; \
+ status="no"; \
+ fi; \
+ echo 1>&2 "Checking for $1 in $2 ... $$status"; \
+ echo "$$found" \
+ )
# Checker whether a file with name $1 exists
-check_file = $(shell \
+check_file = $(shell \
if [ -f "$1" ]; then \
found=1; \
status="yes"; \
diff --git a/kpartx/mac.h b/kpartx/mac.h
index a44cf38..55c3ec9 100644
--- a/kpartx/mac.h
+++ b/kpartx/mac.h
@@ -24,7 +24,7 @@ struct mac_driver_desc {
uint16_t signature; /* expected to be MAC_DRIVER_MAGIC */
uint16_t block_size;
uint32_t block_count;
- /* ... more stuff */
+ /* ... more stuff */
};
#endif
diff --git a/kpartx/test-kpartx b/kpartx/test-kpartx
index 9cee20f..d2001dc 100755
--- a/kpartx/test-kpartx
+++ b/kpartx/test-kpartx
@@ -131,7 +131,7 @@ step "create DM devices (spans)"
# They also serve as DM devices to test partition removal on those.
TABLE="\
-0 $((SIZE/SECTSIZ-OFFS)) linear $DEV1 $OFFS
+0 $((SIZE/SECTSIZ-OFFS)) linear $DEV1 $OFFS
$((SIZE/SECTSIZ-OFFS)) $((SIZE/SECTSIZ-OFFS)) linear $DEV2 $OFFS"
SPAN1=kpt
diff --git a/libmpathcmd/Makefile b/libmpathcmd/Makefile
index 53c0899..0f6b816 100644
--- a/libmpathcmd/Makefile
+++ b/libmpathcmd/Makefile
@@ -27,7 +27,7 @@ uninstall:
$(RM) $(DESTDIR)$(includedir)/mpath_cmd.h
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.gz
+ $(RM) core *.a *.o *.so *.so.* *.gz
include $(wildcard $(OBJS:.o=.d))
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 827e899..2ca6888 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -78,13 +78,13 @@
#endif
static struct hwentry default_hw[] = {
- /*
- * Generic NVMe
- *
- * Due to the parsing logic in find_hwe(), generic entries
- * have to be put on top of this list, and more specific ones
- * below.
- */
+ /*
+ * Generic NVMe devices
+ *
+ * Due to the parsing logic in find_hwe(), generic entries
+ * have to be put on top of this list, and more specific ones
+ * below.
+ */
{
.vendor = "NVME",
.product = ".*",
diff --git a/libmultipath/print.h b/libmultipath/print.h
index 7ba6438..9b5a23a 100644
--- a/libmultipath/print.h
+++ b/libmultipath/print.h
@@ -113,7 +113,7 @@ int _snprint_multipath (const struct gen_multipath *, char *, int,
const char *, int);
#define snprint_multipath(buf, len, fmt, mp, v) \
_snprint_multipath(dm_multipath_to_gen(mp), buf, len, fmt, v)
-int _snprint_multipath_topology (const struct gen_multipath *, char *, int,
+int _snprint_multipath_topology (const struct gen_multipath *, char *, int,
int verbosity);
#define snprint_multipath_topology(buf, len, mpp, v) \
_snprint_multipath_topology (dm_multipath_to_gen(mpp), buf, len, v)
diff --git a/multipathd/main.h b/multipathd/main.h
index af39558..8fd426b 100644
--- a/multipathd/main.h
+++ b/multipathd/main.h
@@ -29,11 +29,11 @@ int ev_remove_map (char *, char *, int, struct vectors *);
int set_config_state(enum daemon_status);
void * mpath_alloc_prin_response(int prin_sa);
int prin_do_scsi_ioctl(char *, int rq_servact, struct prin_resp * resp,
- int noisy);
+ int noisy);
void dumpHex(const char * , int len, int no_ascii);
int prout_do_scsi_ioctl(char * , int rq_servact, int rq_scope,
- unsigned int rq_type, struct prout_param_descriptor *param,
- int noisy);
+ unsigned int rq_type,
+ struct prout_param_descriptor *param, int noisy);
int mpath_pr_event_handle(struct path *pp);
void * mpath_pr_event_handler_fn (void * );
int update_map_pr(struct multipath *mpp);
--
2.7.4

View File

@ -1,60 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 29 Mar 2018 18:26:12 -0500
Subject: [PATCH] libmultipath: don't print undefined values
commit 48e9fd9f ("libmultipath: parser: use call-by-value for "snprint"
methods") removed some of the code that checked for undefined values to
avoid printing them. This lead to device configurations that printed
out values for parameters that they hadn't configured. This patch adds
that code back in.
Fixes: 48e9fd9f ("libmultipath: parser: use call-by-value for "snprint" methods")
Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/dict.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index ac9216c..1a18337 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -101,12 +101,16 @@ print_int (char *buff, int len, long v)
static int
print_nonzero (char *buff, int len, long v)
{
+ if (!v)
+ return 0;
return snprintf(buff, len, "%li", v);
}
static int
print_str (char *buff, int len, const char *ptr)
{
+ if (!ptr)
+ return 0;
return snprintf(buff, len, "\"%s\"", ptr);
}
@@ -120,6 +124,8 @@ print_yes_no (char *buff, int len, long v)
static int
print_yes_no_undef (char *buff, int len, long v)
{
+ if (!v)
+ return 0;
return snprintf(buff, len, "\"%s\"",
(v == YNU_NO)? "no" : "yes");
}
@@ -665,6 +671,8 @@ set_dev_loss(vector strvec, void *ptr)
int
print_dev_loss(char * buff, int len, unsigned long v)
{
+ if (!v)
+ return 0;
if (v >= MAX_DEV_LOSS_TMO)
return snprintf(buff, len, "\"infinity\"");
return snprintf(buff, len, "%lu", v);
--
2.7.4

View File

@ -0,0 +1,58 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Fri, 11 May 2018 18:39:44 +0200
Subject: [PATCH] multipath-tools: fix compilation with musl libc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In file included from alias.c:15:
file.h:9:47: error: unknown type name mode_t; did you mean time_t?
int ensure_directories_exist(const char *str, mode_t dir_mode);
^~~~~~
time_t
sysfs.c: In function sysfs_is_multipathed:
sysfs.c:304:15: error: PATH_MAX undeclared (first use in this function); did you mean PATH_UP?
char pathbuf[PATH_MAX];
^~~~~~~~
PATH_UP
Cc: Martin Wilck <mwilck@suse.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/file.h | 2 ++
libmultipath/sysfs.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/libmultipath/file.h b/libmultipath/file.h
index 29520c7..3c75c90 100644
--- a/libmultipath/file.h
+++ b/libmultipath/file.h
@@ -5,6 +5,8 @@
#ifndef _FILE_H
#define _FILE_H
+#include <sys/stat.h>
+
#define FILE_TIMEOUT 30
int ensure_directories_exist(const char *str, mode_t dir_mode);
int open_file(const char *file, int *can_write, const char *header);
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index ee72e6a..16e0a73 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -28,6 +28,7 @@
#include <dirent.h>
#include <libudev.h>
#include <fnmatch.h>
+#include <limits.h>
#include "checkers.h"
#include "vector.h"
--
2.7.4

View File

@ -1,30 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 13 Apr 2018 19:20:42 +0200
Subject: [PATCH] libmultipath: Fix logic in should_multipath
Commit d3b71498 missed a negation.
Fixes: d3b71498 "multipath: fix rcu thread cancellation hang"
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/wwids.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/wwids.c b/libmultipath/wwids.c
index 0ec9f25..8c21b33 100644
--- a/libmultipath/wwids.c
+++ b/libmultipath/wwids.c
@@ -284,7 +284,7 @@ should_multipath(struct path *pp1, vector pathvec)
ignore_new_devs = conf->ignore_new_devs;
find_multipaths = conf->find_multipaths;
put_multipath_config(conf);
- if (find_multipaths && !ignore_new_devs)
+ if (!find_multipaths && !ignore_new_devs)
return 1;
condlog(4, "checking if %s should be multipathed", pp1->dev);
--
2.7.4

View File

@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Sun, 13 May 2018 00:39:41 +0200
Subject: [PATCH] multipath-tools: add +x to doc-preclean.pl and split-man.pl
It is not strictly necessary, but it helps identify bin files.
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libdmmp/docs/doc-preclean.pl | 0
libdmmp/docs/split-man.pl | 0
2 files changed, 0 insertions(+), 0 deletions(-)
mode change 100644 => 100755 libdmmp/docs/doc-preclean.pl
mode change 100644 => 100755 libdmmp/docs/split-man.pl
diff --git a/libdmmp/docs/doc-preclean.pl b/libdmmp/docs/doc-preclean.pl
old mode 100644
new mode 100755
diff --git a/libdmmp/docs/split-man.pl b/libdmmp/docs/split-man.pl
old mode 100644
new mode 100755
--
2.7.4

View File

@ -0,0 +1,784 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Sun, 13 May 2018 00:39:42 +0200
Subject: [PATCH] multipath-tools: refresh kernel-doc from kernel sources
Cc: Gris Ge <fge@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libdmmp/docs/kernel-doc | 671 ++++++++++++++++++++++++++----------------------
1 file changed, 368 insertions(+), 303 deletions(-)
diff --git a/libdmmp/docs/kernel-doc b/libdmmp/docs/kernel-doc
index fee8952..0057d8e 100755
--- a/libdmmp/docs/kernel-doc
+++ b/libdmmp/docs/kernel-doc
@@ -1,4 +1,5 @@
#!/usr/bin/env perl
+# SPDX-License-Identifier: GPL-2.0
use warnings;
use strict;
@@ -328,13 +329,15 @@ my $lineprefix="";
use constant {
STATE_NORMAL => 0, # normal code
STATE_NAME => 1, # looking for function name
- STATE_FIELD => 2, # scanning field start
- STATE_PROTO => 3, # scanning prototype
- STATE_DOCBLOCK => 4, # documentation block
- STATE_INLINE => 5, # gathering documentation outside main block
+ STATE_BODY_MAYBE => 2, # body - or maybe more description
+ STATE_BODY => 3, # the body of the comment
+ STATE_PROTO => 4, # scanning prototype
+ STATE_DOCBLOCK => 5, # documentation block
+ STATE_INLINE => 6, # gathering documentation outside main block
};
my $state;
my $in_doc_sect;
+my $leading_space;
# Inline documentation state
use constant {
@@ -363,7 +366,7 @@ my $doc_sect = $doc_com .
my $doc_content = $doc_com_body . '(.*)';
my $doc_block = $doc_com . 'DOC:\s*(.*)?';
my $doc_inline_start = '^\s*/\*\*\s*$';
-my $doc_inline_sect = '\s*\*\s*(@[\w\s]+):(.*)';
+my $doc_inline_sect = '\s*\*\s*(@\s*[\w][\w\.]*\s*):(.*)';
my $doc_inline_end = '^\s*\*/\s*$';
my $doc_inline_oneline = '^\s*/\*\*\s*(@[\w\s]+):\s*(.*)\s*\*/\s*$';
my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;';
@@ -553,10 +556,9 @@ sub output_highlight {
}
if ($line eq ""){
if (! $output_preformatted) {
- print $lineprefix, local_unescape($blankline);
+ print $lineprefix, $blankline;
}
} else {
- $line =~ s/\\\\\\/\&/g;
if ($output_mode eq "man" && substr($line, 0, 1) eq ".") {
print "\\&$line";
} else {
@@ -747,17 +749,73 @@ sub output_blockhead_rst(%) {
}
}
-sub output_highlight_rst {
- my $contents = join "\n",@_;
- my $line;
-
- # undo the evil effects of xml_escape() earlier
- $contents = xml_unescape($contents);
-
+#
+# Apply the RST highlights to a sub-block of text.
+#
+sub highlight_block($) {
+ # The dohighlight kludge requires the text be called $contents
+ my $contents = shift;
eval $dohighlight;
die $@ if $@;
+ return $contents;
+}
- foreach $line (split "\n", $contents) {
+#
+# Regexes used only here.
+#
+my $sphinx_literal = '^[^.].*::$';
+my $sphinx_cblock = '^\.\.\ +code-block::';
+
+sub output_highlight_rst {
+ my $input = join "\n",@_;
+ my $output = "";
+ my $line;
+ my $in_literal = 0;
+ my $litprefix;
+ my $block = "";
+
+ foreach $line (split "\n",$input) {
+ #
+ # If we're in a literal block, see if we should drop out
+ # of it. Otherwise pass the line straight through unmunged.
+ #
+ if ($in_literal) {
+ if (! ($line =~ /^\s*$/)) {
+ #
+ # If this is the first non-blank line in a literal
+ # block we need to figure out what the proper indent is.
+ #
+ if ($litprefix eq "") {
+ $line =~ /^(\s*)/;
+ $litprefix = '^' . $1;
+ $output .= $line . "\n";
+ } elsif (! ($line =~ /$litprefix/)) {
+ $in_literal = 0;
+ } else {
+ $output .= $line . "\n";
+ }
+ } else {
+ $output .= $line . "\n";
+ }
+ }
+ #
+ # Not in a literal block (or just dropped out)
+ #
+ if (! $in_literal) {
+ $block .= $line . "\n";
+ if (($line =~ /$sphinx_literal/) || ($line =~ /$sphinx_cblock/)) {
+ $in_literal = 1;
+ $litprefix = "";
+ $output .= highlight_block($block);
+ $block = ""
+ }
+ }
+ }
+
+ if ($block) {
+ $output .= highlight_block($block);
+ }
+ foreach $line (split "\n", $output) {
print $lineprefix . $line . "\n";
}
}
@@ -1062,7 +1120,7 @@ sub dump_struct($$) {
# Handle bitmaps
$arg =~ s/:\s*\d+\s*//g;
# Handle arrays
- $arg =~ s/\[\S+\]//g;
+ $arg =~ s/\[.*\]//g;
# The type may have multiple words,
# and multiple IDs can be defined, like:
# const struct foo, *bar, foobar
@@ -1422,8 +1480,6 @@ sub push_parameter($$$$) {
}
}
- $param = xml_escape($param);
-
# strip spaces from $param so that it is one continuous string
# on @parameterlist;
# this fixes a problem where check_sections() cannot find
@@ -1522,6 +1578,7 @@ sub dump_function($$) {
$prototype =~ s/__meminit +//;
$prototype =~ s/__must_check +//;
$prototype =~ s/__weak +//;
+ $prototype =~ s/__sched +//;
my $define = $prototype =~ s/^#\s*define\s+//; #ak added
$prototype =~ s/__attribute__\s*\(\(
(?:
@@ -1748,47 +1805,6 @@ sub process_proto_type($$) {
}
}
-# xml_escape: replace <, >, and & in the text stream;
-#
-# however, formatting controls that are generated internally/locally in the
-# kernel-doc script are not escaped here; instead, they begin life like
-# $blankline_html (4 of '\' followed by a mnemonic + ':'), then these strings
-# are converted to their mnemonic-expected output, without the 4 * '\' & ':',
-# just before actual output; (this is done by local_unescape())
-sub xml_escape($) {
- my $text = shift;
- if ($output_mode eq "man") {
- return $text;
- }
- $text =~ s/\&/\\\\\\amp;/g;
- $text =~ s/\</\\\\\\lt;/g;
- $text =~ s/\>/\\\\\\gt;/g;
- return $text;
-}
-
-# xml_unescape: reverse the effects of xml_escape
-sub xml_unescape($) {
- my $text = shift;
- if ($output_mode eq "man") {
- return $text;
- }
- $text =~ s/\\\\\\amp;/\&/g;
- $text =~ s/\\\\\\lt;/</g;
- $text =~ s/\\\\\\gt;/>/g;
- return $text;
-}
-
-# convert local escape strings to html
-# local escape strings look like: '\\\\menmonic:' (that's 4 backslashes)
-sub local_unescape($) {
- my $text = shift;
- if ($output_mode eq "man") {
- return $text;
- }
- $text =~ s/\\\\\\\\lt:/</g;
- $text =~ s/\\\\\\\\gt:/>/g;
- return $text;
-}
sub map_filename($) {
my $file;
@@ -1826,15 +1842,291 @@ sub process_export_file($) {
close(IN);
}
-sub process_file($) {
- my $file;
+#
+# Parsers for the various processing states.
+#
+# STATE_NORMAL: looking for the /** to begin everything.
+#
+sub process_normal() {
+ if (/$doc_start/o) {
+ $state = STATE_NAME; # next line is always the function name
+ $in_doc_sect = 0;
+ $declaration_start_line = $. + 1;
+ }
+}
+
+#
+# STATE_NAME: Looking for the "name - description" line
+#
+sub process_name($$) {
+ my $file = shift;
my $identifier;
- my $func;
my $descr;
- my $in_purpose = 0;
+
+ if (/$doc_block/o) {
+ $state = STATE_DOCBLOCK;
+ $contents = "";
+ $new_start_line = $. + 1;
+
+ if ( $1 eq "" ) {
+ $section = $section_intro;
+ } else {
+ $section = $1;
+ }
+ }
+ elsif (/$doc_decl/o) {
+ $identifier = $1;
+ if (/\s*([\w\s]+?)(\(\))?\s*-/) {
+ $identifier = $1;
+ }
+
+ $state = STATE_BODY;
+ # if there's no @param blocks need to set up default section
+ # here
+ $contents = "";
+ $section = $section_default;
+ $new_start_line = $. + 1;
+ if (/-(.*)/) {
+ # strip leading/trailing/multiple spaces
+ $descr= $1;
+ $descr =~ s/^\s*//;
+ $descr =~ s/\s*$//;
+ $descr =~ s/\s+/ /g;
+ $declaration_purpose = $descr;
+ $state = STATE_BODY_MAYBE;
+ } else {
+ $declaration_purpose = "";
+ }
+
+ if (($declaration_purpose eq "") && $verbose) {
+ print STDERR "${file}:$.: warning: missing initial short description on line:\n";
+ print STDERR $_;
+ ++$warnings;
+ }
+
+ if ($identifier =~ m/^struct/) {
+ $decl_type = 'struct';
+ } elsif ($identifier =~ m/^union/) {
+ $decl_type = 'union';
+ } elsif ($identifier =~ m/^enum/) {
+ $decl_type = 'enum';
+ } elsif ($identifier =~ m/^typedef/) {
+ $decl_type = 'typedef';
+ } else {
+ $decl_type = 'function';
+ }
+
+ if ($verbose) {
+ print STDERR "${file}:$.: info: Scanning doc for $identifier\n";
+ }
+ } else {
+ print STDERR "${file}:$.: warning: Cannot understand $_ on line $.",
+ " - I thought it was a doc line\n";
+ ++$warnings;
+ $state = STATE_NORMAL;
+ }
+}
+
+
+#
+# STATE_BODY and STATE_BODY_MAYBE: the bulk of a kerneldoc comment.
+#
+sub process_body($$) {
+ my $file = shift;
+
+ if (/$doc_sect/i) { # case insensitive for supported section names
+ $newsection = $1;
+ $newcontents = $2;
+
+ # map the supported section names to the canonical names
+ if ($newsection =~ m/^description$/i) {
+ $newsection = $section_default;
+ } elsif ($newsection =~ m/^context$/i) {
+ $newsection = $section_context;
+ } elsif ($newsection =~ m/^returns?$/i) {
+ $newsection = $section_return;
+ } elsif ($newsection =~ m/^\@return$/) {
+ # special: @return is a section, not a param description
+ $newsection = $section_return;
+ }
+
+ if (($contents ne "") && ($contents ne "\n")) {
+ if (!$in_doc_sect && $verbose) {
+ print STDERR "${file}:$.: warning: contents before sections\n";
+ ++$warnings;
+ }
+ dump_section($file, $section, $contents);
+ $section = $section_default;
+ }
+
+ $in_doc_sect = 1;
+ $state = STATE_BODY;
+ $contents = $newcontents;
+ $new_start_line = $.;
+ while (substr($contents, 0, 1) eq " ") {
+ $contents = substr($contents, 1);
+ }
+ if ($contents ne "") {
+ $contents .= "\n";
+ }
+ $section = $newsection;
+ $leading_space = undef;
+ } elsif (/$doc_end/) {
+ if (($contents ne "") && ($contents ne "\n")) {
+ dump_section($file, $section, $contents);
+ $section = $section_default;
+ $contents = "";
+ }
+ # look for doc_com + <text> + doc_end:
+ if ($_ =~ m'\s*\*\s*[a-zA-Z_0-9:\.]+\*/') {
+ print STDERR "${file}:$.: warning: suspicious ending line: $_";
+ ++$warnings;
+ }
+
+ $prototype = "";
+ $state = STATE_PROTO;
+ $brcount = 0;
+ } elsif (/$doc_content/) {
+ # miguel-style comment kludge, look for blank lines after
+ # @parameter line to signify start of description
+ if ($1 eq "") {
+ if ($section =~ m/^@/ || $section eq $section_context) {
+ dump_section($file, $section, $contents);
+ $section = $section_default;
+ $contents = "";
+ $new_start_line = $.;
+ } else {
+ $contents .= "\n";
+ }
+ $state = STATE_BODY;
+ } elsif ($state == STATE_BODY_MAYBE) {
+ # Continued declaration purpose
+ chomp($declaration_purpose);
+ $declaration_purpose .= " " . $1;
+ $declaration_purpose =~ s/\s+/ /g;
+ } else {
+ my $cont = $1;
+ if ($section =~ m/^@/ || $section eq $section_context) {
+ if (!defined $leading_space) {
+ if ($cont =~ m/^(\s+)/) {
+ $leading_space = $1;
+ } else {
+ $leading_space = "";
+ }
+ }
+ $cont =~ s/^$leading_space//;
+ }
+ $contents .= $cont . "\n";
+ }
+ } else {
+ # i dont know - bad line? ignore.
+ print STDERR "${file}:$.: warning: bad line: $_";
+ ++$warnings;
+ }
+}
+
+
+#
+# STATE_PROTO: reading a function/whatever prototype.
+#
+sub process_proto($$) {
+ my $file = shift;
+
+ if (/$doc_inline_oneline/) {
+ $section = $1;
+ $contents = $2;
+ if ($contents ne "") {
+ $contents .= "\n";
+ dump_section($file, $section, $contents);
+ $section = $section_default;
+ $contents = "";
+ }
+ } elsif (/$doc_inline_start/) {
+ $state = STATE_INLINE;
+ $inline_doc_state = STATE_INLINE_NAME;
+ } elsif ($decl_type eq 'function') {
+ process_proto_function($_, $file);
+ } else {
+ process_proto_type($_, $file);
+ }
+}
+
+#
+# STATE_DOCBLOCK: within a DOC: block.
+#
+sub process_docblock($$) {
+ my $file = shift;
+
+ if (/$doc_end/) {
+ dump_doc_section($file, $section, $contents);
+ $section = $section_default;
+ $contents = "";
+ $function = "";
+ %parameterdescs = ();
+ %parametertypes = ();
+ @parameterlist = ();
+ %sections = ();
+ @sectionlist = ();
+ $prototype = "";
+ $state = STATE_NORMAL;
+ } elsif (/$doc_content/) {
+ if ( $1 eq "" ) {
+ $contents .= $blankline;
+ } else {
+ $contents .= $1 . "\n";
+ }
+ }
+}
+
+#
+# STATE_INLINE: docbook comments within a prototype.
+#
+sub process_inline($$) {
+ my $file = shift;
+
+ # First line (state 1) needs to be a @parameter
+ if ($inline_doc_state == STATE_INLINE_NAME && /$doc_inline_sect/o) {
+ $section = $1;
+ $contents = $2;
+ $new_start_line = $.;
+ if ($contents ne "") {
+ while (substr($contents, 0, 1) eq " ") {
+ $contents = substr($contents, 1);
+ }
+ $contents .= "\n";
+ }
+ $inline_doc_state = STATE_INLINE_TEXT;
+ # Documentation block end */
+ } elsif (/$doc_inline_end/) {
+ if (($contents ne "") && ($contents ne "\n")) {
+ dump_section($file, $section, $contents);
+ $section = $section_default;
+ $contents = "";
+ }
+ $state = STATE_PROTO;
+ $inline_doc_state = STATE_INLINE_NA;
+ # Regular text
+ } elsif (/$doc_content/) {
+ if ($inline_doc_state == STATE_INLINE_TEXT) {
+ $contents .= $1 . "\n";
+ # nuke leading blank lines
+ if ($contents =~ /^\s*$/) {
+ $contents = "";
+ }
+ } elsif ($inline_doc_state == STATE_INLINE_NAME) {
+ $inline_doc_state = STATE_INLINE_ERROR;
+ print STDERR "${file}:$.: warning: ";
+ print STDERR "Incorrect use of kernel-doc format: $_";
+ ++$warnings;
+ }
+ }
+}
+
+
+sub process_file($) {
+ my $file;
my $initial_section_counter = $section_counter;
my ($orig_file) = @_;
- my $leading_space;
$file = map_filename($orig_file);
@@ -1853,250 +2145,23 @@ sub process_file($) {
}
# Replace tabs by spaces
while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};
+ # Hand this line to the appropriate state handler
if ($state == STATE_NORMAL) {
- if (/$doc_start/o) {
- $state = STATE_NAME; # next line is always the function name
- $in_doc_sect = 0;
- $declaration_start_line = $. + 1;
- }
- } elsif ($state == STATE_NAME) {# this line is the function name (always)
- if (/$doc_block/o) {
- $state = STATE_DOCBLOCK;
- $contents = "";
- $new_start_line = $. + 1;
-
- if ( $1 eq "" ) {
- $section = $section_intro;
- } else {
- $section = $1;
- }
- }
- elsif (/$doc_decl/o) {
- $identifier = $1;
- if (/\s*([\w\s]+?)\s*-/) {
- $identifier = $1;
- }
-
- $state = STATE_FIELD;
- # if there's no @param blocks need to set up default section
- # here
- $contents = "";
- $section = $section_default;
- $new_start_line = $. + 1;
- if (/-(.*)/) {
- # strip leading/trailing/multiple spaces
- $descr= $1;
- $descr =~ s/^\s*//;
- $descr =~ s/\s*$//;
- $descr =~ s/\s+/ /g;
- $declaration_purpose = xml_escape($descr);
- $in_purpose = 1;
- } else {
- $declaration_purpose = "";
- }
-
- if (($declaration_purpose eq "") && $verbose) {
- print STDERR "${file}:$.: warning: missing initial short description on line:\n";
- print STDERR $_;
- ++$warnings;
- }
-
- if ($identifier =~ m/^struct/) {
- $decl_type = 'struct';
- } elsif ($identifier =~ m/^union/) {
- $decl_type = 'union';
- } elsif ($identifier =~ m/^enum/) {
- $decl_type = 'enum';
- } elsif ($identifier =~ m/^typedef/) {
- $decl_type = 'typedef';
- } else {
- $decl_type = 'function';
- }
-
- if ($verbose) {
- print STDERR "${file}:$.: info: Scanning doc for $identifier\n";
- }
- } else {
- print STDERR "${file}:$.: warning: Cannot understand $_ on line $.",
- " - I thought it was a doc line\n";
- ++$warnings;
- $state = STATE_NORMAL;
- }
- } elsif ($state == STATE_FIELD) { # look for head: lines, and include content
- if (/$doc_sect/i) { # case insensitive for supported section names
- $newsection = $1;
- $newcontents = $2;
-
- # map the supported section names to the canonical names
- if ($newsection =~ m/^description$/i) {
- $newsection = $section_default;
- } elsif ($newsection =~ m/^context$/i) {
- $newsection = $section_context;
- } elsif ($newsection =~ m/^returns?$/i) {
- $newsection = $section_return;
- } elsif ($newsection =~ m/^\@return$/) {
- # special: @return is a section, not a param description
- $newsection = $section_return;
- }
-
- if (($contents ne "") && ($contents ne "\n")) {
- if (!$in_doc_sect && $verbose) {
- print STDERR "${file}:$.: warning: contents before sections\n";
- ++$warnings;
- }
- dump_section($file, $section, xml_escape($contents));
- $section = $section_default;
- }
-
- $in_doc_sect = 1;
- $in_purpose = 0;
- $contents = $newcontents;
- $new_start_line = $.;
- while (substr($contents, 0, 1) eq " ") {
- $contents = substr($contents, 1);
- }
- if ($contents ne "") {
- $contents .= "\n";
- }
- $section = $newsection;
- $leading_space = undef;
- } elsif (/$doc_end/) {
- if (($contents ne "") && ($contents ne "\n")) {
- dump_section($file, $section, xml_escape($contents));
- $section = $section_default;
- $contents = "";
- }
- # look for doc_com + <text> + doc_end:
- if ($_ =~ m'\s*\*\s*[a-zA-Z_0-9:\.]+\*/') {
- print STDERR "${file}:$.: warning: suspicious ending line: $_";
- ++$warnings;
- }
-
- $prototype = "";
- $state = STATE_PROTO;
- $brcount = 0;
-# print STDERR "end of doc comment, looking for prototype\n";
- } elsif (/$doc_content/) {
- # miguel-style comment kludge, look for blank lines after
- # @parameter line to signify start of description
- if ($1 eq "") {
- if ($section =~ m/^@/ || $section eq $section_context) {
- dump_section($file, $section, xml_escape($contents));
- $section = $section_default;
- $contents = "";
- $new_start_line = $.;
- } else {
- $contents .= "\n";
- }
- $in_purpose = 0;
- } elsif ($in_purpose == 1) {
- # Continued declaration purpose
- chomp($declaration_purpose);
- $declaration_purpose .= " " . xml_escape($1);
- $declaration_purpose =~ s/\s+/ /g;
- } else {
- my $cont = $1;
- if ($section =~ m/^@/ || $section eq $section_context) {
- if (!defined $leading_space) {
- if ($cont =~ m/^(\s+)/) {
- $leading_space = $1;
- } else {
- $leading_space = "";
- }
- }
-
- $cont =~ s/^$leading_space//;
- }
- $contents .= $cont . "\n";
- }
- } else {
- # i dont know - bad line? ignore.
- print STDERR "${file}:$.: warning: bad line: $_";
- ++$warnings;
- }
+ process_normal();
+ } elsif ($state == STATE_NAME) {
+ process_name($file, $_);
+ } elsif ($state == STATE_BODY || $state == STATE_BODY_MAYBE) {
+ process_body($file, $_);
} elsif ($state == STATE_INLINE) { # scanning for inline parameters
- # First line (state 1) needs to be a @parameter
- if ($inline_doc_state == STATE_INLINE_NAME && /$doc_inline_sect/o) {
- $section = $1;
- $contents = $2;
- $new_start_line = $.;
- if ($contents ne "") {
- while (substr($contents, 0, 1) eq " ") {
- $contents = substr($contents, 1);
- }
- $contents .= "\n";
- }
- $inline_doc_state = STATE_INLINE_TEXT;
- # Documentation block end */
- } elsif (/$doc_inline_end/) {
- if (($contents ne "") && ($contents ne "\n")) {
- dump_section($file, $section, xml_escape($contents));
- $section = $section_default;
- $contents = "";
- }
- $state = STATE_PROTO;
- $inline_doc_state = STATE_INLINE_NA;
- # Regular text
- } elsif (/$doc_content/) {
- if ($inline_doc_state == STATE_INLINE_TEXT) {
- $contents .= $1 . "\n";
- # nuke leading blank lines
- if ($contents =~ /^\s*$/) {
- $contents = "";
- }
- } elsif ($inline_doc_state == STATE_INLINE_NAME) {
- $inline_doc_state = STATE_INLINE_ERROR;
- print STDERR "${file}:$.: warning: ";
- print STDERR "Incorrect use of kernel-doc format: $_";
- ++$warnings;
- }
- }
- } elsif ($state == STATE_PROTO) { # scanning for function '{' (end of prototype)
- if (/$doc_inline_oneline/) {
- $section = $1;
- $contents = $2;
- if ($contents ne "") {
- $contents .= "\n";
- dump_section($file, $section, xml_escape($contents));
- $section = $section_default;
- $contents = "";
- }
- } elsif (/$doc_inline_start/) {
- $state = STATE_INLINE;
- $inline_doc_state = STATE_INLINE_NAME;
- } elsif ($decl_type eq 'function') {
- process_proto_function($_, $file);
- } else {
- process_proto_type($_, $file);
- }
+ process_inline($file, $_);
+ } elsif ($state == STATE_PROTO) {
+ process_proto($file, $_);
} elsif ($state == STATE_DOCBLOCK) {
- if (/$doc_end/)
- {
- dump_doc_section($file, $section, xml_escape($contents));
- $section = $section_default;
- $contents = "";
- $function = "";
- %parameterdescs = ();
- %parametertypes = ();
- @parameterlist = ();
- %sections = ();
- @sectionlist = ();
- $prototype = "";
- $state = STATE_NORMAL;
- }
- elsif (/$doc_content/)
- {
- if ( $1 eq "" )
- {
- $contents .= $blankline;
- }
- else
- {
- $contents .= $1 . "\n";
- }
- }
+ process_docblock($file, $_);
}
}
+
+ # Make sure we got something interesting.
if ($initial_section_counter == $section_counter) {
if ($output_mode ne "none") {
print STDERR "${file}:1: warning: no structured comments found\n";
--
2.7.4

View File

@ -1,40 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 19 Apr 2018 17:36:56 -0500
Subject: [PATCH] multipathd: add failures path format wildcard
multipath already tracks this, so it should be able to print it out.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/print.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libmultipath/print.c b/libmultipath/print.c
index d532994..b1844c9 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -632,6 +632,12 @@ snprint_path_foreign (char * buff, size_t len, const struct path * pp)
return snprintf(buff, len, "%s", "--");
}
+static int
+snprint_path_failures(char * buff, size_t len, const struct path * pp)
+{
+ return snprint_int(buff, len, pp->failcount);
+}
+
struct multipath_data mpd[] = {
{'n', "name", 0, snprint_name},
{'w', "uuid", 0, snprint_multipath_uuid},
@@ -680,6 +686,7 @@ struct path_data pd[] = {
{'r', "target WWPN", 0, snprint_tgt_wwpn},
{'a', "host adapter", 0, snprint_host_adapter},
{'G', "foreign", 0, snprint_path_foreign},
+ {'0', "failures", 0, snprint_path_failures},
{0, NULL, 0 , NULL}
};
--
2.7.4

View File

@ -0,0 +1,56 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Mon, 14 May 2018 17:30:17 +0200
Subject: [PATCH] multipath-tools: configure hitachi ams2000 and hus100 as full
active arrays
AMS2000 and HUS100 families are active/active arrays.
Based on https://support.hitachivantara.com/download/epcra/df818913.pdf
and internal hitachi docs.
Cc: Matthias Rudolph <Matthias.Rudolph@hitachivantara.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 2ca6888..148f0ba 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -398,13 +398,13 @@ static struct hwentry default_hw[] = {
* Mail : matthias.rudolph@hds.com
*/
{
- /* USP-V, HUS VM, VSP, VSP G1X00 and VSP GX00 families */
+ /* USP-V, HUS VM, VSP, VSP G1X00 and VSP GX00 families / HP XP */
.vendor = "(HITACHI|HP)",
.product = "^OPEN-",
.pgpolicy = MULTIBUS,
},
{
- /* AMS 2000 and HUS 100 families */
+ /* AMS other than AMS 2000 */
.vendor = "HITACHI",
.product = "^DF",
.no_path_retry = NO_PATH_RETRY_QUEUE,
@@ -412,6 +412,12 @@ static struct hwentry default_hw[] = {
.pgfailback = -FAILBACK_IMMEDIATE,
.prio_name = PRIO_HDS,
},
+ {
+ /* AMS 2000 and HUS 100 families */
+ .vendor = "HITACHI",
+ .product = "^DF600F",
+ .pgpolicy = MULTIBUS,
+ },
/*
* IBM
*
--
2.7.4

View File

@ -1,29 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 23 Apr 2018 17:53:02 -0500
Subject: [PATCH] multipathd: fix reservation_key check
mpath_pr_event_handle should exit if the reservation key is zero, not
non-zero.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 841d3e9..84af946 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -3136,7 +3136,7 @@ int mpath_pr_event_handle(struct path *pp)
mpp = pp->mpp;
- if (get_be64(mpp->reservation_key))
+ if (!get_be64(mpp->reservation_key))
return -1;
pthread_attr_init(&attr);
--
2.7.4

View File

@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 21 Mar 2018 10:34:18 +0100
Subject: [PATCH] libmultipath: don't reject maps with undefined prio
libmultipath's prio routines can deal with pp->priority == PRIO_UNDEF
just fine. PRIO_UNDEF is just a very low priority. So there's
no reason to reject setting up a multipath map because paths have
undefined priority.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/configure.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 5796683..5c54f9b 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -1063,9 +1063,6 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
continue;
}
- if (pp1->priority == PRIO_UNDEF)
- mpp->action = ACT_REJECT;
-
if (!mpp->paths) {
condlog(0, "%s: skip coalesce (no paths)", mpp->alias);
remove_map(mpp, vecs, 0);
@@ -1091,8 +1088,6 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
mpp->size);
mpp->action = ACT_REJECT;
}
- if (pp2->priority == PRIO_UNDEF)
- mpp->action = ACT_REJECT;
}
verify_paths(mpp, vecs);
--
2.7.4

View File

@ -0,0 +1,57 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 21 Mar 2018 10:34:19 +0100
Subject: [PATCH] multipathd: handle errors in uxlsnr as fatal
The ppoll() calls of the uxlsnr thread are vital for proper functioning of
multipathd. If the uxlsnr thread can't open the socket or fails to call ppoll()
for other reasons, quit the daemon. If we don't do that, multipathd may
hang in a state where it can't be terminated any more, because the uxlsnr
thread is responsible for handling all signals. This happens e.g. if
systemd's multipathd.socket is running in and multipathd is started from
outside systemd.
24f2844 "multipathd: fix signal blocking logic" has made this problem more
severe. Before that patch, the signals weren't actually blocked in any thread.
That's not to say 24f2844 was wrong. I still think it's correct, we just
need this one on top.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/uxlsnr.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/multipathd/uxlsnr.c b/multipathd/uxlsnr.c
index cdafd82..6f66666 100644
--- a/multipathd/uxlsnr.c
+++ b/multipathd/uxlsnr.c
@@ -178,7 +178,7 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, void * trigger_data)
if (ux_sock == -1) {
condlog(1, "could not create uxsock: %d", errno);
- return NULL;
+ exit_daemon();
}
pthread_cleanup_push(uxsock_cleanup, (void *)ux_sock);
@@ -187,7 +187,7 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, void * trigger_data)
polls = (struct pollfd *)MALLOC((MIN_POLLS + 1) * sizeof(struct pollfd));
if (!polls) {
condlog(0, "uxsock: failed to allocate poll fds");
- return NULL;
+ exit_daemon();
}
sigfillset(&mask);
sigdelset(&mask, SIGINT);
@@ -249,6 +249,7 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, void * trigger_data)
/* something went badly wrong! */
condlog(0, "uxsock: poll failed with %d", errno);
+ exit_daemon();
break;
}
--
2.7.4

View File

@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 15 May 2018 14:32:44 +0200
Subject: [PATCH] libmultipath: fix error parsing "find_multipaths strict"
If "find_multipaths strict" is set in multipath.conf, the error message
"illegal value for find_multipaths: strict" is printed. This causes no
functional problem, as "strict" happens to be the default, fallback
value. It should be fixed nonetheless. FIND_MULTIPATHS_STRICT, having
the highest numeric value, must be last in the enum.
Fixes: c36f2f42 "libmultipath: change find_multipaths option to multi-value"
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/structs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index eb6a178..e424b15 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -122,9 +122,9 @@ enum find_multipaths_states {
FIND_MULTIPATHS_UNDEF = YNU_UNDEF,
FIND_MULTIPATHS_OFF = YNU_NO,
FIND_MULTIPATHS_ON = _FIND_MULTIPATHS_F,
- FIND_MULTIPATHS_STRICT = _FIND_MULTIPATHS_F|_FIND_MULTIPATHS_N,
FIND_MULTIPATHS_GREEDY = _FIND_MULTIPATHS_I,
FIND_MULTIPATHS_SMART = _FIND_MULTIPATHS_F|_FIND_MULTIPATHS_I,
+ FIND_MULTIPATHS_STRICT = _FIND_MULTIPATHS_F|_FIND_MULTIPATHS_N,
__FIND_MULTIPATHS_LAST,
};
--
2.7.4

View File

@ -12,10 +12,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 4 insertions(+), 2 deletions(-) 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 1a18337..8f9944a 100644 index 4040611..3e7c5d6 100644
--- a/libmultipath/dict.c --- a/libmultipath/dict.c
+++ b/libmultipath/dict.c +++ b/libmultipath/dict.c
@@ -1067,7 +1067,8 @@ print_off_int_undef(char * buff, int len, long v) @@ -1115,7 +1115,8 @@ print_off_int_undef(char * buff, int len, long v)
} }
declare_def_handler(delay_watch_checks, set_off_int_undef) declare_def_handler(delay_watch_checks, set_off_int_undef)
@ -25,7 +25,7 @@ index 1a18337..8f9944a 100644
declare_ovr_handler(delay_watch_checks, set_off_int_undef) declare_ovr_handler(delay_watch_checks, set_off_int_undef)
declare_ovr_snprint(delay_watch_checks, print_off_int_undef) declare_ovr_snprint(delay_watch_checks, print_off_int_undef)
declare_hw_handler(delay_watch_checks, set_off_int_undef) declare_hw_handler(delay_watch_checks, set_off_int_undef)
@@ -1075,7 +1076,8 @@ declare_hw_snprint(delay_watch_checks, print_off_int_undef) @@ -1123,7 +1124,8 @@ declare_hw_snprint(delay_watch_checks, print_off_int_undef)
declare_mp_handler(delay_watch_checks, set_off_int_undef) declare_mp_handler(delay_watch_checks, set_off_int_undef)
declare_mp_snprint(delay_watch_checks, print_off_int_undef) declare_mp_snprint(delay_watch_checks, print_off_int_undef)
declare_def_handler(delay_wait_checks, set_off_int_undef) declare_def_handler(delay_wait_checks, set_off_int_undef)

View File

@ -9,10 +9,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 3 insertions(+), 4 deletions(-) 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index c4d0789..8dae0f4 100644 index f689795..96d1b66 100644
--- a/multipath/multipath.conf.5 --- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5
@@ -1144,10 +1144,9 @@ and @@ -1181,10 +1181,9 @@ and
keywords. For a full description of these keywords please see the \fIdevices\fR keywords. For a full description of these keywords please see the \fIdevices\fR
section description. section description.
.LP .LP

View File

@ -0,0 +1,317 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 31 May 2018 17:47:11 -0500
Subject: [PATCH] mpathpersist: add all_tg_pt option
Some arrays, such as the EMC VNX, don't follow the scsi persistent
reservations spec in making key registrations per I_T NEXUS. Instead,
the registration is shared by all target ports connected to a given
host. This causes mpathpersist to fail whenever it tries to register a
key, since it will receive a registration conflict on some of the paths.
To deal with this, mpathpersist needs to track the hosts that it has
done a registration on, and only register once per host. The new
"all_tg_pt" multipath.conf option is used to set which arrays need this
feature. I currently don't know if all EMC VNX arrays handle persistent
reservations like this, or if it is configurable. A future patch will
update the VNX built-in config, if this is indeed their default (or
only) setting.
Multipathd doesn't need to worry about this. It is often the case that
when a path device comes back, it will still have the keys registered to
it. Because of this, multipathd uses register-and-ignore, which means
that it won't cause an error if the registration has already happened
down a different target port.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathpersist/mpath_persist.c | 28 ++++++++++++++++++++++------
libmultipath/config.c | 2 ++
libmultipath/config.h | 2 ++
libmultipath/defaults.h | 1 +
libmultipath/dict.c | 10 ++++++++++
libmultipath/propsel.c | 15 +++++++++++++++
libmultipath/propsel.h | 1 +
libmultipath/structs.h | 7 +++++++
multipath/multipath.conf.5 | 11 +++++++++++
9 files changed, 71 insertions(+), 6 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 907a17c..ca91c55 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -335,6 +335,7 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
conf = get_multipath_config();
select_reservation_key(conf, mpp);
+ select_all_tg_pt(conf, mpp);
put_multipath_config(conf);
memcpy(&prkey, paramp->sa_key, 8);
@@ -456,7 +457,7 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,
unsigned int rq_type, struct prout_param_descriptor * paramp, int noisy)
{
- int i, j;
+ int i, j, k;
struct pathgroup *pgp = NULL;
struct path *pp = NULL;
int rollback = 0;
@@ -481,11 +482,13 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,
}
struct threadinfo thread[active_pathcount];
+ int hosts[active_pathcount];
memset(thread, 0, sizeof(thread));
/* init thread parameter */
for (i =0; i< active_pathcount; i++){
+ hosts[i] = -1;
thread[i].param.rq_servact = rq_servact;
thread[i].param.rq_scope = rq_scope;
thread[i].param.rq_type = rq_type;
@@ -514,6 +517,17 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,
condlog (1, "%s: %s path not up. Skip.", mpp->wwid, pp->dev);
continue;
}
+ if (mpp->all_tg_pt == ALL_TG_PT_ON &&
+ pp->sg_id.host_no != -1) {
+ for (k = 0; k < count; k++) {
+ if (pp->sg_id.host_no == hosts[k]) {
+ condlog(3, "%s: %s host %d matches skip.", pp->wwid, pp->dev, pp->sg_id.host_no);
+ break;
+ }
+ }
+ if (k < count)
+ continue;
+ }
strncpy(thread[count].param.dev, pp->dev,
FILE_NAME_SIZE - 1);
@@ -531,10 +545,12 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,
condlog (0, "%s: failed to create thread %d", mpp->wwid, rc);
thread[count].param.status = MPATH_PR_THREAD_ERROR;
}
+ else
+ hosts[count] = pp->sg_id.host_no;
count = count + 1;
}
}
- for( i=0; i < active_pathcount ; i++){
+ for( i=0; i < count ; i++){
if (thread[i].param.status != MPATH_PR_THREAD_ERROR) {
rc = pthread_join(thread[i].id, NULL);
if (rc){
@@ -557,7 +573,7 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,
}
if (rollback && ((rq_servact == MPATH_PROUT_REG_SA) && sa_key != 0 )){
condlog (3, "%s: ERROR: initiating pr out rollback", mpp->wwid);
- for( i=0 ; i < active_pathcount ; i++){
+ for( i=0 ; i < count ; i++){
if(thread[i].param.status == MPATH_PR_SUCCESS) {
memcpy(&thread[i].param.paramp->key, &thread[i].param.paramp->sa_key, 8);
memset(&thread[i].param.paramp->sa_key, 0, 8);
@@ -571,7 +587,7 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,
} else
thread[i].param.status = MPATH_PR_SKIP;
}
- for(i=0; i < active_pathcount ; i++){
+ for(i=0; i < count ; i++){
if (thread[i].param.status != MPATH_PR_SKIP &&
thread[i].param.status != MPATH_PR_THREAD_ERROR) {
rc = pthread_join(thread[i].id, NULL);
@@ -720,7 +736,7 @@ int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope,
}
}
pthread_attr_destroy (&attr);
- for (i = 0; i < active_pathcount; i++){
+ for (i = 0; i < count; i++){
if (thread[i].param.status != MPATH_PR_THREAD_ERROR) {
rc = pthread_join (thread[i].id, NULL);
if (rc){
@@ -729,7 +745,7 @@ int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope,
}
}
- for (i = 0; i < active_pathcount; i++){
+ for (i = 0; i < count; i++){
/* check thread status here and return the status */
if (thread[i].param.status == MPATH_PR_RESERV_CONFLICT)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index 085a3e1..5872927 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -352,6 +352,7 @@ merge_hwe (struct hwentry * dst, struct hwentry * src)
merge_num(skip_kpartx);
merge_num(max_sectors_kb);
merge_num(ghost_delay);
+ merge_num(all_tg_pt);
snprintf(id, sizeof(id), "%s/%s", dst->vendor, dst->product);
reconcile_features_with_options(id, &dst->features,
@@ -622,6 +623,7 @@ load_config (char * file)
conf->disable_changed_wwids = DEFAULT_DISABLE_CHANGED_WWIDS;
conf->remove_retries = 0;
conf->ghost_delay = DEFAULT_GHOST_DELAY;
+ conf->all_tg_pt = DEFAULT_ALL_TG_PT;
/*
* preload default hwtable
diff --git a/libmultipath/config.h b/libmultipath/config.h
index 6e69a37..1bf708a 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -82,6 +82,7 @@ struct hwentry {
int skip_kpartx;
int max_sectors_kb;
int ghost_delay;
+ int all_tg_pt;
char * bl_product;
};
@@ -194,6 +195,7 @@ struct config {
char * partition_delim;
char * config_dir;
int prkey_source;
+ int all_tg_pt;
struct be64 reservation_key;
vector keywords;
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index d7b87b4..f076b4b 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -43,6 +43,7 @@
#define DEFAULT_GHOST_DELAY GHOST_DELAY_OFF
#define DEFAULT_FIND_MULTIPATHS_TIMEOUT -10
#define DEFAULT_UNKNOWN_FIND_MULTIPATHS_TIMEOUT 1
+#define DEFAULT_ALL_TG_PT ALL_TG_PT_OFF
#define DEFAULT_CHECKINT 5
#define MAX_CHECKINT(a) (a << 2)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 3e7c5d6..2557b8a 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -1178,6 +1178,13 @@ declare_hw_snprint(ghost_delay, print_off_int_undef)
declare_mp_handler(ghost_delay, set_off_int_undef)
declare_mp_snprint(ghost_delay, print_off_int_undef)
+declare_def_handler(all_tg_pt, set_yes_no_undef)
+declare_def_snprint_defint(all_tg_pt, print_yes_no_undef, DEFAULT_ALL_TG_PT)
+declare_ovr_handler(all_tg_pt, set_yes_no_undef)
+declare_ovr_snprint(all_tg_pt, print_yes_no_undef)
+declare_hw_handler(all_tg_pt, set_yes_no_undef)
+declare_hw_snprint(all_tg_pt, print_yes_no_undef)
+
static int
def_uxsock_timeout_handler(struct config *conf, vector strvec)
@@ -1509,6 +1516,7 @@ init_keywords(vector keywords)
install_keyword("prkeys_file", &def_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("all_tg_pt", &def_all_tg_pt_handler, &snprint_def_all_tg_pt);
install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler);
install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio);
install_keyword("detect_checker", &def_detect_checker_handler, &snprint_def_detect_checker);
@@ -1618,6 +1626,7 @@ init_keywords(vector keywords)
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("ghost_delay", &hw_ghost_delay_handler, &snprint_hw_ghost_delay);
+ install_keyword("all_tg_pt", &hw_all_tg_pt_handler, &snprint_hw_all_tg_pt);
install_sublevel_end();
install_keyword_root("overrides", &overrides_handler);
@@ -1654,6 +1663,7 @@ init_keywords(vector keywords)
install_keyword("skip_kpartx", &ovr_skip_kpartx_handler, &snprint_ovr_skip_kpartx);
install_keyword("max_sectors_kb", &ovr_max_sectors_kb_handler, &snprint_ovr_max_sectors_kb);
install_keyword("ghost_delay", &ovr_ghost_delay_handler, &snprint_ovr_ghost_delay);
+ install_keyword("all_tg_pt", &ovr_all_tg_pt_handler, &snprint_ovr_all_tg_pt);
install_keyword_root("multipaths", &multipaths_handler);
install_keyword_multi("multipath", &multipath_handler, NULL);
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index 627d366..9ca1355 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -978,3 +978,18 @@ out:
pp->dev, pp->find_multipaths_timeout, origin);
return 0;
}
+
+int select_all_tg_pt (struct config *conf, struct multipath * mp)
+{
+ const char *origin;
+
+ mp_set_ovr(all_tg_pt);
+ mp_set_hwe(all_tg_pt);
+ mp_set_conf(all_tg_pt);
+ mp_set_default(all_tg_pt, DEFAULT_ALL_TG_PT);
+out:
+ condlog(3, "%s: all_tg_pt = %s %s", mp->alias,
+ (mp->all_tg_pt == ALL_TG_PT_ON)? "yes" : "no",
+ origin);
+ return 0;
+}
diff --git a/libmultipath/propsel.h b/libmultipath/propsel.h
index a022bee..ae99b92 100644
--- a/libmultipath/propsel.h
+++ b/libmultipath/propsel.h
@@ -34,3 +34,4 @@ int select_ghost_delay(struct config *conf, struct multipath * mp);
void reconcile_features_with_options(const char *id, char **features,
int* no_path_retry,
int *retain_hwhandler);
+int select_all_tg_pt (struct config *conf, struct multipath * mp);
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index e424b15..0194b1e 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -217,6 +217,12 @@ enum prkey_sources {
PRKEY_SOURCE_FILE,
};
+enum all_tg_pt_states {
+ ALL_TG_PT_UNDEF = YNU_UNDEF,
+ ALL_TG_PT_OFF = YNU_NO,
+ ALL_TG_PT_ON = YNU_YES,
+};
+
struct sg_id {
int host_no;
int channel;
@@ -362,6 +368,7 @@ struct multipath {
int prkey_source;
struct be64 reservation_key;
unsigned char prflag;
+ int all_tg_pt;
struct gen_multipath generic_mp;
};
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 96d1b66..0c1f174 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -743,6 +743,17 @@ The default is: \fB<unset>\fR
.
.
.TP
+.B all_tg_pt
+This must be set to \fByes\fR to successfully use mpathpersist on arrays that
+automatically set and clear registration keys on all target ports from a
+host, instead of per target port per host.
+.RS
+.TP
+The default is: \fBno\fR
+.RE
+.
+.
+.TP
.B retain_attached_hw_handler
(Obsolete for kernels >= 4.3) If set to
.I yes
--
2.7.4

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,543 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 4 Jun 2018 22:04:44 -0500
Subject: [PATCH] mpathpersist: fix aptpl support
The "Active Persist Through Power Loss" flag must be set whenever a key
is registered. However, there is no way for multipathd to know if this
was set by mpathpersist. The result is that if a path goes down and
comes back up (or if it wasn't up when mpathpersist was first run)
multipathd will clear the aptpl flag when it reregisters the key on it.
To fix this, multipath.conf now accepts an optional ":aptpl" appended
on the reservation_key value. If this is added to the reservation_key
multipathd will set the aptpl flag when it reregisters the key. If
reservation_key is set to "file", this will automatically be tracked
in the /etc/multipath/prkeys file.
To track this flag in the prkeys file, without changing the format
I've made "0x<key>" stand for non-aptpl keys, and "0X<key>" stand
for aptpl keys. Since previously, all keys used a lower-case x, this
will default to the current behavior for existing keys. Obviously, the
next time mpathpersist is run, this will be changed if --param-aptpl
is used. Since there are no more flags that are in sg_persist that
multipathd needs to care about in mpathpersist, there shouldn't need
to be any more flags added to the prkeys file.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathpersist/mpath_persist.c | 3 ++-
libmpathpersist/mpath_updatepr.c | 11 +++++++----
libmpathpersist/mpathpr.h | 3 ++-
libmultipath/Makefile | 2 +-
libmultipath/config.h | 2 ++
libmultipath/dict.c | 23 +++++++++++++++++++----
libmultipath/dict.h | 3 ++-
libmultipath/prkey.c | 27 ++++++++++++++++++++++++---
libmultipath/prkey.h | 6 ++++--
libmultipath/propsel.c | 6 ++++--
libmultipath/structs.h | 1 +
libmultipath/util.c | 16 ++++++++++++++++
libmultipath/util.h | 1 +
multipath/multipath.conf.5 | 7 +++++--
multipathd/cli_handlers.c | 15 ++++++++++-----
multipathd/main.c | 1 +
16 files changed, 101 insertions(+), 26 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index ca91c55..6e9e67f 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -344,7 +344,8 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
rq_servact == MPATH_PROUT_REG_SA) ||
rq_servact == MPATH_PROUT_REG_IGN_SA)) {
memcpy(&mpp->reservation_key, paramp->sa_key, 8);
- if (update_prkey(alias, get_be64(mpp->reservation_key))) {
+ if (update_prkey_flags(alias, get_be64(mpp->reservation_key),
+ paramp->sa_flags)) {
condlog(0, "%s: failed to set prkey for multipathd.",
alias);
ret = MPATH_PR_DMMP_ERROR;
diff --git a/libmpathpersist/mpath_updatepr.c b/libmpathpersist/mpath_updatepr.c
index 8063e90..0aca28e 100644
--- a/libmpathpersist/mpath_updatepr.c
+++ b/libmpathpersist/mpath_updatepr.c
@@ -1,7 +1,5 @@
#include <stdio.h>
#include <unistd.h>
-#include <errno.h>
-
#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
@@ -11,6 +9,8 @@
#include <sys/un.h>
#include <poll.h>
#include <errno.h>
+#include <libudev.h>
+#include <mpath_persist.h>
#include "debug.h"
#include "mpath_cmd.h"
#include "uxsock.h"
@@ -59,11 +59,14 @@ int update_prflag(char *mapname, int set) {
return do_update_pr(mapname, (set)? "setprstatus" : "unsetprstatus");
}
-int update_prkey(char *mapname, uint64_t prkey) {
+int update_prkey_flags(char *mapname, uint64_t prkey, uint8_t sa_flags) {
char str[256];
+ char *flagstr = "";
+ if (sa_flags & MPATH_F_APTPL_MASK)
+ flagstr = ":aptpl";
if (prkey)
- sprintf(str, "setprkey key %" PRIx64, prkey);
+ sprintf(str, "setprkey key %" PRIx64 "%s", prkey, flagstr);
else
sprintf(str, "unsetprkey");
return do_update_pr(mapname, str);
diff --git a/libmpathpersist/mpathpr.h b/libmpathpersist/mpathpr.h
index 72feb60..5ea8cd6 100644
--- a/libmpathpersist/mpathpr.h
+++ b/libmpathpersist/mpathpr.h
@@ -46,7 +46,8 @@ 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 *mapname, int set);
-int update_prkey(char *mapname, uint64_t prkey);
+int update_prkey_flags(char *mapname, uint64_t prkey, uint8_t sa_flags);
+#define update_prkey(mapname, prkey) update_prkey_flags(mapname, prkey, 0)
void * mpath_alloc_prin_response(int prin_sa);
int update_map_pr(struct multipath *mpp);
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index f51786d..33f5269 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -7,7 +7,7 @@ SONAME = 0
DEVLIB = libmultipath.so
LIBS = $(DEVLIB).$(SONAME)
-CFLAGS += $(LIB_CFLAGS) -I$(mpathcmddir)
+CFLAGS += $(LIB_CFLAGS) -I$(mpathcmddir) -I$(mpathpersistdir)
LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd -lurcu -laio
diff --git a/libmultipath/config.h b/libmultipath/config.h
index 1bf708a..fcbe3fc 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -98,6 +98,7 @@ struct mpentry {
char * prio_args;
int prkey_source;
struct be64 reservation_key;
+ uint8_t sa_flags;
int pgpolicy;
int pgfailback;
int rr_weight;
@@ -197,6 +198,7 @@ struct config {
int prkey_source;
int all_tg_pt;
struct be64 reservation_key;
+ uint8_t sa_flags;
vector keywords;
vector mptable;
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 2557b8a..7ad0f5a 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -22,6 +22,8 @@
#include "util.h"
#include <errno.h>
#include <inttypes.h>
+#include <libudev.h>
+#include <mpath_persist.h>
#include "mpath_cmd.h"
#include "dict.h"
@@ -1012,10 +1014,12 @@ snprint_def_log_checker_err (struct config *conf, char * buff, int len,
}
static int
-set_reservation_key(vector strvec, struct be64 *be64_ptr, int *source_ptr)
+set_reservation_key(vector strvec, struct be64 *be64_ptr, uint8_t *flags_ptr,
+ int *source_ptr)
{
char *buff;
uint64_t prkey;
+ uint8_t sa_flags;
buff = set_value(strvec);
if (!buff)
@@ -1023,35 +1027,43 @@ set_reservation_key(vector strvec, struct be64 *be64_ptr, int *source_ptr)
if (strcmp(buff, "file") == 0) {
*source_ptr = PRKEY_SOURCE_FILE;
+ *flags_ptr = 0;
put_be64(*be64_ptr, 0);
FREE(buff);
return 0;
}
- if (parse_prkey(buff, &prkey) != 0) {
+ if (parse_prkey_flags(buff, &prkey, &sa_flags) != 0) {
FREE(buff);
return 1;
}
*source_ptr = PRKEY_SOURCE_CONF;
+ *flags_ptr = sa_flags;
put_be64(*be64_ptr, prkey);
FREE(buff);
return 0;
}
int
-print_reservation_key(char * buff, int len, struct be64 key, int source)
+print_reservation_key(char * buff, int len, struct be64 key, uint8_t flags,
+ int source)
{
+ char *flagstr = "";
if (source == PRKEY_SOURCE_NONE)
return 0;
if (source == PRKEY_SOURCE_FILE)
return snprintf(buff, len, "file");
- return snprintf(buff, len, "0x%" PRIx64, get_be64(key));
+ if (flags & MPATH_F_APTPL_MASK)
+ flagstr = ":aptpl";
+ return snprintf(buff, len, "0x%" PRIx64 "%s", get_be64(key),
+ flagstr);
}
static int
def_reservation_key_handler(struct config *conf, vector strvec)
{
return set_reservation_key(strvec, &conf->reservation_key,
+ &conf->sa_flags,
&conf->prkey_source);
}
@@ -1060,6 +1072,7 @@ snprint_def_reservation_key (struct config *conf, char * buff, int len,
const void * data)
{
return print_reservation_key(buff, len, conf->reservation_key,
+ conf->sa_flags,
conf->prkey_source);
}
@@ -1070,6 +1083,7 @@ mp_reservation_key_handler(struct config *conf, vector strvec)
if (!mpe)
return 1;
return set_reservation_key(strvec, &mpe->reservation_key,
+ &mpe->sa_flags,
&mpe->prkey_source);
}
@@ -1079,6 +1093,7 @@ snprint_mp_reservation_key (struct config *conf, char * buff, int len,
{
const struct mpentry * mpe = (const struct mpentry *)data;
return print_reservation_key(buff, len, mpe->reservation_key,
+ mpe->sa_flags,
mpe->prkey_source);
}
diff --git a/libmultipath/dict.h b/libmultipath/dict.h
index 7564892..a40ac66 100644
--- a/libmultipath/dict.h
+++ b/libmultipath/dict.h
@@ -15,6 +15,7 @@ int print_pgpolicy(char *buff, int len, long v);
int print_no_path_retry(char *buff, int len, long v);
int print_fast_io_fail(char *buff, int len, long v);
int print_dev_loss(char *buff, int len, unsigned long v);
-int print_reservation_key(char * buff, int len, struct be64 key, int source);
+int print_reservation_key(char * buff, int len, struct be64 key, uint8_t
+ flags, int source);
int print_off_int_undef(char *buff, int len, long v);
#endif /* _DICT_H */
diff --git a/libmultipath/prkey.c b/libmultipath/prkey.c
index 89b90ed..d645f81 100644
--- a/libmultipath/prkey.c
+++ b/libmultipath/prkey.c
@@ -11,6 +11,8 @@
#include <string.h>
#include <inttypes.h>
#include <errno.h>
+#include <libudev.h>
+#include <mpath_persist.h>
#define PRKEY_READ 0
#define PRKEY_WRITE 1
@@ -108,7 +110,8 @@ static int do_prkey(int fd, char *wwid, char *keystr, int cmd)
return 0;
}
-int get_prkey(struct config *conf, struct multipath *mpp, uint64_t *prkey)
+int get_prkey(struct config *conf, struct multipath *mpp, uint64_t *prkey,
+ uint8_t *sa_flags)
{
int fd;
int unused;
@@ -124,6 +127,9 @@ int get_prkey(struct config *conf, struct multipath *mpp, uint64_t *prkey)
ret = do_prkey(fd, mpp->wwid, keystr, PRKEY_READ);
if (ret)
goto out_file;
+ *sa_flags = 0;
+ if (strchr(keystr, 'X'))
+ *sa_flags = MPATH_F_APTPL_MASK;
ret = !!parse_prkey(keystr, prkey);
out_file:
close(fd);
@@ -131,7 +137,8 @@ out:
return ret;
}
-int set_prkey(struct config *conf, struct multipath *mpp, uint64_t prkey)
+int set_prkey(struct config *conf, struct multipath *mpp, uint64_t prkey,
+ uint8_t sa_flags)
{
int fd;
int can_write = 1;
@@ -141,6 +148,12 @@ int set_prkey(struct config *conf, struct multipath *mpp, uint64_t prkey)
if (!strlen(mpp->wwid))
goto out;
+ if (sa_flags & ~MPATH_F_APTPL_MASK) {
+ condlog(0, "unsupported pr flags, 0x%x",
+ sa_flags & ~MPATH_F_APTPL_MASK);
+ sa_flags &= MPATH_F_APTPL_MASK;
+ }
+
fd = open_file(conf->prkeys_file, &can_write, PRKEYS_FILE_HEADER);
if (fd < 0)
goto out;
@@ -149,7 +162,15 @@ int set_prkey(struct config *conf, struct multipath *mpp, uint64_t prkey)
goto out_file;
}
if (prkey) {
- snprintf(keystr, PRKEY_SIZE, "0x%016" PRIx64, prkey);
+ /* using the capitalization of the 'x' is a hack, but
+ * it's unlikely that mpath_persist will support more options
+ * since sg_persist doesn't, and this lets us keep the
+ * same file format as before instead of needing to change
+ * the format of the prkeys file */
+ if (sa_flags)
+ snprintf(keystr, PRKEY_SIZE, "0X%016" PRIx64, prkey);
+ else
+ snprintf(keystr, PRKEY_SIZE, "0x%016" PRIx64, prkey);
keystr[PRKEY_SIZE - 1] = '\0';
ret = do_prkey(fd, mpp->wwid, keystr, PRKEY_WRITE);
}
diff --git a/libmultipath/prkey.h b/libmultipath/prkey.h
index 4028e70..6739191 100644
--- a/libmultipath/prkey.h
+++ b/libmultipath/prkey.h
@@ -13,7 +13,9 @@
"# prkey wwid\n" \
"#\n"
-int set_prkey(struct config *conf, struct multipath *mpp, uint64_t prkey);
-int get_prkey(struct config *conf, struct multipath *mpp, uint64_t *prkey);
+int set_prkey(struct config *conf, struct multipath *mpp, uint64_t prkey,
+ uint8_t sa_flags);
+int get_prkey(struct config *conf, struct multipath *mpp, uint64_t *prkey,
+ uint8_t *sa_flags);
#endif /* _PRKEY_H */
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index 9ca1355..62a6893 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -106,6 +106,7 @@ do { \
if (src && src->prkey_source != PRKEY_SOURCE_NONE) { \
mp->prkey_source = src->prkey_source; \
mp->reservation_key = src->reservation_key; \
+ mp->sa_flags = src->sa_flags; \
origin = msg; \
goto out; \
} \
@@ -703,18 +704,19 @@ int select_reservation_key(struct config *conf, struct multipath *mp)
do_prkey_set(mp->mpe, multipaths_origin);
do_prkey_set(conf, conf_origin);
put_be64(mp->reservation_key, 0);
+ mp->sa_flags = 0;
mp->prkey_source = PRKEY_SOURCE_NONE;
return 0;
out:
if (mp->prkey_source == PRKEY_SOURCE_FILE) {
from_file = " (from prkeys file)";
- if (get_prkey(conf, mp, &prkey) != 0)
+ if (get_prkey(conf, mp, &prkey, &mp->sa_flags) != 0)
put_be64(mp->reservation_key, 0);
else
put_be64(mp->reservation_key, prkey);
}
print_reservation_key(buff, PRKEY_SIZE, mp->reservation_key,
- mp->prkey_source);
+ mp->sa_flags, mp->prkey_source);
condlog(3, "%s: reservation_key = %s %s%s", mp->alias, buff, origin,
from_file);
return 0;
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 0194b1e..987479f 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -367,6 +367,7 @@ struct multipath {
/* persistent management data*/
int prkey_source;
struct be64 reservation_key;
+ uint8_t sa_flags;
unsigned char prflag;
int all_tg_pt;
struct gen_multipath generic_mp;
diff --git a/libmultipath/util.c b/libmultipath/util.c
index 7251ad0..8d8fcc8 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -10,6 +10,8 @@
#include <dirent.h>
#include <unistd.h>
#include <errno.h>
+#include <libudev.h>
+#include <mpath_persist.h>
#include "util.h"
#include "debug.h"
@@ -435,6 +437,20 @@ int parse_prkey(char *ptr, uint64_t *prkey)
return 0;
}
+int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags)
+{
+ char *flagstr;
+
+ flagstr = strchr(ptr, ':');
+ *flags = 0;
+ if (flagstr) {
+ *flagstr++ = '\0';
+ if (strlen(flagstr) == 5 && strcmp(flagstr, "aptpl") == 0)
+ *flags = MPATH_F_APTPL_MASK;
+ }
+ return parse_prkey(ptr, prkey);
+}
+
int safe_write(int fd, const void *buf, size_t count)
{
while (count > 0) {
diff --git a/libmultipath/util.h b/libmultipath/util.h
index a3ab894..56cec76 100644
--- a/libmultipath/util.h
+++ b/libmultipath/util.h
@@ -19,6 +19,7 @@ void setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached);
int systemd_service_enabled(const char *dev);
int get_linux_version_code(void);
int parse_prkey(char *ptr, uint64_t *prkey);
+int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags);
int safe_write(int fd, const void *buf, size_t count);
#define KERNEL_VERSION(maj, min, ptc) ((((maj) * 256) + (min)) * 256 + (ptc))
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 31f4585..30d8598 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -726,14 +726,17 @@ This is the service action reservation key used by mpathpersist. It must be
set for all multipath devices using persistent reservations, and it must be
the same as the RESERVATION KEY field of the PERSISTENT RESERVE OUT parameter
list which contains an 8-byte value provided by the application client to the
-device server to identify the I_T nexus.
+device server to identify the I_T nexus. If the \fI--param-aptpl\fR option is
+used when registering the key with mpathpersist, \fB:aptpl\fR must be appended
+to the end of the reservation key.
.RS
.PP
Alternatively, this can be set to \fBfile\fR, which will store the RESERVATION
KEY registered by mpathpersist in the \fIprkeys_file\fR. multipathd will then
use this key to register additional paths as they appear. When the
registration is removed, the RESERVATION KEY is removed from the
-\fIprkeys_file\fR.
+\fIprkeys_file\fR. The prkeys file will automatically keep track of whether
+the key was registered with \fI--param-aptpl\fR.
.TP
The default is: \fB<unset>\fR
.RE
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index ba50fb8..6452796 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -21,6 +21,7 @@
#include "sysfs.h"
#include <errno.h>
#include <libudev.h>
+#include <mpath_persist.h>
#include "util.h"
#include "prkey.h"
#include "propsel.h"
@@ -1463,6 +1464,7 @@ cli_getprkey(void * v, char ** reply, int * len, void * data)
struct multipath * mpp;
struct vectors * vecs = (struct vectors *)data;
char *mapname = get_keyparam(v, MAP);
+ char *flagstr = "";
mapname = convert_dev(mapname, 0);
condlog(3, "%s: get persistent reservation key (operator)", mapname);
@@ -1478,8 +1480,10 @@ cli_getprkey(void * v, char ** reply, int * len, void * data)
*len = strlen(*reply) + 1;
return 0;
}
- snprintf(*reply, 20, "0x%" PRIx64 "\n",
- get_be64(mpp->reservation_key));
+ if (mpp->sa_flags & MPATH_F_APTPL_MASK)
+ flagstr = ":aptpl";
+ snprintf(*reply, 20, "0x%" PRIx64 "%s\n",
+ get_be64(mpp->reservation_key), flagstr);
(*reply)[19] = '\0';
*len = strlen(*reply) + 1;
return 0;
@@ -1503,7 +1507,7 @@ cli_unsetprkey(void * v, char ** reply, int * len, void * data)
conf = get_multipath_config();
pthread_cleanup_push(put_multipath_config, conf);
- ret = set_prkey(conf, mpp, 0);
+ ret = set_prkey(conf, mpp, 0, 0);
pthread_cleanup_pop(1);
return ret;
@@ -1517,6 +1521,7 @@ cli_setprkey(void * v, char ** reply, int * len, void * data)
char *mapname = get_keyparam(v, MAP);
char *keyparam = get_keyparam(v, KEY);
uint64_t prkey;
+ uint8_t flags;
int ret;
struct config *conf;
@@ -1527,14 +1532,14 @@ cli_setprkey(void * v, char ** reply, int * len, void * data)
if (!mpp)
return 1;
- if (parse_prkey(keyparam, &prkey) != 0) {
+ if (parse_prkey_flags(keyparam, &prkey, &flags) != 0) {
condlog(0, "%s: invalid prkey : '%s'", mapname, keyparam);
return 1;
}
conf = get_multipath_config();
pthread_cleanup_push(put_multipath_config, conf);
- ret = set_prkey(conf, mpp, prkey);
+ ret = set_prkey(conf, mpp, prkey, flags);
pthread_cleanup_pop(1);
return ret;
diff --git a/multipathd/main.c b/multipathd/main.c
index d40c416..6b1e782 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -3089,6 +3089,7 @@ void * mpath_pr_event_handler_fn (void * pathp )
param= malloc(sizeof(struct prout_param_descriptor));
memset(param, 0 , sizeof(struct prout_param_descriptor));
+ param->sa_flags = mpp->sa_flags;
memcpy(param->sa_key, &mpp->reservation_key, 8);
param->num_transportid = 0;
--
2.7.4

View File

@ -1,156 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 24 Apr 2017 09:39:57 -0500
Subject: [PATCH] RH: trigger change uevent on new device creation
When multipath first sees a path device with user_friendly names
enabled, it can't know if the device should be multipathed. This means
that it will not claim the device in udev. If the device is eventually
multipathed, multipath should trigger a change uevent to update the udev
database to claim the device.
This also reverts commit 64e27ec066a001012f44550f095c93443e91d845 and
commit ffbb886a8a16cb063d669cd76a1e656fd3ec8c4b.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/configure.c | 26 ++++++++++++++++++++++++--
libmultipath/configure.h | 1 +
libmultipath/wwids.c | 4 ++--
multipath/main.c | 12 +-----------
multipathd/main.c | 7 ++-----
5 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 61f68f8..81b0bc4 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -444,6 +444,28 @@ trigger_udev_change(const struct multipath *mpp)
udev_device_unref(udd);
}
+void
+trigger_paths_udev_change(const struct multipath *mpp)
+{
+ struct pathgroup * pgp;
+ struct path * pp;
+ int i, j;
+
+ if (!mpp || !mpp->pg)
+ return;
+
+ vector_foreach_slot (mpp->pg, pgp, i) {
+ if (!pgp->paths)
+ continue;
+ vector_foreach_slot(pgp->paths, pp, j) {
+ if (!pp->udev)
+ continue;
+ sysfs_attr_set_value(pp->udev, "uevent", "change",
+ strlen("change"));
+ }
+ }
+}
+
static int
is_mpp_known_to_udev(const struct multipath *mpp)
{
@@ -842,8 +864,8 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
* succeeded
*/
mpp->force_udev_reload = 0;
- if (mpp->action == ACT_CREATE)
- remember_wwid(mpp->wwid);
+ if (mpp->action == ACT_CREATE && remember_wwid(mpp->wwid) == 1)
+ trigger_paths_udev_change(mpp);
if (!is_daemon) {
/* multipath client mode */
dm_switchgroup(mpp->alias, mpp->bestpg);
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
index 27a7e6f..545cbc2 100644
--- a/libmultipath/configure.h
+++ b/libmultipath/configure.h
@@ -37,3 +37,4 @@ int get_refwwid (enum mpath_cmds cmd, char * dev, enum devtypes dev_type,
vector pathvec, char **wwid);
int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh, int is_daemon);
struct udev_device *get_udev_device(const char *dev, enum devtypes dev_type);
+void trigger_paths_udev_change(const struct multipath *mpp);
diff --git a/libmultipath/wwids.c b/libmultipath/wwids.c
index 82cef12..6c88a3b 100644
--- a/libmultipath/wwids.c
+++ b/libmultipath/wwids.c
@@ -321,7 +321,7 @@ remember_wwid(char *wwid)
condlog(3, "wrote wwid %s to wwids file", wwid);
else
condlog(4, "wwid %s already in wwids file", wwid);
- return 0;
+ return ret;
}
int remember_cmdline_wwid(void)
@@ -355,7 +355,7 @@ int remember_cmdline_wwid(void)
next++;
}
if (strlen(ptr)) {
- if (remember_wwid(ptr) != 0)
+ if (remember_wwid(ptr) < 0)
ret = -1;
}
else {
diff --git a/multipath/main.c b/multipath/main.c
index baf6759..12d6f15 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -427,7 +427,7 @@ configure (struct config *conf, enum mpath_cmds cmd,
}
if (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",
@@ -782,16 +782,6 @@ main (int argc, char *argv[])
}
}
- /*
- * FIXME: new device detection with find_multipaths currently
- * doesn't work reliably.
- */
- if (cmd == CMD_VALID_PATH &&
- conf->find_multipaths && conf->ignore_wwids) {
- condlog(2, "ignoring -i flag because find_multipath is set in multipath.conf");
- conf->ignore_wwids = 0;
- }
-
if (getuid() != 0) {
fprintf(stderr, "need to be root\n");
exit(1);
diff --git a/multipathd/main.c b/multipathd/main.c
index 84af946..b3f319a 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2323,7 +2323,8 @@ configure (struct vectors * vecs)
sync_maps_state(mpvec);
vector_foreach_slot(mpvec, mpp, i){
- remember_wwid(mpp->wwid);
+ if (remember_wwid(mpp->wwid) == 1)
+ trigger_paths_udev_change(mpp);
update_map_pr(mpp);
}
@@ -2403,10 +2404,6 @@ reconfigure (struct vectors * vecs)
conf->verbosity = verbosity;
if (bindings_read_only)
conf->bindings_read_only = bindings_read_only;
- if (conf->find_multipaths) {
- condlog(2, "find_multipaths is set: -n is implied");
- ignore_new_devs = 1;
- }
if (ignore_new_devs)
conf->ignore_new_devs = ignore_new_devs;
uxsock_timeout = conf->uxsock_timeout;
--
2.7.4

View File

@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 5 Jun 2018 15:31:55 -0500
Subject: [PATCH] multipath: don't check timestamps without a path
If a path was blacklisted, pathvec could exist but have no path in it.
print_cmd_valid wasn't checking this before calling
find_multipaths_check_timeout(). This was causing it to dereference a
NULL pointer in these cases.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/multipath/main.c b/multipath/main.c
index c69e996..3f0a6aa 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -482,10 +482,8 @@ static int print_cmd_valid(int k, const vector pathvec,
pp, pp->find_multipaths_timeout, &until);
if (wait != FIND_MULTIPATHS_WAITING)
k = 1;
- } else if (pathvec != NULL) {
- pp = VECTOR_SLOT(pathvec, 0);
+ } else if (pathvec != NULL && (pp = VECTOR_SLOT(pathvec, 0)))
wait = find_multipaths_check_timeout(pp, 0, &until);
- }
if (wait == FIND_MULTIPATHS_WAITING)
printf("FIND_MULTIPATHS_WAIT_UNTIL=\"%ld.%06ld\"\n",
until.tv_sec, until.tv_nsec/1000);
--
2.7.4

View File

@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 8 Jun 2018 17:12:37 -0500
Subject: [PATCH] libmultipath: fix detect alua corner case
If retain_attach_hw_handler = no, then the paths tpgs state will never
be checked, and the multipath device will always select the alua
handler, if no other handler is selected. the paths tpgs state
should be checked, regardless of the retain_hwhandler value.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/propsel.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index 62a6893..f626c74 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -403,9 +403,11 @@ int select_hwhandler(struct config *conf, struct multipath *mp)
bool all_tpgs = true;
dh_state = &handler[2];
+
+ vector_foreach_slot(mp->paths, pp, i)
+ all_tpgs = all_tpgs && (pp->tpgs > 0);
if (mp->retain_hwhandler != RETAIN_HWHANDLER_OFF) {
vector_foreach_slot(mp->paths, pp, i) {
- all_tpgs = all_tpgs && (pp->tpgs > 0);
if (get_dh_state(pp, dh_state, sizeof(handler) - 2) > 0
&& strcmp(dh_state, "detached")) {
memcpy(handler, "1 ", 2);
--
2.7.4

View File

@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 8 Jun 2018 17:23:07 -0500
Subject: [PATCH] multipath: fix setting conf->version
Commit d3b71498 stopped multipath from setting conf->version. Instead,
it was always being set to 0.0.0. Multipathd was still setting this
correctly.
Fixes: d3b71498 "multipath: fix rcu thread cancellation hang"
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/devmapper.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index f2befad..8136d15 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -245,13 +245,13 @@ void libmp_dm_init(void)
int verbosity;
unsigned int version[3];
+ if (dm_prereq(version))
+ exit(1);
conf = get_multipath_config();
verbosity = conf->verbosity;
- memcpy(version, conf->version, sizeof(version));
+ memcpy(conf->version, version, sizeof(version));
put_multipath_config(conf);
dm_init(verbosity);
- if (dm_prereq(version))
- exit(1);
dm_udev_set_sync_support(libmp_dm_udev_sync);
}
--
2.7.4

View File

@ -5,17 +5,20 @@ Subject: [PATCH] RH: fixup udev rules for redhat
The multipath rules need to run after scsi_id is run. This means moving The multipath rules need to run after scsi_id is run. This means moving
them after 60-persistent-storage.rules for redhat. Redhat also uses a them after 60-persistent-storage.rules for redhat. Redhat also uses a
different naming scheme for partitions than SuSE. different naming scheme for partitions than SuSE. Also, there are some
false warnings that gcc throws because of the changed options. Fix these
too.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
--- ---
Makefile.inc | 2 +- Makefile.inc | 2 +-
kpartx/kpartx.rules | 2 +- kpartx/kpartx.rules | 2 +-
multipath/Makefile | 4 ++-- multipath/Makefile | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-) multipath/main.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc diff --git a/Makefile.inc b/Makefile.inc
index 57a1835..f589ab0 100644 index af2f5ba..0b271ea 100644
--- a/Makefile.inc --- a/Makefile.inc
+++ b/Makefile.inc +++ b/Makefile.inc
@@ -51,7 +51,7 @@ endif @@ -51,7 +51,7 @@ endif
@ -61,6 +64,19 @@ index 0828a8f..b9bbb3c 100644
$(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz
$(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz $(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
diff --git a/multipath/main.c b/multipath/main.c
index 3f0a6aa..6fdde03 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -389,7 +389,7 @@ static int find_multipaths_check_timeout(const struct path *pp, long tmo,
struct timespec now, ftimes[2], tdiff;
struct stat st;
long fd;
- int r, err, retries = 0;
+ int r, err = 0, retries = 0;
clock_gettime(CLOCK_REALTIME, &now);
-- --
2.7.4 2.7.4

View File

@ -51,10 +51,10 @@ index ee396e2..19d4697 100644
void void
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 8dae0f4..b1d33d2 100644 index 30d8598..c45da9f 100644
--- a/multipath/multipath.conf.5 --- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5
@@ -1131,10 +1131,6 @@ The \fIWorld Wide Identification\fR of a device. @@ -1179,10 +1179,6 @@ The \fIWorld Wide Identification\fR of a device.
.TP .TP
.B property .B property
Regular expression of the udev property to be whitelisted. Regular expression of the udev property to be whitelisted.
@ -65,7 +65,7 @@ index 8dae0f4..b1d33d2 100644
.TP .TP
.B device .B device
Subsection for the device description. This subsection recognizes the Subsection for the device description. This subsection recognizes the
@@ -1145,8 +1141,14 @@ keywords. For a full description of these keywords please see the \fIdevices\fR @@ -1193,8 +1189,14 @@ keywords. For a full description of these keywords please see the \fIdevices\fR
section description. section description.
.LP .LP
The \fIproperty\fR whitelist handling is different from the usual The \fIproperty\fR whitelist handling is different from the usual

View File

@ -20,7 +20,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 files changed, 20 insertions(+) 5 files changed, 20 insertions(+)
diff --git a/libmultipath/config.c b/libmultipath/config.c diff --git a/libmultipath/config.c b/libmultipath/config.c
index 085a3e1..83d26be 100644 index 5872927..0607403 100644
--- a/libmultipath/config.c --- a/libmultipath/config.c
+++ b/libmultipath/config.c +++ b/libmultipath/config.c
@@ -26,6 +26,7 @@ @@ -26,6 +26,7 @@
@ -31,7 +31,7 @@ index 085a3e1..83d26be 100644
static int static int
hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2) hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2)
@@ -656,6 +657,20 @@ load_config (char * file) @@ -658,6 +659,20 @@ load_config (char * file)
factorize_hwtable(conf->hwtable, builtin_hwtable_size); factorize_hwtable(conf->hwtable, builtin_hwtable_size);
} }
@ -53,7 +53,7 @@ index 085a3e1..83d26be 100644
conf->processed_main_config = 1; conf->processed_main_config = 1;
diff --git a/libmultipath/config.h b/libmultipath/config.h diff --git a/libmultipath/config.h b/libmultipath/config.h
index 329f3ed..bc34eb7 100644 index fcbe3fc..3a42435 100644
--- a/libmultipath/config.h --- a/libmultipath/config.h
+++ b/libmultipath/config.h +++ b/libmultipath/config.h
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
@ -65,10 +65,10 @@ index 329f3ed..bc34eb7 100644
/* /*
* In kernel, fast_io_fail == 0 means immediate failure on rport delete. * In kernel, fast_io_fail == 0 means immediate failure on rport delete.
diff --git a/multipath/multipath.rules b/multipath/multipath.rules diff --git a/multipath/multipath.rules b/multipath/multipath.rules
index 6f8ee2b..d1a484e 100644 index d658073..b3f54d7 100644
--- a/multipath/multipath.rules --- a/multipath/multipath.rules
+++ b/multipath/multipath.rules +++ b/multipath/multipath.rules
@@ -7,6 +7,7 @@ IMPORT{cmdline}="nompath" @@ -9,6 +9,7 @@ IMPORT{cmdline}="nompath"
ENV{nompath}=="?*", GOTO="end_mpath" ENV{nompath}=="?*", GOTO="end_mpath"
IMPORT{cmdline}="multipath" IMPORT{cmdline}="multipath"
ENV{multipath}=="off", GOTO="end_mpath" ENV{multipath}=="off", GOTO="end_mpath"
@ -77,10 +77,10 @@ index 6f8ee2b..d1a484e 100644
ENV{DEVTYPE}!="partition", GOTO="test_dev" ENV{DEVTYPE}!="partition", GOTO="test_dev"
IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH" IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH"
diff --git a/multipathd/multipathd.8 b/multipathd/multipathd.8 diff --git a/multipathd/multipathd.8 b/multipathd/multipathd.8
index 5c96680..0515211 100644 index e78ac9e..09cdead 100644
--- a/multipathd/multipathd.8 --- a/multipathd/multipathd.8
+++ b/multipathd/multipathd.8 +++ b/multipathd/multipathd.8
@@ -39,6 +39,8 @@ map regains its maximum performance and redundancy. @@ -38,6 +38,8 @@ map regains its maximum performance and redundancy.
This daemon executes the external \fBmultipath\fR tool when events occur. This daemon executes the external \fBmultipath\fR tool when events occur.
In turn, the multipath tool signals the multipathd daemon when it is done with In turn, the multipath tool signals the multipathd daemon when it is done with
devmap reconfiguration, so that it can refresh its failed path list. devmap reconfiguration, so that it can refresh its failed path list.

View File

@ -13,7 +13,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 16 insertions(+), 8 deletions(-) 1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc diff --git a/Makefile.inc b/Makefile.inc
index f589ab0..c07023a 100644 index 0b271ea..5ff69a3 100644
--- a/Makefile.inc --- a/Makefile.inc
+++ b/Makefile.inc +++ b/Makefile.inc
@@ -85,14 +85,22 @@ TEST_CC_OPTION = $(shell \ @@ -85,14 +85,22 @@ TEST_CC_OPTION = $(shell \

View File

@ -21,10 +21,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
create mode 100644 multipath/mpathconf.8 create mode 100644 multipath/mpathconf.8
diff --git a/libmultipath/config.c b/libmultipath/config.c diff --git a/libmultipath/config.c b/libmultipath/config.c
index 83d26be..a50f41a 100644 index 0607403..5c98e48 100644
--- a/libmultipath/config.c --- a/libmultipath/config.c
+++ b/libmultipath/config.c +++ b/libmultipath/config.c
@@ -659,6 +659,7 @@ load_config (char * file) @@ -661,6 +661,7 @@ load_config (char * file)
} else { } else {
condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices."); condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");

View File

@ -22,13 +22,13 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 files changed, 58 insertions(+), 3 deletions(-) 5 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/libmultipath/wwids.c b/libmultipath/wwids.c diff --git a/libmultipath/wwids.c b/libmultipath/wwids.c
index 8c21b33..82cef12 100644 index 53e7951..39e08cd 100644
--- a/libmultipath/wwids.c --- a/libmultipath/wwids.c
+++ b/libmultipath/wwids.c +++ b/libmultipath/wwids.c
@@ -323,3 +323,47 @@ remember_wwid(char *wwid) @@ -443,3 +443,47 @@ int op ## _wwid(const char *wwid) \
condlog(4, "wwid %s already in wwids file", wwid); declare_failed_wwid_op(is_failed, false)
return 0; declare_failed_wwid_op(mark_failed, true)
} declare_failed_wwid_op(unmark_failed, true)
+ +
+int remember_cmdline_wwid(void) +int remember_cmdline_wwid(void)
+{ +{
@ -74,21 +74,22 @@ index 8c21b33..82cef12 100644
+ return ret; + return ret;
+} +}
diff --git a/libmultipath/wwids.h b/libmultipath/wwids.h diff --git a/libmultipath/wwids.h b/libmultipath/wwids.h
index 9527012..b665232 100644 index 0c6ee54..e32a0b0 100644
--- a/libmultipath/wwids.h --- a/libmultipath/wwids.h
+++ b/libmultipath/wwids.h +++ b/libmultipath/wwids.h
@@ -17,5 +17,6 @@ int remember_wwid(char *wwid); @@ -17,6 +17,7 @@ int remember_wwid(char *wwid);
int check_wwids_file(char *wwid, int write_wwid); int check_wwids_file(char *wwid, int write_wwid);
int remove_wwid(char *wwid); int remove_wwid(char *wwid);
int replace_wwids(vector mp); int replace_wwids(vector mp);
+int remember_cmdline_wwid(void); +int remember_cmdline_wwid(void);
#endif /* _WWIDS_H */ enum {
WWID_IS_NOT_FAILED = 0,
diff --git a/multipath/main.c b/multipath/main.c diff --git a/multipath/main.c b/multipath/main.c
index d08c688..baf6759 100644 index 6fdde03..7bac232 100644
--- a/multipath/main.c --- a/multipath/main.c
+++ b/multipath/main.c +++ b/multipath/main.c
@@ -104,7 +104,7 @@ usage (char * progname) @@ -109,7 +109,7 @@ usage (char * progname)
{ {
fprintf (stderr, VERSION_STRING); fprintf (stderr, VERSION_STRING);
fprintf (stderr, "Usage:\n"); fprintf (stderr, "Usage:\n");
@ -97,7 +98,7 @@ index d08c688..baf6759 100644
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [-R num] [dev]\n", progname); fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [-R num] [dev]\n", progname);
fprintf (stderr, " %s -F [-v lvl] [-R num]\n", progname); fprintf (stderr, " %s -F [-v lvl] [-R num]\n", progname);
fprintf (stderr, " %s -t\n", progname); fprintf (stderr, " %s -t\n", progname);
@@ -118,6 +118,8 @@ usage (char * progname) @@ -123,6 +123,8 @@ usage (char * progname)
" -f flush a multipath device map\n" " -f flush a multipath device map\n"
" -F flush all multipath device maps\n" " -F flush all multipath device maps\n"
" -a add a device wwid to the wwids file\n" " -a add a device wwid to the wwids file\n"
@ -106,7 +107,7 @@ index d08c688..baf6759 100644
" -c check if a device should be a path in a multipath device\n" " -c check if a device should be a path in a multipath device\n"
" -C check if a multipath device has usable paths\n" " -C check if a multipath device has usable paths\n"
" -q allow queue_if_no_path when multipathd is not running\n" " -q allow queue_if_no_path when multipathd is not running\n"
@@ -672,7 +674,7 @@ main (int argc, char *argv[]) @@ -907,7 +909,7 @@ main (int argc, char *argv[])
exit(1); exit(1);
multipath_conf = conf; multipath_conf = conf;
conf->retrigger_tries = 0; conf->retrigger_tries = 0;
@ -115,7 +116,7 @@ index d08c688..baf6759 100644
switch(arg) { switch(arg) {
case 1: printf("optarg : %s\n",optarg); case 1: printf("optarg : %s\n",optarg);
break; break;
@@ -739,6 +741,10 @@ main (int argc, char *argv[]) @@ -974,6 +976,10 @@ main (int argc, char *argv[])
case 't': case 't':
r = dump_config(conf); r = dump_config(conf);
goto out_free_config; goto out_free_config;
@ -127,7 +128,7 @@ index d08c688..baf6759 100644
usage(argv[0]); usage(argv[0]);
exit(0); exit(0);
diff --git a/multipath/multipath.8 b/multipath/multipath.8 diff --git a/multipath/multipath.8 b/multipath/multipath.8
index 56f8703..9fc2317 100644 index 914a8cb..8c6a4c1 100644
--- a/multipath/multipath.8 --- a/multipath/multipath.8
+++ b/multipath/multipath.8 +++ b/multipath/multipath.8
@@ -25,7 +25,7 @@ multipath \- Device mapper target autoconfig. @@ -25,7 +25,7 @@ multipath \- Device mapper target autoconfig.
@ -139,7 +140,7 @@ index 56f8703..9fc2317 100644
.RB [\| \-p\ \c .RB [\| \-p\ \c
.IR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|] .IR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
.RB [\| \-R\ \c .RB [\| \-R\ \c
@@ -128,6 +128,9 @@ Add the WWID for the specified device to the WWIDs file. @@ -135,6 +135,9 @@ Add the WWID for the specified device to the WWIDs file.
Check if the device specified in the program environment should be Check if the device specified in the program environment should be
a path in a multipath device. a path in a multipath device.
. .

View File

@ -16,10 +16,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 files changed, 35 insertions(+), 6 deletions(-) 3 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 8f9944a..7fcd401 100644 index 7ad0f5a..ab808d6 100644
--- a/libmultipath/dict.c --- a/libmultipath/dict.c
+++ b/libmultipath/dict.c +++ b/libmultipath/dict.c
@@ -53,6 +53,21 @@ set_str(vector strvec, void *ptr) @@ -55,6 +55,21 @@ set_str(vector strvec, void *ptr)
} }
static int static int
@ -41,7 +41,7 @@ index 8f9944a..7fcd401 100644
set_yes_no(vector strvec, void *ptr) set_yes_no(vector strvec, void *ptr)
{ {
char * buff; char * buff;
@@ -1201,7 +1216,7 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \ @@ -1271,7 +1286,7 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \
if (!conf->option) \ if (!conf->option) \
return 1; \ return 1; \
\ \
@ -50,7 +50,7 @@ index 8f9944a..7fcd401 100644
if (!buff) \ if (!buff) \
return 1; \ return 1; \
\ \
@@ -1217,7 +1232,7 @@ ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \ @@ -1287,7 +1302,7 @@ ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \
if (!conf->option) \ if (!conf->option) \
return 1; \ return 1; \
\ \
@ -59,7 +59,7 @@ index 8f9944a..7fcd401 100644
if (!buff) \ if (!buff) \
return 1; \ return 1; \
\ \
@@ -1318,16 +1333,16 @@ device_handler(struct config *conf, vector strvec) @@ -1388,16 +1403,16 @@ device_handler(struct config *conf, vector strvec)
return 0; return 0;
} }

View File

@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 7 Jun 2018 17:43:52 -0500
Subject: [PATCH] RH: reset default find_mutipaths value to off
Upstream has changed to default find_multipaths to "strict". For now
Redhat will retain the previous default of "off".
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/defaults.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index f076b4b..70ba98a 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -17,7 +17,7 @@
#define DEFAULT_NO_PATH_RETRY NO_PATH_RETRY_UNDEF
#define DEFAULT_VERBOSITY 2
#define DEFAULT_REASSIGN_MAPS 0
-#define DEFAULT_FIND_MULTIPATHS FIND_MULTIPATHS_STRICT
+#define DEFAULT_FIND_MULTIPATHS FIND_MULTIPATHS_OFF
#define DEFAULT_FAST_IO_FAIL 5
#define DEFAULT_DEV_LOSS_TMO 600
#define DEFAULT_RETAIN_HWHANDLER RETAIN_HWHANDLER_ON
--
2.7.4

View File

@ -1,41 +1,50 @@
Summary: Tools to manage multipath devices using device-mapper Summary: Tools to manage multipath devices using device-mapper
Name: device-mapper-multipath Name: device-mapper-multipath
Version: 0.7.6 Version: 0.7.7
Release: 4.git1cb704b%{?dist} Release: 1%{?dist}
License: GPL+ License: GPLv2
Group: System Environment/Base Group: System Environment/Base
URL: http://christophe.varoqui.free.fr/ URL: http://christophe.varoqui.free.fr/
# The source for this package was pulled from upstream's git repo. Use the # The source for this package was pulled from upstream's git repo. Use the
# following command to generate the tarball # following command to generate the tarball
# curl "https://git.opensvc.com/?p=multipath-tools/.git;a=snapshot;h=1cb704b;sf=tgz" -o multipath-tools-1cb704b.tgz # curl "https://git.opensvc.com/?p=multipath-tools/.git;a=snapshot;h=refs/tags/0.7.7;sf=tgz" -o multipath-tools-0.7.7.tgz
Source0: multipath-tools-1cb704b.tgz Source0: multipath-tools-0.7.7.tgz
Source1: multipath.conf Source1: multipath.conf
Patch0001: 0001-multipathd-remove-incorrect-pthread_testcancel.patch Patch0001: 0001-multipath-tools-add-RDAC-SUN-ArrayStorage-to-hwtable.patch
Patch0002: 0002-multipath-add-comments.patch Patch0002: 0002-multipath-tools-remove-c-from-__cpluscplus-misspelle.patch
Patch0003: 0003-multipathd-minor-dmevents-polling-code-cleanups.patch Patch0003: 0003-multipath-tools-remove-emacs-autoconfig-of-kpartx-gp.patch
Patch0004: 0004-multipathd-remove-unneeded-function-parameter.patch Patch0004: 0004-multipath-tools-replace-FSF-address-with-a-www-point.patch
Patch0005: 0005-mpathcmd-fix-libmpathcmd-license.patch Patch0005: 0005-multipath-tools-Remove-trailing-leading-whitespaces-.patch
Patch0006: 0006-libmultipath-don-t-print-undefined-values.patch Patch0006: 0006-multipath-tools-fix-compilation-with-musl-libc.patch
Patch0007: 0007-libmultipath-Fix-logic-in-should_multipath.patch Patch0007: 0007-multipath-tools-add-x-to-doc-preclean.pl-and-split-m.patch
Patch0008: 0008-multipathd-add-failures-path-format-wildcard.patch Patch0008: 0008-multipath-tools-refresh-kernel-doc-from-kernel-sourc.patch
Patch0009: 0009-multipathd-fix-reservation_key-check.patch Patch0009: 0009-multipath-tools-configure-hitachi-ams2000-and-hus100.patch
Patch0010: 0010-libmultipath-print-correct-default-for-delay_-_check.patch Patch0010: 0010-libmultipath-don-t-reject-maps-with-undefined-prio.patch
Patch0011: 0011-multipath.conf.5-clarify-property-whitelist-handling.patch Patch0011: 0011-multipathd-handle-errors-in-uxlsnr-as-fatal.patch
Patch0012: 0012-RH-fixup-udev-rules-for-redhat.patch Patch0012: 0012-libmultipath-fix-error-parsing-find_multipaths-stric.patch
Patch0013: 0013-RH-Remove-the-property-blacklist-exception-builtin.patch Patch0013: 0013-libmultipath-print-correct-default-for-delay_-_check.patch
Patch0014: 0014-RH-don-t-start-without-a-config-file.patch Patch0014: 0014-multipath.conf.5-clarify-property-whitelist-handling.patch
Patch0015: 0015-RH-use-rpm-optflags-if-present.patch Patch0015: 0015-mpathpersist-add-all_tg_pt-option.patch
Patch0016: 0016-RH-add-mpathconf.patch Patch0016: 0016-libmultipath-remove-rbd-code.patch
Patch0017: 0017-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch Patch0017: 0017-mpathpersist-fix-aptpl-support.patch
Patch0018: 0018-RH-trigger-change-uevent-on-new-device-creation.patch Patch0018: 0018-multipath-don-t-check-timestamps-without-a-path.patch
Patch0019: 0019-RH-warn-on-invalid-regex-instead-of-failing.patch Patch0019: 0019-libmultipath-fix-detect-alua-corner-case.patch
Patch0020: 0020-multipath-fix-setting-conf-version.patch
Patch0021: 0021-RH-fixup-udev-rules-for-redhat.patch
Patch0022: 0022-RH-Remove-the-property-blacklist-exception-builtin.patch
Patch0023: 0023-RH-don-t-start-without-a-config-file.patch
Patch0024: 0024-RH-use-rpm-optflags-if-present.patch
Patch0025: 0025-RH-add-mpathconf.patch
Patch0026: 0026-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
Patch0027: 0027-RH-warn-on-invalid-regex-instead-of-failing.patch
Patch0028: 0028-RH-reset-default-find_mutipaths-value-to-off.patch
# runtime # runtime
Requires: %{name}-libs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release}
Requires: kpartx = %{version}-%{release} Requires: kpartx = %{version}-%{release}
Requires: device-mapper >= 1.02.96 Requires: device-mapper >= 1.02.96
Requires: initscripts Requires: initscripts, userspace-rcu
Requires(post): systemd-units systemd-sysv chkconfig Requires(post): systemd-units systemd-sysv chkconfig
Requires(preun): systemd-units Requires(preun): systemd-units
Requires(postun): systemd-units Requires(postun): systemd-units
@ -47,9 +56,6 @@ BuildRequires: readline-devel, ncurses-devel
BuildRequires: systemd-units, systemd-devel BuildRequires: systemd-units, systemd-devel
BuildRequires: json-c-devel, perl-interpreter, pkgconfig BuildRequires: json-c-devel, perl-interpreter, pkgconfig
BuildRequires: userspace-rcu-devel BuildRequires: userspace-rcu-devel
%ifarch x86_64
BuildRequires: librados-devel
%endif
%description %description
%{name} provides tools to manage multipath devices by %{name} provides tools to manage multipath devices by
@ -61,6 +67,8 @@ The tools are :
%package libs %package libs
Summary: The %{name} modules and shared library Summary: The %{name} modules and shared library
Group: System Environment/Libraries Group: System Environment/Libraries
# only libmpathcmd is LGPLv2+
License: GPLv2 and LGPLv2+
%description libs %description libs
The %{name}-libs provides the path checker The %{name}-libs provides the path checker
@ -88,6 +96,7 @@ kpartx manages partition creation and removal for device-mapper devices.
%package -n libdmmp %package -n libdmmp
Summary: device-mapper-multipath C API library Summary: device-mapper-multipath C API library
Group: System Environment/Libraries Group: System Environment/Libraries
License: GPLv3+
Requires: json-c Requires: json-c
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
Requires: %{name}-libs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release}
@ -107,7 +116,7 @@ This package contains the files needed to develop applications that use
device-mapper-multipath's libdmmp C API library device-mapper-multipath's libdmmp C API library
%prep %prep
%setup -q -n multipath-tools-1cb704b %setup -q -n multipath-tools-0.7.7
%patch0001 -p1 %patch0001 -p1
%patch0002 -p1 %patch0002 -p1
%patch0003 -p1 %patch0003 -p1
@ -127,6 +136,15 @@ device-mapper-multipath's libdmmp C API library
%patch0017 -p1 %patch0017 -p1
%patch0018 -p1 %patch0018 -p1
%patch0019 -p1 %patch0019 -p1
%patch0020 -p1
%patch0021 -p1
%patch0022 -p1
%patch0023 -p1
%patch0024 -p1
%patch0025 -p1
%patch0026 -p1
%patch0027 -p1
%patch0028 -p1
cp %{SOURCE1} . cp %{SOURCE1} .
%build %build
@ -186,7 +204,7 @@ fi
%config /usr/lib/udev/rules.d/62-multipath.rules %config /usr/lib/udev/rules.d/62-multipath.rules
%config /usr/lib/udev/rules.d/11-dm-mpath.rules %config /usr/lib/udev/rules.d/11-dm-mpath.rules
%{!?_licensedir:%global license %%doc} %{!?_licensedir:%global license %%doc}
%license COPYING %license LICENSES/GPL-2.0 LICENSES/LGPL-2.0
%doc README %doc README
%doc README.alua %doc README.alua
%doc multipath.conf %doc multipath.conf
@ -196,7 +214,7 @@ fi
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc README %doc README
%{!?_licensedir:%global license %%doc} %{!?_licensedir:%global license %%doc}
%license COPYING %license LICENSES/GPL-2.0 LICENSES/LGPL-2.0
%{_libdir}/libmultipath.so %{_libdir}/libmultipath.so
%{_libdir}/libmultipath.so.* %{_libdir}/libmultipath.so.*
%{_libdir}/libmpathpersist.so.* %{_libdir}/libmpathpersist.so.*
@ -210,7 +228,7 @@ fi
%files devel %files devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc README COPYING %doc README LICENSES/GPL-2.0 LICENSES/LGPL-2.0
%{_libdir}/libmpathpersist.so %{_libdir}/libmpathpersist.so
%{_libdir}/libmpathcmd.so %{_libdir}/libmpathcmd.so
%{_includedir}/mpath_cmd.h %{_includedir}/mpath_cmd.h
@ -222,7 +240,7 @@ fi
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc README %doc README
%{!?_licensedir:%global license %%doc} %{!?_licensedir:%global license %%doc}
%license COPYING %license LICENSES/GPL-2.0
%{_sbindir}/kpartx %{_sbindir}/kpartx
/usr/lib/udev/kpartx_id /usr/lib/udev/kpartx_id
%{_mandir}/man8/kpartx.8.gz %{_mandir}/man8/kpartx.8.gz
@ -232,7 +250,7 @@ fi
%files -n libdmmp %files -n libdmmp
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc README COPYING %doc README LICENSES/GPL-3.0
%{_libdir}/libdmmp.so.* %{_libdir}/libdmmp.so.*
%post -n libdmmp -p /sbin/ldconfig %post -n libdmmp -p /sbin/ldconfig
@ -241,7 +259,7 @@ fi
%files -n libdmmp-devel %files -n libdmmp-devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc README COPYING %doc README LICENSES/GPL-3.0
%{_libdir}/libdmmp.so %{_libdir}/libdmmp.so
%dir %{_includedir}/libdmmp %dir %{_includedir}/libdmmp
%{_includedir}/libdmmp/* %{_includedir}/libdmmp/*
@ -250,6 +268,35 @@ fi
%{_pkgconfdir}/libdmmp.pc %{_pkgconfdir}/libdmmp.pc
%changelog %changelog
* Tue Jun 12 2018 Benjamin Marzinski <bmarzins@redhat.com> 0.7.7-1
- Update Source to 0.7.7
* Previous patches 0001-0009 & 0018 are included in this commit
- Add upstream patches since 0.7.7
* patches 0001-0012 are from upstream commits since 0.7.7
- Add 0015-mpathpersist-add-all_tg_pt-option.patch
* add new all_tg_pt multpiath.conf option. posted upstream
- Add 0016-libmultipath-remove-rbd-code.patch
* remove unused rbd code. posted upstream
- Add 0017-mpathpersist-fix-aptpl-support.patch
* add ":aptpl" suffix for reservation_key to fix aptpl support.
posted upstream
- Add 0018-multipath-don-t-check-timestamps-without-a-path.patch
* fix multipath null dereference crash. posted upstream
- Add 0019-libmultipath-fix-detect-alua-corner-case.patch
* fix alua detection with retain_hardware_handler set to off. posted
upstream
- Add 0020-multipath-fix-setting-conf-version.patch
* multipath wasn't setting the kernel version correctly. posted upstream
- Add 0028-RH-reset-default-find_mutipaths-value-to-off.patch
* default to RHEL7 and older device detection style. Redhat specific, to
keep customer experience the same.
- Rename files
* Previous patches 0010-0011 are now patches 0013-0014
* Previous patches 0012-0017 & 0019 are now patches 0021-0027
- Modify 0021-RH-fixup-udev-rules-for-redhat.patch
* Fix spurious compile warning with redhat compile options
* Tue May 15 2018 Benjamin Marzinski <bmarzins@redhat.com> 0.7.6-4.git1cb704b * Tue May 15 2018 Benjamin Marzinski <bmarzins@redhat.com> 0.7.6-4.git1cb704b
- Add 0010-libmultipath-print-correct-default-for-delay_-_check.patch - Add 0010-libmultipath-print-correct-default-for-delay_-_check.patch
* fix minor configuration printing issue * fix minor configuration printing issue

View File

@ -1,2 +1,2 @@
SHA512 (multipath-tools-1cb704b.tgz) = dd4779a35681b4f9c0ba1f7fd3c0e6eac3407cb6b24e684659df27d8d3ae2bb024552611f44fefa90b38e02d2dfaf90e7f608b9868cce24c70b6be405b5ac989 SHA512 (multipath-tools-0.7.7.tgz) = 5c487e118b5c1f1b5ea4fe5b6c220dd09ba991df518eb4fdfec6b0cefb48ba2f3e885c779420670b0cdbc8205b09309731bef3a3bd928f367516414bf9d1bb21
SHA512 (multipath.conf) = 71953dce5a68adcf60a942305f5a66023e6f4c4baf53b1bfdb4edf65ed5b8e03db804363c36d1dcfd85591f4766f52b515269904c53b84d7b076da0b80b09942 SHA512 (multipath.conf) = 71953dce5a68adcf60a942305f5a66023e6f4c4baf53b1bfdb4edf65ed5b8e03db804363c36d1dcfd85591f4766f52b515269904c53b84d7b076da0b80b09942