device-mapper-multipath/0179-multipath-tools-add-checker-callout-to-repair-path.patch
Benjamin Marzinski f9dfbb37ac device-mapper-multipath-0.4.9-86
Modify 0136-RHBZ-1304687-wait-for-map-add.patch
  * switch to missing_uev_wait_timeout to stop waiting for uev
Refresh 0137-RHBZ-1280524-clear-chkr-msg.patch
Refresh 0150-RHBZ-1253913-fix-startup-msg.patch
Refresh 0154-UPBZ-1291406-disable-reinstate.patch
Refresh 0156-UPBZ-1313324-dont-fail-discovery.patch
Refresh 0161-RHBZ-1311659-no-kpartx.patch
Refresh 0167-RHBZ-1335176-fix-show-cmds.patch
Add 0173-RH-update-man-page.patch
Add 0174-RHBZ-1362396-modprobe.patch
  * make starting the multipathd service modprobe dm-multipath in the
    sysvinit scripts
Add 0175-RHBZ-1357382-ordering.patch
  * force multipathd.service to start after systemd-udev-trigger.service
Add 0176-RHBZ-1363830-fix-rename.patch
  * initialized a variable to make dm_rename not fail randomly
Add 0177-libmultipath-correctly-initialize-pp-sg_id.patch
  * This and all the following patches add the rbd patch checker
Add 0178-libmultipath-add-rbd-discovery.patch
Add 0179-multipath-tools-add-checker-callout-to-repair-path.patch
Add 0180-multipath-tools-Add-rbd-checker.patch
Add 0181-multipath-tools-Add-rbd-to-the-hwtable.patch
Add 0182-multipath-tools-check-for-initialized-checker-before.patch
Add 0183-multipathd-Don-t-call-repair-on-blacklisted-path.patch
Add 0184-rbd-fix-sync-repair-support.patch
Add 0185-rbd-check-for-nonshared-clients.patch
Add 0186-rbd-check-for-exclusive-lock-enabled.patch
Add 0187-rbd-fixup-log-messages.patch
Add 0188-RHBZ-1368501-dont-exit.patch
  * make multipathd not exit if it encounters recoverable errors on startup
Add 0189-RHBZ-1368211-remove-retries.patch
  * add "remove_retries" multipath.conf parameter to make multiple attempts
    to remove a multipath device if it is busy.
Add 0190-RHBZ-1380602-rbd-lock-on-read.patch
  * pass lock_on_read when remapping image
Add 0191-RHBZ-1169168-disable-changed-paths.patch
  * add "disabled_changed_wwids" multipath.conf parameter to disable
    paths whose wwid changes
Add 0192-RHBZ-1362409-infinibox-config.patch
Add 0194-RHBZ-1351964-kpartx-recurse.patch
  * fix recursion on corrupt dos partitions
Add 0195-RHBZ-1359510-no-daemon-msg.patch
  * print a messages when multipathd isn't running
Add 0196-RHBZ-1239173-dont-set-flag.patch
  * don't set reload flag on reloads when you gain your first
    valid path
Add 0197-RHBZ-1394059-max-sectors-kb.patch
  * add "max_sectors_kb" multipath.conf parameter to set max_sectors_kb
    on a multipath device and all its path devices
Add 0198-RHBZ-1372032-detect-path-checker.patch
  * add "detect_checker" multipath.conf parameter to detect ALUA arrays
    and set the path checker to TUR
Add 0199-RHBZ-1279355-3pardata-config.patch
Add 0200-RHBZ-1402092-orphan-status.patch
  * clear status on orphan paths
Add 0201-RHBZ-1403552-silence-warning.patch
Add 0202-RHBZ-1362120-skip-prio.patch
  * don't run prio on failed paths
Add 0203-RHBZ-1363718-add-msgs.patch
Add 0204-RHBZ-1406226-nimble-config.patch
Add 0205-RHBZ-1416569-reset-stats.patch
  * add "reset maps stats" and "reset map <map> stats" multipathd
    interactive commands to reset the stats tracked by multipathd
Add 0206-RHBZ-1239173-pt2-no-paths.patch
  * make multipath correctly disable scanning and rules running when
    it gets a uevent and there are not valid paths.
Add 0207-UP-add-libmpathcmd.patch
  * New shared library, libmpathcmd, that sends and receives messages from
    multipathd. device-mapper-multipath now uses this library internally.
Add 0208-UPBZ-1430097-multipathd-IPC-changes.patch
  * validation that modifying commands are coming from root.
Add 0209-UPBZ-1430097-multipath-C-API.patch
  * New shared library. libdmmp, that presents the information from multipathd
    in a structured manner to make it easier for callers to use
Add 0210-RH-fix-uninstall.patch
  * Minor compilation fixes
Add 0211-RH-strlen-fix.patch
  * checks that variables are not NULL before passing them to strlen
Add 0212-RHBZ-1431562-for-read-only.patch
Make 3 new subpackages
  * device-mapper-multipath-devel, libdmmp, and libdmmp-devel. libmpathcmd
    and libmpathprio are in device-mapper-multipath-libs and
    device-mapper-multipath-devel. libdmmp is in its own subpackages
Move libmpathprio devel files to device-mapper-multipath-devel
Added BuildRequires on librados2-devel
2017-04-10 18:57:22 -04:00

251 lines
6.9 KiB
Diff

From 1073621a7a63ca4e9a00baedd8edc51e5381eb95 Mon Sep 17 00:00:00 2001
From: Mike Christie <mchristi@redhat.com>
Date: Tue, 9 Aug 2016 13:46:11 -0500
Subject: [PATCH 03/11] multipath-tools: add checker callout to repair path
For BZ 1348372 from upstream commit:
commit 015f87b16a7797a17afd514aec46e65c2a1a2f73
Author: Mike Christie <mchristi@redhat.com>
Date: Mon Aug 8 07:01:48 2016 -0500
multipath-tools: add checker callout to repair path
This patch adds a callback which can be used to repair a path
if check() has determined it is in the PATH_DOWN state.
The next patch that adds rbd checker support which will use this to
handle the case where a rbd device is blacklisted.
--------
Porting notes:
checkerloop difference due to different path tracking.
Signed-off-by: Mike Christie <mchristi@redhat.com>
---
libmultipath/checkers.c | 23 +++++++++++++++++++++++
libmultipath/checkers.h | 4 ++++
libmultipath/checkers/cciss_tur.c | 5 +++++
libmultipath/checkers/directio.c | 5 +++++
libmultipath/checkers/emc_clariion.c | 5 +++++
libmultipath/checkers/hp_sw.c | 5 +++++
libmultipath/checkers/rdac.c | 5 +++++
libmultipath/checkers/readsector0.c | 5 +++++
libmultipath/checkers/tur.c | 5 +++++
multipathd/main.c | 9 +++++++++
10 files changed, 71 insertions(+)
diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
index 7f9db2d..fa7d8b7 100644
--- a/libmultipath/checkers.c
+++ b/libmultipath/checkers.c
@@ -137,6 +137,14 @@ struct checker * add_checker (char * name)
if (!c->free)
goto out;
+ c->repair = (void (*)(struct checker *)) dlsym(c->handle,
+ "libcheck_repair");
+ errstr = dlerror();
+ if (errstr != NULL)
+ condlog(0, "A dynamic linking error occurred: (%s)", errstr);
+ if (!c->repair)
+ goto out;
+
c->fd = 0;
c->sync = 1;
list_add(&c->node, &checkers);
@@ -202,6 +210,20 @@ void checker_put (struct checker * dst)
free_checker(src);
}
+void checker_repair (struct checker * c)
+{
+ if (!c)
+ return;
+
+ c->message[0] = '\0';
+ if (c->disable) {
+ MSG(c, "checker disabled");
+ return;
+ }
+
+ c->repair(c);
+}
+
int checker_check (struct checker * c)
{
int r;
@@ -266,6 +288,7 @@ void checker_get (struct checker * dst, char * name)
dst->sync = src->sync;
strncpy(dst->name, src->name, CHECKER_NAME_LEN);
strncpy(dst->message, src->message, CHECKER_MSG_LEN);
+ dst->repair = src->repair;
dst->check = src->check;
dst->init = src->init;
dst->free = src->free;
diff --git a/libmultipath/checkers.h b/libmultipath/checkers.h
index 735bb25..ad3b9e4 100644
--- a/libmultipath/checkers.h
+++ b/libmultipath/checkers.h
@@ -106,6 +106,9 @@ struct checker {
multipath-wide. Use MALLOC if
you want to stuff data in. */
int (*check)(struct checker *);
+ void (*repair)(struct checker *); /* called if check returns
+ PATH_DOWN to bring path into
+ usable state */
int (*init)(struct checker *); /* to allocate the context */
void (*free)(struct checker *); /* to free the context */
};
@@ -125,6 +128,7 @@ void checker_set_async (struct checker *);
void checker_set_fd (struct checker *, int);
void checker_enable (struct checker *);
void checker_disable (struct checker *);
+void checker_repair (struct checker *);
int checker_check (struct checker *);
int checker_selected (struct checker *);
char * checker_name (struct checker *);
diff --git a/libmultipath/checkers/cciss_tur.c b/libmultipath/checkers/cciss_tur.c
index 4c26901..7e4eb81 100644
--- a/libmultipath/checkers/cciss_tur.c
+++ b/libmultipath/checkers/cciss_tur.c
@@ -63,6 +63,11 @@ void libcheck_free (struct checker * c)
return;
}
+void libcheck_repair (struct checker * c)
+{
+ return;
+}
+
extern int
libcheck_check (struct checker * c)
{
diff --git a/libmultipath/checkers/directio.c b/libmultipath/checkers/directio.c
index 46fe6a7..1a997ed 100644
--- a/libmultipath/checkers/directio.c
+++ b/libmultipath/checkers/directio.c
@@ -116,6 +116,11 @@ void libcheck_free (struct checker * c)
free(ct);
}
+void libcheck_repair (struct checker * c)
+{
+ return;
+}
+
static int
check_state(int fd, struct directio_context *ct, int sync, int timeout_secs)
{
diff --git a/libmultipath/checkers/emc_clariion.c b/libmultipath/checkers/emc_clariion.c
index b42d267..43b5025 100644
--- a/libmultipath/checkers/emc_clariion.c
+++ b/libmultipath/checkers/emc_clariion.c
@@ -90,6 +90,11 @@ void libcheck_free (struct checker * c)
free(c->context);
}
+void libcheck_repair (struct checker * c)
+{
+ return;
+}
+
int libcheck_check (struct checker * c)
{
unsigned char sense_buffer[128] = { 0, };
diff --git a/libmultipath/checkers/hp_sw.c b/libmultipath/checkers/hp_sw.c
index b50ac0c..857ac5e 100644
--- a/libmultipath/checkers/hp_sw.c
+++ b/libmultipath/checkers/hp_sw.c
@@ -44,6 +44,11 @@ void libcheck_free (struct checker * c)
return;
}
+void libcheck_repair (struct checker * c)
+{
+ return;
+}
+
static int
do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op,
void *resp, int mx_resp_len, int noisy, unsigned int timeout)
diff --git a/libmultipath/checkers/rdac.c b/libmultipath/checkers/rdac.c
index f0e0af3..5469e61 100644
--- a/libmultipath/checkers/rdac.c
+++ b/libmultipath/checkers/rdac.c
@@ -139,6 +139,11 @@ void libcheck_free (struct checker * c)
return;
}
+void libcheck_repair (struct checker * c)
+{
+ return;
+}
+
static int
do_inq(int sg_fd, unsigned int pg_op, void *resp, int mx_resp_len,
unsigned int timeout)
diff --git a/libmultipath/checkers/readsector0.c b/libmultipath/checkers/readsector0.c
index 0550fb6..b3ed1f3 100644
--- a/libmultipath/checkers/readsector0.c
+++ b/libmultipath/checkers/readsector0.c
@@ -23,6 +23,11 @@ void libcheck_free (struct checker * c)
return;
}
+void libcheck_repair (struct checker * c)
+{
+ return;
+}
+
int libcheck_check (struct checker * c)
{
unsigned char buf[4096];
diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c
index 1e5b039..91f1458 100644
--- a/libmultipath/checkers/tur.c
+++ b/libmultipath/checkers/tur.c
@@ -187,6 +187,11 @@ void libcheck_free (struct checker * c)
return;
}
+void libcheck_repair (struct checker * c)
+{
+ return;
+}
+
#define TUR_MSG(msg, fmt, args...) snprintf(msg, CHECKER_MSG_LEN, fmt, ##args);
int
diff --git a/multipathd/main.c b/multipathd/main.c
index 8808c88..d26fd22 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1455,6 +1455,14 @@ check_path (struct vectors * vecs, struct path * pp)
}
}
+void repair_path(struct vectors * vecs, struct path * pp)
+{
+ if (pp->state != PATH_DOWN)
+ return;
+
+ checker_repair(&pp->checker);
+}
+
static void *
checkerloop (void *ap)
{
@@ -1483,6 +1491,7 @@ checkerloop (void *ap)
if (vecs->pathvec) {
vector_foreach_slot (vecs->pathvec, pp, i) {
check_path(vecs, pp);
+ repair_path(vecs, pp);
}
}
if (vecs->mpvec) {
--
1.8.3.1