Module Name:    src
Committed By:   christos
Date:           Mon Oct  6 14:42:08 UTC 2014

Modified Files:
        src/sys/dev/scsipi: scsipi_base.c

Log Message:
PR/49054: Uwe Toenjes: Some RAID controllers return more bytes in the
scsi 3 inquiry command than expected by the size of the scsi 3 inquiry
packet. This can be detected by looking at the additional_length field
returned by the scsi 2 inquiry. If that's the case, avoid doing the
scsi 3 inquiry because we can't handle the extra bytes later.
XXX: Pullup -7


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/dev/scsipi/scsipi_base.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/scsipi/scsipi_base.c
diff -u src/sys/dev/scsipi/scsipi_base.c:1.160 src/sys/dev/scsipi/scsipi_base.c:1.161
--- src/sys/dev/scsipi/scsipi_base.c:1.160	Sun Jul 13 13:12:23 2014
+++ src/sys/dev/scsipi/scsipi_base.c	Mon Oct  6 10:42:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsipi_base.c,v 1.160 2014/07/13 17:12:23 dholland Exp $	*/
+/*	$NetBSD: scsipi_base.c,v 1.161 2014/10/06 14:42:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.160 2014/07/13 17:12:23 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.161 2014/10/06 14:42:08 christos Exp $");
 
 #include "opt_scsi.h"
 
@@ -1064,7 +1064,7 @@ scsipi_inquire(struct scsipi_periph *per
 
 	/*
 	 * If we request more data than the device can provide, it SHOULD just
-	 * return a short reponse.  However, some devices error with an
+	 * return a short response.  However, some devices error with an
 	 * ILLEGAL REQUEST sense code, and yet others have even more special
 	 * failture modes (such as the GL641USB flash adapter, which goes loony
 	 * and sends corrupted CRCs).  To work around this, and to bring our
@@ -1081,6 +1081,7 @@ scsipi_inquire(struct scsipi_periph *per
 	    10000, NULL, flags | XS_CTL_DATA_IN);
 	if (!error &&
 	    inqbuf->additional_length > SCSIPI_INQUIRY_LENGTH_SCSI2 - 4) {
+	    if (inqbuf->additional_length <= SCSIPI_INQUIRY_LENGTH_SCSI3 - 4) {
 #if 0
 printf("inquire: addlen=%d, retrying\n", inqbuf->additional_length);
 #endif
@@ -1091,6 +1092,11 @@ printf("inquire: addlen=%d, retrying\n",
 #if 0
 printf("inquire: error=%d\n", error);
 #endif
+#if 1
+	    } else {
+printf("inquire: addlen=%d, not retrying\n", inqbuf->additional_length);
+#endif
+	    }
 	}
 
 #ifdef SCSI_OLD_NOINQUIRY

Reply via email to