Skip to contentSkip to conversation

Improve sense code scanning in sg_read() and tur checker

PATCH New Hannes Reinecke 1 participant 1 message Apr 30, 2008 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Improve sense code scanning in sg_read() and tur checker

sg_read and tur should be able to correctly parse sense data, as we might need to retry any UNIT ATTENTION sense codes.

---
 libmultipath/checkers/libsg.c |   13 ++++++++-
 libmultipath/checkers/tur.c   |   58 ++++++++++++++++++++++++++++------------
 2 files changed, 52 insertions(+), 19 deletions(-)
libmultipath/checkers/libsg.c +12 -1
index 9171b10..4cb7ecc 100644
@@ -72,10 +72,21 @@ retry:
 	    (0 == io_hdr.driver_status)) {
 		return PATH_UP;
 	} else {
+		int key = 0;
+
+		if (io_hdr.sb_len_wr > 3) {
+			if (sbb[0] == 0x72 || sbb[0] == 0x73)
+				key = sbb[1] & 0x0f;
+			else if (io_hdr.sb_len_wr > 13 &&
+				 ((sbb[0] & 0x7f) == 0x70 ||
+				  (sbb[0] & 0x7f) == 0x71))
+				key = sbb[2] & 0x0f;
+		}
+
 		/*
 		 * Retry if UNIT_ATTENTION check condition.
 		 */
-		if ((sbb[2]&0xf) == 6) {
+		if (key == 0x6) {
 			if (--retry_count)
 				goto retry;
 		}
libmultipath/checkers/tur.c +40 -18

66 lines not on this page · raw message

Signature · 1 line
1.5.2.4