summaryrefslogtreecommitdiffstats
path: root/0011-libmultipath-add-helper-functions.patch
diff options
context:
space:
mode:
authorBenjamin Marzinski <bmarzins@redhat.com>2018-02-15 13:17:53 -0600
committerBenjamin Marzinski <bmarzins@redhat.com>2018-02-15 13:17:53 -0600
commit5bea53fe7ed7dd7afa8e76f7f84f76fdb89d59d9 (patch)
tree9a89c87df6336311ebe30ae2c51af13f92d6a3d6 /0011-libmultipath-add-helper-functions.patch
parent7e8f34e1813a9ae89b5acc012fa7d45c3d7bbdb8 (diff)
downloaddevice-mapper-multipath-5bea53fe7ed7dd7afa8e76f7f84f76fdb89d59d9.tar.gz
device-mapper-multipath-5bea53fe7ed7dd7afa8e76f7f84f76fdb89d59d9.tar.xz
device-mapper-multipath-5bea53fe7ed7dd7afa8e76f7f84f76fdb89d59d9.zip
device-mapper-multipath-0.7.4-1.git07e7bd5master
Update Source to the latest upstream commit * Previous patches 0001-0006 are included in this commit * Previous patches 0007-0014 are now patches 0015-0022 Add 0001-libmultipath-fix-tur-checker-locking.patch * Fixed spinlock bug. posted upstream Add 0002-multipath-fix-DEF_TIMEOUT-use.patch * Add missing sec to ms conversion. posted upstream Add 0003-multipathd-remove-coalesce_paths-from-ev_add_map.patch * Remove unused code. posted upstream Add 0004-multipathd-remove-unused-configure-parameter.patch * Remove unused code. posted upstream Add 0005-Fix-set_no_path_retry-regression.patch * Fix issue with queueing and path addition. posted upstream Add 0006-multipathd-change-spurious-uevent-msg-priority.patch * Change message priority to Notice. posted upstream Add 0007-multipath-print-sysfs-state-in-fast-list-mode.patch * Show sysfs state correctly in fast list mode (-l). posted upstream Add 0008-libmultipath-move-remove_map-waiter-code-to-multipat.patch * Move code around. posted upstream Add 0009-move-waiter-code-from-libmultipath-to-multipathd.patch * Move code around. posted upstream Add 0010-call-start_waiter_thread-before-setup_multipath.patch * Fix race on multipath device creations. posted upstream Add 0011-libmultipath-add-helper-functions.patch * posted upstream Add 0012-multipathd-RFC-add-new-polling-dmevents-waiter-threa.patch * Add alternate method of getting dmevents, that doesn't require a thread per device. posted upstream Add 0013-libmultipath-condlog-log-to-stderr.patch * change condlog to log to stderr instead of stdout. posted upstream Add 0014-multipathd-fix-compiler-warning-for-uev_pathfail_che.patch * fix indentation issue. posted upstream
Diffstat (limited to '0011-libmultipath-add-helper-functions.patch')
-rw-r--r--0011-libmultipath-add-helper-functions.patch155
1 files changed, 155 insertions, 0 deletions
diff --git a/0011-libmultipath-add-helper-functions.patch b/0011-libmultipath-add-helper-functions.patch
new file mode 100644
index 0000000..aa62edf
--- /dev/null
+++ b/0011-libmultipath-add-helper-functions.patch
@@ -0,0 +1,155 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Benjamin Marzinski <bmarzins@redhat.com>
+Date: Mon, 5 Feb 2018 10:40:24 -0600
+Subject: [PATCH] libmultipath: add helper functions
+
+Add the ability to reset a vector without completely freeing it, and to
+check the version of the device-mapper module. The existing version
+checking code checks the version of a specific device mapper target, and
+has been renamed for clarity's sake. These functions will be used in a
+later patch.
+
+Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
+---
+ libmultipath/devmapper.c | 28 ++++++++++++++++++++++++----
+ libmultipath/devmapper.h | 3 ++-
+ libmultipath/vector.c | 16 ++++++++++++----
+ libmultipath/vector.h | 1 +
+ multipathd/main.c | 2 +-
+ 5 files changed, 40 insertions(+), 10 deletions(-)
+
+diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
+index 573fc75..2960bf5 100644
+--- a/libmultipath/devmapper.c
++++ b/libmultipath/devmapper.c
+@@ -132,7 +132,27 @@ dm_lib_prereq (void)
+ }
+
+ int
+-dm_drv_version (unsigned int * version, char * str)
++dm_drv_version(unsigned int *v)
++{
++ char buff[64];
++
++ v[0] = 0;
++ v[1] = 0;
++ v[2] = 0;
++
++ if (!dm_driver_version(buff, sizeof(buff))) {
++ condlog(0, "cannot get kernel dm version");
++ return 1;
++ }
++ if (sscanf(buff, "%u.%u.%u ", &v[0], &v[1], &v[2]) != 3) {
++ condlog(0, "invalid kernel dm version '%s'", buff);
++ return 1;
++ }
++ return 0;
++}
++
++int
++dm_tgt_version (unsigned int * version, char * str)
+ {
+ int r = 2;
+ struct dm_task *dmt;
+@@ -179,13 +199,13 @@ out:
+ }
+
+ static int
+-dm_drv_prereq (unsigned int *ver)
++dm_tgt_prereq (unsigned int *ver)
+ {
+ unsigned int minv[3] = {1, 0, 3};
+ unsigned int version[3] = {0, 0, 0};
+ unsigned int * v = version;
+
+- if (dm_drv_version(v, TGT_MPATH)) {
++ if (dm_tgt_version(v, TGT_MPATH)) {
+ /* in doubt return not capable */
+ return 1;
+ }
+@@ -210,7 +230,7 @@ static int dm_prereq(unsigned int *v)
+ {
+ if (dm_lib_prereq())
+ return 1;
+- return dm_drv_prereq(v);
++ return dm_tgt_prereq(v);
+ }
+
+ static int libmp_dm_udev_sync = 0;
+diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h
+index 62e14d1..52d4af8 100644
+--- a/libmultipath/devmapper.h
++++ b/libmultipath/devmapper.h
+@@ -28,7 +28,8 @@ void dm_init(int verbosity);
+ void libmp_dm_init(void);
+ void libmp_udev_set_sync_support(int on);
+ struct dm_task *libmp_dm_task_create(int task);
+-int dm_drv_version (unsigned int * version, char * str);
++int dm_drv_version (unsigned int * version);
++int dm_tgt_version (unsigned int * version, char * str);
+ int dm_simplecmd_flush (int, const char *, uint16_t);
+ int dm_simplecmd_noflush (int, const char *, uint16_t);
+ int dm_addmap_create (struct multipath *mpp, char *params);
+diff --git a/libmultipath/vector.c b/libmultipath/vector.c
+index 6266e0a..f741ae0 100644
+--- a/libmultipath/vector.c
++++ b/libmultipath/vector.c
+@@ -145,18 +145,26 @@ vector_repack(vector v)
+ vector_del_slot(v, i--);
+ }
+
+-/* Free memory vector allocation */
+-void
+-vector_free(vector v)
++vector
++vector_reset(vector v)
+ {
+ if (!v)
+- return;
++ return NULL;
+
+ if (v->slot)
+ FREE(v->slot);
+
+ v->allocated = 0;
+ v->slot = NULL;
++ return v;
++}
++
++/* Free memory vector allocation */
++void
++vector_free(vector v)
++{
++ if (!vector_reset(v))
++ return;
+ FREE(v);
+ }
+
+diff --git a/libmultipath/vector.h b/libmultipath/vector.h
+index 5cfd4d0..d69cd0b 100644
+--- a/libmultipath/vector.h
++++ b/libmultipath/vector.h
+@@ -45,6 +45,7 @@ typedef struct _vector *vector;
+ /* Prototypes */
+ extern vector vector_alloc(void);
+ extern void *vector_alloc_slot(vector v);
++vector vector_reset(vector v);
+ extern void vector_free(vector v);
+ extern void free_strvec(vector strvec);
+ extern void vector_set_slot(vector v, void *value);
+diff --git a/multipathd/main.c b/multipathd/main.c
+index efc39d7..2963bde 100644
+--- a/multipathd/main.c
++++ b/multipathd/main.c
+@@ -2228,7 +2228,7 @@ reconfigure (struct vectors * vecs)
+ /* Re-read any timezone changes */
+ tzset();
+
+- dm_drv_version(conf->version, TGT_MPATH);
++ dm_tgt_version(conf->version, TGT_MPATH);
+ if (verbosity)
+ conf->verbosity = verbosity;
+ if (bindings_read_only)
+--
+2.7.4
+