From: "Benjamin Marzinski" <bmarzins@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH 07/10] recover from errors in multipathd startup
Date: Fri, 28 Oct 2016 21:55:23 -0500 [thread overview]
Message-ID: <1477709726-5442-8-git-send-email-bmarzins@redhat.com> (raw)
In-Reply-To: <1477709726-5442-1-git-send-email-bmarzins@redhat.com>
When multipathd does it's initial configuration during startup, it fails
the daemon for many errors that it would simply recover from if they
occured when adding paths or maps later. It should recover from these
errors during startup as well. Also, if multipathd hits a
nonrecoverable error, it should log a message before quitting.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/configure.c | 8 +++++---
multipathd/main.c | 45 ++++++++++++++++++++++++++++++++-------------
2 files changed, 37 insertions(+), 16 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 48f100b..d428099 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -809,8 +809,10 @@ coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, int force_r
* at this point, we know we really got a new mp
*/
mpp = add_map_with_path(vecs, pp1, 0);
- if (!mpp)
- return 1;
+ if (!mpp) {
+ orphan_path(pp1, "failed to create multipath device");
+ continue;
+ }
if (pp1->priority == PRIO_UNDEF)
mpp->action = ACT_REJECT;
@@ -862,7 +864,7 @@ coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, int force_r
condlog(3, "%s: domap (%u) failure "
"for create/reload map",
mpp->alias, r);
- if (r == DOMAP_FAIL) {
+ if (r == DOMAP_FAIL || is_daemon) {
condlog(2, "%s: %s map",
mpp->alias, (mpp->action == ACT_CREATE)?
"ignoring" : "removing");
diff --git a/multipathd/main.c b/multipathd/main.c
index 15c957a..f423e35 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1017,7 +1017,7 @@ map_discovery (struct vectors * vecs)
vector_foreach_slot (vecs->mpvec, mpp, i)
if (setup_multipath(vecs, mpp))
- return 1;
+ i--;
return 0;
}
@@ -1910,21 +1910,29 @@ configure (struct vectors * vecs, int start_waiters)
int i, ret;
struct config *conf;
- if (!vecs->pathvec && !(vecs->pathvec = vector_alloc()))
+ if (!vecs->pathvec && !(vecs->pathvec = vector_alloc())) {
+ condlog(0, "couldn't allocate path vec in configure");
return 1;
+ }
- if (!vecs->mpvec && !(vecs->mpvec = vector_alloc()))
+ if (!vecs->mpvec && !(vecs->mpvec = vector_alloc())) {
+ condlog(0, "couldn't allocate multipath vec in configure");
return 1;
+ }
- if (!(mpvec = vector_alloc()))
+ if (!(mpvec = vector_alloc())) {
+ condlog(0, "couldn't allocate new maps vec in configure");
return 1;
+ }
/*
* probe for current path (from sysfs) and map (from dm) sets
*/
ret = path_discovery(vecs->pathvec, DI_ALL);
- if (ret < 0)
+ if (ret < 0) {
+ condlog(0, "configure failed at path discovery");
return 1;
+ }
vector_foreach_slot (vecs->pathvec, pp, i){
conf = get_multipath_config();
@@ -1937,21 +1945,27 @@ configure (struct vectors * vecs, int start_waiters)
pp->checkint = conf->checkint;
put_multipath_config(conf);
}
- if (map_discovery(vecs))
+ if (map_discovery(vecs)) {
+ condlog(0, "configure failed at map discovery");
return 1;
+ }
/*
* create new set of maps & push changed ones into dm
*/
- if (coalesce_paths(vecs, mpvec, NULL, 1, CMD_NONE))
+ if (coalesce_paths(vecs, mpvec, NULL, 1, CMD_NONE)) {
+ condlog(0, "configure failed while coalescing paths");
return 1;
+ }
/*
* may need to remove some maps which are no longer relevant
* e.g., due to blacklist changes in conf file
*/
- if (coalesce_maps(vecs, mpvec))
+ if (coalesce_maps(vecs, mpvec)) {
+ condlog(0, "configure failed while coalescing maps");
return 1;
+ }
dm_lib_release();
@@ -1976,11 +1990,16 @@ configure (struct vectors * vecs, int start_waiters)
* start dm event waiter threads for these new maps
*/
vector_foreach_slot(vecs->mpvec, mpp, i) {
- if (setup_multipath(vecs, mpp))
- return 1;
- if (start_waiters)
- if (start_waiter_thread(mpp, vecs))
- return 1;
+ if (setup_multipath(vecs, mpp)) {
+ i--;
+ continue;
+ }
+ if (start_waiters) {
+ if (start_waiter_thread(mpp, vecs)) {
+ remove_map(mpp, vecs, 1);
+ i--;
+ }
+ }
}
return 0;
}
--
1.8.3.1
next prev parent reply other threads:[~2016-10-29 2:55 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-29 2:55 [PATCH 00/10] misc. multipath patches Benjamin Marzinski
2016-10-29 2:55 ` [PATCH 01/10] libmultipath: add skip_kpartx option Benjamin Marzinski
2016-10-30 13:42 ` Hannes Reinecke
2016-10-29 2:55 ` [PATCH 02/10] kpartx.rules: respect skip_kpartx flag Benjamin Marzinski
2016-10-30 13:42 ` Hannes Reinecke
2016-10-29 2:55 ` [PATCH 03/10] do not allow in-use path to change wwid Benjamin Marzinski
2016-10-30 13:45 ` Hannes Reinecke
2016-10-31 14:30 ` Benjamin Marzinski
2016-10-29 2:55 ` [PATCH 04/10] multipathd: add "map failures" format wildcard Benjamin Marzinski
2016-10-30 13:45 ` Hannes Reinecke
2016-10-29 2:55 ` [PATCH 05/10] mpath: don't wait for udev if all paths are down Benjamin Marzinski
2016-10-30 13:46 ` Hannes Reinecke
2016-10-29 2:55 ` [PATCH 06/10] multipath: set cookie before using it Benjamin Marzinski
2016-10-30 13:46 ` Hannes Reinecke
2016-10-29 2:55 ` Benjamin Marzinski [this message]
2016-10-30 13:47 ` [PATCH 07/10] recover from errors in multipathd startup Hannes Reinecke
2016-10-29 2:55 ` [PATCH 08/10] fix INIT_REQUESTED_UDEV code Benjamin Marzinski
2016-10-30 13:48 ` Hannes Reinecke
2016-10-29 2:55 ` [PATCH 09/10] add disable_changed_wwids option Benjamin Marzinski
2016-10-30 13:54 ` Hannes Reinecke
2016-11-04 15:32 ` Benjamin Marzinski
2017-02-28 12:27 ` Zhangguanghui
2016-11-06 0:03 ` Xose Vazquez Perez
2016-11-07 14:47 ` Benjamin Marzinski
2016-10-29 2:55 ` [PATCH 10/10] set retrigger_tries to 0 for multipath Benjamin Marzinski
2016-10-30 13:54 ` Hannes Reinecke
2016-12-06 15:11 ` Xose Vazquez Perez
2016-12-06 15:22 ` Benjamin Marzinski
2017-04-25 14:07 ` Xose Vazquez Perez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1477709726-5442-8-git-send-email-bmarzins@redhat.com \
--to=bmarzins@redhat.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).