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

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