From: Martin Wilck <mwilck@suse.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>,
Hannes Reinecke <hare@suse.de>
Cc: dm-devel@redhat.com, Xose Vazquez Perez <xose.vazquez@gmail.com>
Subject: [PATCH v4 03/11] libmultipath: clarify option conflicts for "features"
Date: Thu, 22 Jun 2017 16:59:05 +0200 [thread overview]
Message-ID: <20170622145913.23714-4-mwilck@suse.com> (raw)
In-Reply-To: <20170622145913.23714-1-mwilck@suse.com>
The "features" option in multipath.conf can possibly conflict
with "no_path_retry" and "retain_attached_hw_handler".
Currently, "no_path_retry" takes precedence, unless it is set to
"fail", in which case it's overridden by "queue_if_no_path".
This is odd, either "features" or "no_path_retry" should take
precedence.
No precedence rules are defined for "retain_attached_hw_handler".
Make this behavior more consistent by always giving precedence
to the explicit config file options, and improve logging.
Put this logic into a separate function, which can be used
from other places in the code.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
libmultipath/configure.c | 6 ++---
libmultipath/propsel.c | 68 +++++++++++++++++++++++++++++++++++++-----------
libmultipath/propsel.h | 3 +++
3 files changed, 59 insertions(+), 18 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index bd090d9a..a7f2b443 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -280,18 +280,18 @@ int setup_map(struct multipath *mpp, char *params, int params_size)
select_pgfailback(conf, mpp);
select_pgpolicy(conf, mpp);
select_selector(conf, mpp);
- select_features(conf, mpp);
select_hwhandler(conf, mpp);
+ select_no_path_retry(conf, mpp);
+ select_retain_hwhandler(conf, mpp);
+ select_features(conf, mpp);
select_rr_weight(conf, mpp);
select_minio(conf, mpp);
- select_no_path_retry(conf, mpp);
select_mode(conf, mpp);
select_uid(conf, mpp);
select_gid(conf, mpp);
select_fast_io_fail(conf, mpp);
select_dev_loss(conf, mpp);
select_reservation_key(conf, mpp);
- select_retain_hwhandler(conf, mpp);
select_deferred_remove(conf, mpp);
select_delay_watch_checks(conf, mpp);
select_delay_wait_checks(conf, mpp);
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index c8ccede5..bc9e130b 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -269,6 +269,55 @@ out:
return mp->alias ? 0 : 1;
}
+void reconcile_features_with_options(const char *id, char **features, int* no_path_retry,
+ int *retain_hwhandler)
+{
+ static const char q_i_n_p[] = "queue_if_no_path";
+ static const char r_a_h_h[] = "retain_attached_hw_handler";
+ char buff[12];
+
+ if (*features == NULL)
+ return;
+ if (id == NULL)
+ id = "UNKNOWN";
+
+ /*
+ * We only use no_path_retry internally. The "queue_if_no_path"
+ * device-mapper feature is derived from it when the map is loaded.
+ * For consistency, "queue_if_no_path" is removed from the
+ * internal libmultipath features string.
+ * For backward compatibility we allow 'features "1 queue_if_no_path"';
+ * it's translated into "no_path_retry queue" here.
+ */
+ if (strstr(*features, q_i_n_p)) {
+ if (*no_path_retry == NO_PATH_RETRY_UNDEF) {
+ *no_path_retry = NO_PATH_RETRY_QUEUE;
+ print_no_path_retry(buff, sizeof(buff),
+ no_path_retry);
+ condlog(3, "%s: no_path_retry = %s (inherited setting from feature '%s')",
+ id, buff, q_i_n_p);
+ };
+ /* Warn only if features string is overridden */
+ if (*no_path_retry != NO_PATH_RETRY_QUEUE) {
+ print_no_path_retry(buff, sizeof(buff),
+ no_path_retry);
+ condlog(2, "%s: ignoring feature '%s' because no_path_retry is set to '%s'",
+ id, q_i_n_p, buff);
+ }
+ remove_feature(features, q_i_n_p);
+ }
+ if (strstr(*features, r_a_h_h)) {
+ if (*retain_hwhandler == RETAIN_HWHANDLER_UNDEF) {
+ condlog(3, "%s: %s = on (inherited setting from feature '%s')",
+ id, r_a_h_h, r_a_h_h);
+ *retain_hwhandler = RETAIN_HWHANDLER_ON;
+ } else if (*retain_hwhandler == RETAIN_HWHANDLER_OFF)
+ condlog(2, "%s: ignoring feature '%s' because %s is set to 'off'",
+ id, r_a_h_h, r_a_h_h);
+ remove_feature(features, r_a_h_h);
+ }
+}
+
int select_features(struct config *conf, struct multipath *mp)
{
char *origin;
@@ -280,19 +329,11 @@ int select_features(struct config *conf, struct multipath *mp)
mp_set_default(features, DEFAULT_FEATURES);
out:
mp->features = STRDUP(mp->features);
- condlog(3, "%s: features = \"%s\" %s", mp->alias, mp->features, origin);
- if (strstr(mp->features, "queue_if_no_path")) {
- if (mp->no_path_retry == NO_PATH_RETRY_UNDEF)
- mp->no_path_retry = NO_PATH_RETRY_QUEUE;
- else if (mp->no_path_retry == NO_PATH_RETRY_FAIL) {
- condlog(1, "%s: config ERROR (setting: overriding 'no_path_retry' value)",
- mp->alias);
- mp->no_path_retry = NO_PATH_RETRY_QUEUE;
- } else if (mp->no_path_retry != NO_PATH_RETRY_QUEUE)
- condlog(1, "%s: config ERROR (setting: ignoring 'queue_if_no_path' because no_path_retry = %d)",
- mp->alias, mp->no_path_retry);
- }
+ reconcile_features_with_options(mp->alias, &mp->features,
+ &mp->no_path_retry,
+ &mp->retain_hwhandler);
+ condlog(3, "%s: features = \"%s\" %s", mp->alias, mp->features, origin);
return 0;
}
@@ -469,9 +510,6 @@ out:
if (origin)
condlog(3, "%s: no_path_retry = %s %s", mp->alias, buff,
origin);
- else if (mp->no_path_retry != NO_PATH_RETRY_UNDEF)
- condlog(3, "%s: no_path_retry = %s (setting: inherited value)",
- mp->alias, buff);
else
condlog(3, "%s: no_path_retry = undef (setting: multipath internal)",
mp->alias);
diff --git a/libmultipath/propsel.h b/libmultipath/propsel.h
index 58a32f3c..f8e96d85 100644
--- a/libmultipath/propsel.h
+++ b/libmultipath/propsel.h
@@ -28,3 +28,6 @@ int select_max_sectors_kb (struct config *conf, struct multipath * mp);
int select_san_path_err_forget_rate(struct config *conf, struct multipath *mp);
int select_san_path_err_threshold(struct config *conf, struct multipath *mp);
int select_san_path_err_recovery_time(struct config *conf, struct multipath *mp);
+void reconcile_features_with_options(const char *id, char **features,
+ int* no_path_retry,
+ int *retain_hwhandler);
--
2.13.1
next prev parent reply other threads:[~2017-06-22 14:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-22 14:59 [PATCH v4 00/11] multipath-tools: no_path_retry/queue_if_no_path/hwhandler logic Martin Wilck
2017-06-22 14:59 ` [PATCH v4 01/11] libmultipath: load_config: skip setting unnecessary defaults Martin Wilck
2017-06-22 14:59 ` [PATCH v4 02/11] libmultipath: add/remove_feature: use const char* for feature Martin Wilck
2017-06-22 14:59 ` Martin Wilck [this message]
2017-06-22 14:59 ` [PATCH v4 04/11] libmultipath: merge_hwe: fix queue_if_no_path logic Martin Wilck
2017-06-22 14:59 ` [PATCH v4 05/11] libmultipath: assemble_map: " Martin Wilck
2017-06-22 14:59 ` [PATCH v4 06/11] multipath.conf.5: document no_path_retry vs. queue_if_no_path Martin Wilck
2017-06-22 14:59 ` [PATCH v4 07/11] multipath.conf.5: Remove ??? and other minor fixes Martin Wilck
2017-06-22 14:59 ` [PATCH v4 08/11] libmultipath: add deprecated warning for some features settings Martin Wilck
2017-06-22 14:59 ` [PATCH v4 09/11] libmultipath: retain_attached_hw_handler obsolete with 4.3+ Martin Wilck
2017-06-22 19:09 ` Benjamin Marzinski
2017-06-23 17:25 ` Xose Vazquez Perez
2017-06-26 8:00 ` Martin Wilck
2017-06-22 14:59 ` [PATCH v4 10/11] libmultipath: don't try to set hwhandler if it is retained Martin Wilck
2017-06-22 19:09 ` Benjamin Marzinski
2017-06-22 14:59 ` [PATCH v4 11/11] libmultipath: don't [un]set queue_if_no_path after domap Martin Wilck
2017-08-03 6:36 ` [PATCH v4 00/11] multipath-tools: no_path_retry/queue_if_no_path/hwhandler logic Christophe Varoqui
2017-08-09 13:19 ` Martin Wilck
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=20170622145913.23714-4-mwilck@suse.com \
--to=mwilck@suse.com \
--cc=christophe.varoqui@opensvc.com \
--cc=dm-devel@redhat.com \
--cc=hare@suse.de \
--cc=xose.vazquez@gmail.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