Date: Tue, 23 Nov 2010 22:52:59 +0000 From: Bruce Cran <bruce@cran.org.uk> To: freebsd-scsi@freebsd.org Subject: cam patch: reducing logging output for 'normal' failures Message-ID: <20101123225259.35bf33e1@core.draftnet>
next in thread | raw e-mail | index | archive | help
--MP_/efBNnrXszm2vVrBZA8kY52b Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I came across http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/119668 which contains a patch to reduce the verbosity of output from the cam subsystem. cam has a tendancy to be a bit spammy when it comes across fairly normal situations such as the tray having been left open, or there just not being a disc present. For example: (probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 (probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error (probe0:umass-sim0:0:0:0): SCSI status: Check Condition (probe0:umass-sim0:0:0:0): SCSI sense: NOT READY asc:3a,1 (Medium not present - tray closed) cd0 at umass-sim0 bus 0 scbus9 target 0 lun 0 cd0: <DVDRW USB H16X B02T> Removable CD-ROM SCSI-0 device cd0: 40.000MB/s transfers cd0: Attempt to query device size failed: NOT READY, Medium not present - tray closed The first message, "Medium not present - tray closed" is unnecessary since it's repeated a few lines later and can look as though there's a real problem. I've attached an updated patch which adds the the tray open warning too. Any comments? -- Bruce Cran --MP_/efBNnrXszm2vVrBZA8kY52b Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=cam_nonfatal.diff Index: sys/cam/cam_periph.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/cam/cam_periph.c (revision 215717) +++ sys/cam/cam_periph.c (working copy) @@ -1630,7 +1630,8 @@ } =20 sense_error_done: - if ((err_action & SSQ_PRINT_SENSE) !=3D 0 + if (((err_action & SSQ_PRINT_SENSE) !=3D 0 + || ((err_action & SSQ_PRINT_SENSE_VERBOSE) !=3D 0 && bootverbose)) && (ccb->ccb_h.status & CAM_AUTOSNS_VALID) !=3D 0) cam_error_print(orig_ccb, CAM_ESF_ALL, CAM_EPF_ALL); } Index: sys/cam/scsi/scsi_all.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/cam/scsi/scsi_all.h (revision 215717) +++ sys/cam/scsi/scsi_all.h (working copy) @@ -90,6 +90,7 @@ * and text. */ SSQ_PRINT_SENSE =3D 0x0800, + SSQ_PRINT_SENSE_VERBOSE =3D 0x1000, SSQ_MASK =3D 0xff00 } scsi_sense_action_qualifier; =20 @@ -105,6 +106,12 @@ /* Fatal error action, with table specified error code */ #define SS_FATAL SS_FAIL|SSQ_PRINT_SENSE =20 +/* Fatal error action, with table specified error code + * This type of error does not imply malfunction of hardware and + * indicates conditions that can occur in "normal" circumstances + */ +#define SS_FATAL_NORMAL SS_FAIL|SSQ_PRINT_SENSE_VERBOSE + struct scsi_generic { u_int8_t opcode; Index: sys/cam/scsi/scsi_all.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/cam/scsi/scsi_all.c (revision 215717) +++ sys/cam/scsi/scsi_all.c (working copy) @@ -1431,7 +1431,7 @@ { SST(0x27, 0x06, SS_RDEF, /* XXX TBD */ "Conditional write protect") }, /* DTLPWROMAEBKVF */ - { SST(0x28, 0x00, SS_FATAL | ENXIO, + { SST(0x28, 0x00, SS_FATAL_NORMAL | ENXIO, "Not ready to ready change, medium may have changed") }, /* DT WROM B */ { SST(0x28, 0x01, SS_FATAL | ENXIO, @@ -1691,13 +1691,13 @@ { SST(0x39, 0x00, SS_RDEF, "Saving parameters not supported") }, /* DTL WROM BK */ - { SST(0x3A, 0x00, SS_FATAL | ENXIO, + { SST(0x3A, 0x00, SS_FATAL_NORMAL | ENXIO, "Medium not present") }, /* DT WROM BK */ - { SST(0x3A, 0x01, SS_FATAL | ENXIO, + { SST(0x3A, 0x01, SS_FATAL_NORMAL | ENXIO, "Medium not present - tray closed") }, /* DT WROM BK */ - { SST(0x3A, 0x02, SS_FATAL | ENXIO, + { SST(0x3A, 0x02, SS_FATAL_NORMAL | ENXIO, "Medium not present - tray open") }, /* DT WROM B */ { SST(0x3A, 0x03, SS_RDEF, /* XXX TBD */ @@ -2376,7 +2376,7 @@ { SST(0x63, 0x01, SS_FATAL | ENOSPC, "Packet does not fit in available space") }, /* R */ - { SST(0x64, 0x00, SS_FATAL | ENXIO, + { SST(0x64, 0x00, SS_FATAL_NORMAL | ENXIO, "Illegal mode for this track") }, /* R */ { SST(0x64, 0x01, SS_RDEF, --MP_/efBNnrXszm2vVrBZA8kY52b--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101123225259.35bf33e1>