[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kern/119668: scsi/cam: certain errors are too verbose comparing to their importance

>Number:         119668
>Category:       kern
>Synopsis:       scsi/cam: certain errors are too verbose comparing to their importance
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 14 17:20:02 UTC 2008
>Originator:     Andriy Gapon
>Release:        FreeBSD 6.2-RELEASE-p6 amd64
System: FreeBSD 6.2-RELEASE-p6 amd64

Rationale for this request is that kernel messages easily get spammed
with the error reports which do not really mean error conditions. Some
amount of such noise comes from the kernel-land actions, lots more can
come from user-land programs unwittingly trying to do certain things on
the devices with no media or wrong media (example: hald).

Examples of such conditions: empty slots in card reader, changed media,
attempts to read audio CD as data CD. Typical CAM messages:
ILLEGAL REQUEST Illegal mode for this track
ILLEGAL REQUEST Medium removal prevented
NOT READY       Medium not present
UNIT ATTENTION  Not ready to ready change, medium may have changed

All of the above don't really mean any problem with a device or media,
in this sense the conditions can be called normal operation situations.

The following is proposed:
1. introduce new scsi_sense_action_qualifier value
SSQ_PRINT_SENSE_VERBOSE, which would mean that detailed command and
response information is to be printed only if bootverbose==1;

2. introduce new define SS_FATAL_NORMAL with value of
(SS_FAIL|SSQ_PRINT_SENSE_VERBOSE), which would mean a fatal SCSI error
that can happen in "normal conditions", i.e. in the most cases the error
doesn't imply a problem with a peripheral device, media, bus,
controller, etc;

3. use the above SS_FATAL_NORMAL for at least the conditions mentioned above;

4. modify camperiphscsisenseerror() to honor the new flag defined above;

P.S. the names I used above are no very good but I couldn't come up
with anything better.

Couple of links describing end-user experience (mine included):

The attached patch doesn't include code for 'Medium removal prevented'


--- verboseness.diff begins here ---
--- sys/cam/scsi/scsi_all.h.orig	Fri Dec 21 17:52:50 2007
+++ sys/cam/scsi/scsi_all.h	Fri Dec 21 17:57:29 2007
@@ -90,6 +90,7 @@ typedef enum {
 					    * and text.
 	SSQ_PRINT_SENSE		= 0x0800,
 	SSQ_MASK		= 0xff00
 } scsi_sense_action_qualifier;
@@ -104,6 +105,12 @@ typedef enum {
 /* Fatal error action, with table specified error code */
+/* Fatal error action, with table specified error code */
+/* This type of error doesn't imply malfunction of hardware and
+ * and indicates conditions that can occur in "normal" circumstances
+ */
 struct scsi_generic
--- sys/cam/scsi/scsi_all.c.orig	Fri Dec 21 17:54:50 2007
+++ sys/cam/scsi/scsi_all.c	Tue Dec 25 14:07:45 2007
@@ -1102,7 +1102,7 @@ static struct asc_table_entry asc_table[
 			"Persistent write protect") },
 /*  T           */{SST(0x27, 0x05, SS_FATAL|EACCES,
 			"Permanent write protect") },
 			"Not ready to ready change, medium may have changed") },
 			"Import or export element accessed") },
@@ -1197,7 +1197,7 @@ static struct asc_table_entry asc_table[
 			"Rounded parameter") },
 /* DTL WRSOMCAE */{SST(0x39, 0x00, SS_RDEF,
 			"Saving parameters not supported") },
-/* DTL WRSOM    */{SST(0x3A, 0x00, SS_FATAL|ENXIO,
 			"Medium not present") },
 /* DT  WR OM    */{SST(0x3A, 0x01, SS_FATAL|ENXIO,
 			"Medium not present - tray closed") },
@@ -1395,7 +1395,7 @@ static struct asc_table_entry asc_table[
 			"End of user area encountered on this track") },
 /*      R       */{SST(0x63, 0x01, SS_FATAL|ENOSPC,
 			"Packet does not fit in available space") },
-/*      R       */{SST(0x64, 0x00, SS_FATAL|ENXIO,
+/*      R       */{SST(0x64, 0x00, SS_FATAL_NORMAL|ENXIO,
 			"Illegal mode for this track") },
 /*      R       */{SST(0x64, 0x01, SS_RDEF,
 			"Invalid packet size") },
--- sys/cam/cam_periph.c.orig	Fri Dec 21 17:57:53 2007
+++ sys/cam/cam_periph.c	Fri Dec 21 18:00:13 2007
@@ -1515,7 +1515,8 @@ camperiphscsisenseerror(union ccb *ccb, 
-		if ((err_action & SSQ_PRINT_SENSE) != 0
+		if (((err_action & SSQ_PRINT_SENSE) != 0
+		    || ((err_action & SSQ_PRINT_SENSE_VERBOSE) != 0 && bootverbose))
 		 && (ccb->ccb_h.status & CAM_AUTOSNS_VALID) != 0) {
 			cam_error_print(print_ccb, CAM_ESF_ALL, CAM_EPF_ALL);
--- verboseness.diff ends here ---

freebsd-bugs_(_at_)_freebsd_(_dot_)_org mailing list
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe_(_at_)_freebsd_(_dot_)_org"