4728c8
---
4728c8
 libmultipath/discovery.c        |   15 +++++++++++++--
4728c8
 libmultipath/pgpolicies.c       |    2 +-
4728c8
 libmultipath/prioritizers/ana.c |    2 +-
4728c8
 3 files changed, 15 insertions(+), 4 deletions(-)
4728c8
4728c8
Index: multipath-tools-130222/libmultipath/discovery.c
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/libmultipath/discovery.c
4728c8
+++ multipath-tools-130222/libmultipath/discovery.c
4728c8
@@ -1234,6 +1234,7 @@ get_state (struct path * pp, int daemon,
4728c8
 static int
4728c8
 get_prio (struct path * pp)
4728c8
 {
4728c8
+	int old_prio;
4728c8
 	if (!pp)
4728c8
 		return 0;
4728c8
 
4728c8
@@ -1247,10 +1248,20 @@ get_prio (struct path * pp)
4728c8
 			return 1;
4728c8
 		}
4728c8
 	}
4728c8
+	old_prio = pp->priority;
4728c8
 	pp->priority = prio_getprio(p, pp);
4728c8
 	if (pp->priority < 0) {
4728c8
-		condlog(3, "%s: %s prio error", pp->dev, prio_name(p));
4728c8
-		pp->priority = PRIO_UNDEF;
4728c8
+		/* this changes pp->offline, but why not */
4728c8
+		int state = path_offline(pp);
4728c8
+
4728c8
+		if (state == PATH_DOWN || state == PATH_PENDING) {
4728c8
+			pp->priority = old_prio;
4728c8
+			condlog(3, "%s: %s prio error in state %d, keeping prio = %d", pp->dev, prio_name(p), state, pp->priority);
4728c8
+		} else {
4728c8
+			condlog(3, "%s: %s prio error in state %d",
4728c8
+				pp->dev, prio_name(p), state);
4728c8
+			pp->priority = PRIO_UNDEF;
4728c8
+		}
4728c8
 		return 1;
4728c8
 	}
4728c8
 	condlog(3, "%s: %s prio = %u",
4728c8
Index: multipath-tools-130222/libmultipath/pgpolicies.c
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/libmultipath/pgpolicies.c
4728c8
+++ multipath-tools-130222/libmultipath/pgpolicies.c
4728c8
@@ -308,7 +308,7 @@ extern int
4728c8
 group_by_prio (struct multipath * mp)
4728c8
 {
4728c8
 	int i;
4728c8
-	unsigned int prio;
4728c8
+	int prio;
4728c8
 	struct path * pp;
4728c8
 	struct pathgroup * pgp;
4728c8
 
4728c8
Index: multipath-tools-130222/libmultipath/prioritizers/ana.c
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/libmultipath/prioritizers/ana.c
4728c8
+++ multipath-tools-130222/libmultipath/prioritizers/ana.c
4728c8
@@ -165,7 +165,7 @@ int get_ana_info(struct path * pp, unsig
4728c8
 				   ana_log, ana_log_len);
4728c8
 	pthread_cleanup_pop(1);
4728c8
 	if (rc >= 0)
4728c8
-		condlog(3, "%s: ana state = %02x [%s]", pp->dev, rc,
4728c8
+		condlog(4, "%s: ana state = %02x [%s]", pp->dev, rc,
4728c8
 			aas_print_string(rc));
4728c8
 	return rc;
4728c8
 }