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

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