Blame SOURCES/0069-UPBZ-1033791-improve-rdac-checker.patch

4ae388
---
4ae388
 libmultipath/checkers/rdac.c |   91 ++++++++++++++++++++++++++++++++++++++-----
4ae388
 libmultipath/discovery.c     |    2 
4ae388
 2 files changed, 81 insertions(+), 12 deletions(-)
4ae388
4ae388
Index: multipath-tools-130222/libmultipath/checkers/rdac.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/checkers/rdac.c
4ae388
+++ multipath-tools-130222/libmultipath/checkers/rdac.c
4ae388
@@ -34,6 +34,18 @@
4ae388
 #define MSG_RDAC_UP    "rdac checker reports path is up"
4ae388
 #define MSG_RDAC_DOWN  "rdac checker reports path is down"
4ae388
 #define MSG_RDAC_GHOST "rdac checker reports path is ghost"
4ae388
+#define MSG_RDAC_DOWN_TYPE(STR) MSG_RDAC_DOWN": "STR
4ae388
+
4ae388
+#define RTPG_UNAVAILABLE	0x3
4ae388
+#define RTPG_OFFLINE		0xE
4ae388
+#define RTPG_TRANSITIONING	0xF
4ae388
+
4ae388
+#define RTPG_UNAVAIL_NON_RESPONSIVE	0x2
4ae388
+#define RTPG_UNAVAIL_IN_RESET		0x3
4ae388
+#define RTPG_UNAVAIL_CFW_DL1		0x4
4ae388
+#define RTPG_UNAVAIL_CFW_DL2		0x5
4ae388
+#define RTPG_UNAVAIL_QUIESCED		0x6
4ae388
+#define RTPG_UNAVAIL_SERVICE_MODE	0x7
4ae388
 
4ae388
 struct control_mode_page {
4ae388
 	unsigned char header[8];
4ae388
@@ -199,22 +211,64 @@ struct volume_access_inq
4ae388
 	char PQ_PDT;
4ae388
 	char dontcare0[7];
4ae388
 	char avtcvp;
4ae388
-	char dontcare1;
4ae388
-	char asym_access_state_cur;
4ae388
+	char vol_ppp;
4ae388
+	char aas_cur;
4ae388
 	char vendor_specific_cur;
4ae388
-	char dontcare2[36];
4ae388
+	char aas_alt;
4ae388
+	char vendor_specific_alt;
4ae388
+	char dontcare1[34];
4ae388
 };
4ae388
 
4ae388
+const char
4ae388
+*checker_msg_string(struct volume_access_inq *inq)
4ae388
+{
4ae388
+	/* lun not connected */
4ae388
+	if (((inq->PQ_PDT & 0xE0) == 0x20) || (inq->PQ_PDT & 0x7f))
4ae388
+		return MSG_RDAC_DOWN_TYPE("lun not connected");
4ae388
+
4ae388
+	/* if no tpg data is available, give the generic path down message */
4ae388
+	if (!(inq->avtcvp & 0x10))
4ae388
+		return MSG_RDAC_DOWN;
4ae388
+
4ae388
+	/* controller is booting up */
4ae388
+	if (((inq->aas_cur & 0x0F) == RTPG_TRANSITIONING) &&
4ae388
+		(inq->aas_alt & 0x0F) != RTPG_TRANSITIONING)
4ae388
+		return MSG_RDAC_DOWN_TYPE("ctlr is in startup sequence");
4ae388
+
4ae388
+	/* if not unavailable, give generic message */
4ae388
+	if ((inq->aas_cur & 0x0F) != RTPG_UNAVAILABLE)
4ae388
+		return MSG_RDAC_DOWN;
4ae388
+
4ae388
+	/* target port group unavailable */
4ae388
+	switch (inq->vendor_specific_cur) {
4ae388
+	case RTPG_UNAVAIL_NON_RESPONSIVE:
4ae388
+		return MSG_RDAC_DOWN_TYPE("non-responsive to queries");
4ae388
+	case RTPG_UNAVAIL_IN_RESET:
4ae388
+		return MSG_RDAC_DOWN_TYPE("ctlr held in reset");
4ae388
+	case RTPG_UNAVAIL_CFW_DL1:
4ae388
+	case RTPG_UNAVAIL_CFW_DL2:
4ae388
+		return MSG_RDAC_DOWN_TYPE("ctlr firmware downloading");
4ae388
+	case RTPG_UNAVAIL_QUIESCED:
4ae388
+		return MSG_RDAC_DOWN_TYPE("ctlr quiesced by admin request");
4ae388
+	case RTPG_UNAVAIL_SERVICE_MODE:
4ae388
+		return MSG_RDAC_DOWN_TYPE("ctlr is in service mode");
4ae388
+	default:
4ae388
+		return MSG_RDAC_DOWN_TYPE("ctlr is unavailable");
4ae388
+	}
4ae388
+}
4ae388
+
4ae388
 extern int
4ae388
 libcheck_check (struct checker * c)
4ae388
 {
4ae388
 	struct volume_access_inq inq;
4ae388
-	int ret;
4ae388
+	int ret, inqfail;
4ae388
 
4ae388
+	inqfail = 0;
4ae388
 	memset(&inq, 0, sizeof(struct volume_access_inq));
4ae388
 	if (0 != do_inq(c->fd, 0xC9, &inq, sizeof(struct volume_access_inq),
4ae388
 			c->timeout)) {
4ae388
 		ret = PATH_DOWN;
4ae388
+		inqfail = 1;
4ae388
 		goto done;
4ae388
 	} else if (((inq.PQ_PDT & 0xE0) == 0x20) || (inq.PQ_PDT & 0x7f)) {
4ae388
 		/* LUN not connected*/
4ae388
@@ -222,11 +276,27 @@ libcheck_check (struct checker * c)
4ae388
 		goto done;
4ae388
 	}
4ae388
 
4ae388
-	/* check if controller is reporting asymmetric access state of unavailable */
4ae388
-	if ((inq.avtcvp & 0x10) &&
4ae388
-	    ((inq.asym_access_state_cur & 0x0F) == 0x3)) {
4ae388
-		ret = PATH_DOWN;
4ae388
-		goto done;
4ae388
+	/* If TPGDE bit set, evaluate TPG information */
4ae388
+	if ((inq.avtcvp & 0x10)) {
4ae388
+		switch (inq.aas_cur & 0x0F) {
4ae388
+		/* Never use the path if it reports unavailable */
4ae388
+		case RTPG_UNAVAILABLE:
4ae388
+			ret = PATH_DOWN;
4ae388
+			goto done;
4ae388
+		/*
4ae388
+		 * If both controllers report transitioning, it
4ae388
+		 * means mode select or STPG is being processed.
4ae388
+		 *
4ae388
+		 * If this controller alone is transitioning, it's
4ae388
+		 * booting and we shouldn't use it yet.
4ae388
+		 */
4ae388
+		case RTPG_TRANSITIONING:
4ae388
+			if ((inq.aas_alt & 0xF) != RTPG_TRANSITIONING) {
4ae388
+				ret = PATH_DOWN;
4ae388
+				goto done;
4ae388
+			}
4ae388
+			break;
4ae388
+		}
4ae388
 	}
4ae388
 
4ae388
 	/* If owner set or ioship mode is enabled return PATH_UP always */
4ae388
@@ -238,7 +308,8 @@ libcheck_check (struct checker * c)
4ae388
 done:
4ae388
 	switch (ret) {
4ae388
 	case PATH_DOWN:
4ae388
-		MSG(c, MSG_RDAC_DOWN);
4ae388
+		MSG(c, (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") :
4ae388
+			checker_msg_string(&inq));
4ae388
 		break;
4ae388
 	case PATH_UP:
4ae388
 		MSG(c, MSG_RDAC_UP);
4ae388
Index: multipath-tools-130222/libmultipath/discovery.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/discovery.c
4ae388
+++ multipath-tools-130222/libmultipath/discovery.c
4ae388
@@ -1116,8 +1116,6 @@ pathinfo (struct path *pp, vector hwtabl
4ae388
 			if (!strlen(pp->wwid))
4ae388
 				get_uid(pp);
4ae388
 			get_prio(pp);
4ae388
-		} else {
4ae388
-			pp->priority = PRIO_UNDEF;
4ae388
 		}
4ae388
 	}
4ae388