@@ -36,6 +36,7 @@
struct sg_io_hdr io_hdr;
unsigned char sense_buffer[32];
struct tur_checker_context * ctxt = NULL;
+ int retry_tur = 5;
int ret;
/*
@@ -71,6 +72,7 @@
goto out;
}
+retry:
memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof (turCmdBlk);
@@ -86,6 +88,26 @@
goto out;
}
if (io_hdr.info & SG_INFO_OK_MASK) {
+ int key = 0, asc, ascq;
+
+ if (io_hdr.sb_len_wr > 3) {
+ if (io_hdr.sbp[0] == 0x72 || io_hdr.sbp[0] == 0x73) {
+ key = io_hdr.sbp[1] & 0x0f;
+ asc = io_hdr.sbp[2];
+ ascq = io_hdr.sbp[3];
+ } else if (io_hdr.sb_len_wr > 13 &&
+ ((io_hdr.sbp[0] & 0x7f) == 0x70 ||
+ (io_hdr.sbp[0] & 0x7f) == 0x71)) {
+ key = io_hdr.sbp[2] & 0x0f;
+ asc = io_hdr.sbp[12];
+ ascq = io_hdr.sbp[13];
+ }
+ }
+ if (key == 0x6) {
+ /* Unit Attention, retry */
+ if (--retry_tur)
+ goto retry;
+ }
MSG(MSG_TUR_DOWN);
ret = PATH_DOWN;
goto out;