diff mbox

[1/2] libmultipath: fallback to const prio if getprio() fails

Message ID 20180320165010.15259-1-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Martin Wilck March 20, 2018, 4:50 p.m. UTC
Some storage controllers don't support ALUA even though they have
hwtable entries telling so. One such example is the IBM IPR SAS controller
found on certain IBM Power systems. IBM has confirmed that reliable
detection of ALUA support for this controller by vendor/model/rev is
impossible.

For such cases, instead of simply failing to setup multipath, fall back
to const prio.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/discovery.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

Comments

Martin Wilck March 20, 2018, 9:13 p.m. UTC | #1
On Tue, 2018-03-20 at 17:50 +0100, Martin Wilck wrote:
> Some storage controllers don't support ALUA even though they have
> hwtable entries telling so. One such example is the IBM IPR SAS
> controller
> found on certain IBM Power systems. IBM has confirmed that reliable
> detection of ALUA support for this controller by vendor/model/rev is
> impossible.
> 
> For such cases, instead of simply failing to setup multipath, fall
> back
> to const prio.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>

NACK to self. I just realized that this won't work, because we might be
resetting e.g. alua prioritizer to "const" because of a temporary
problem. So this needs more thought.

Martin
diff mbox

Patch

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 9f2a9c907914..a51eb0b82f53 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1637,9 +1637,26 @@  get_prio (struct path * pp)
 	pp->priority = prio_getprio(p, pp, conf->checker_timeout);
 	put_multipath_config(conf);
 	if (pp->priority < 0) {
-		condlog(3, "%s: %s prio error", pp->dev, prio_name(p));
-		pp->priority = PRIO_UNDEF;
-		return 1;
+		const char origin[] = "(fallback after error)";
+
+		if (strcmp(prio_name(p), DEFAULT_PRIO)) {
+			conf = get_multipath_config();
+			prio_get(conf->multipath_dir, p, DEFAULT_PRIO,
+				 DEFAULT_PRIO_ARGS);
+			pp->priority = prio_getprio(p, pp,
+						    conf->checker_timeout);
+			put_multipath_config(conf);
+		}
+
+		if (pp->priority < 0) {
+			condlog(1, "%s: %s prio error", pp->dev, prio_name(p));
+			pp->priority = PRIO_UNDEF;
+			return 1;
+		}
+
+		condlog(3, "%s: new prio = %s %s", pp->dev, prio_name(p), origin);
+		condlog(3, "%s: new prio args = \"%s\" %s", pp->dev, prio_args(p),
+			origin);
 	}
 	condlog(3, "%s: %s prio = %u",
 		pp->dev, prio_name(p), pp->priority);