propose: change some sense codes handling

Andriy Gapon avg at FreeBSD.org
Tue Apr 5 11:15:08 UTC 2011


I propose the following changes:

--- a/sys/cam/scsi/scsi_all.c
+++ b/sys/cam/scsi/scsi_all.c
@@ -1431,7 +1431,7 @@ static struct asc_table_entry asc_table[] = {
 	{ SST(0x27, 0x06, SS_RDEF,	/* XXX TBD */
 	    "Conditional write protect") },
 	/* DTLPWROMAEBKVF */
-	{ SST(0x28, 0x00, SS_FATAL | ENXIO,
+	{ SST(0x28, 0x00, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | EBUSY,
 	    "Not ready to ready change, medium may have changed") },
 	/* DT  WROM  B    */
 	{ SST(0x28, 0x01, SS_FATAL | ENXIO,

In my opinion this condition doesn't really mean a fatal error, but implies that
we should retry while new medium "settles down".
In my testing this change actually helps with some USB flashdrives and
cardreaders with slow access to media.

Perhaps some real SCSI devices use this sense code to signal a really "fatal"
condition?  Please let me know.

--- a/sys/cam/scsi/scsi_all.c
+++ b/sys/cam/scsi/scsi_all.c
@@ -1448,7 +1448,7 @@ static struct asc_table_entry asc_table[] = {
 	 * the networking errnos?  ECONNRESET anyone?
 	 */
 	/* DTLPWROMAEBKVF */
-	{ SST(0x29, 0x00, SS_FATAL | ENXIO,
+	{ SST(0x29, 0x00, SS_RDEF,
 	    "Power on, reset, or bus device reset occurred") },
 	/* DTLPWROMAEBKVF */
 	{ SST(0x29, 0x01, SS_RDEF,

Align handling of this condition with the rest of the conditions in the same
family: "Power on occurred", "SCSI bus reset occurred", "Bus device reset
function occurred", etc.
I don't see this particular condition should be special.
Any insights and/or historical reasons?

Thank you.
-- 
Andriy Gapon


More information about the freebsd-scsi mailing list