From owner-freebsd-scsi@FreeBSD.ORG Tue Nov 23 22:53:24 2010 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A45041065675 for ; Tue, 23 Nov 2010 22:53:24 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (muon.cran.org.uk [IPv6:2a01:348:0:15:5d59:5c40:0:1]) by mx1.freebsd.org (Postfix) with ESMTP id 062C48FC13 for ; Tue, 23 Nov 2010 22:53:24 +0000 (UTC) Received: from muon.cran.org.uk (localhost [127.0.0.1]) by muon.cran.org.uk (Postfix) with ESMTP id 609A4E7224 for ; Tue, 23 Nov 2010 22:53:23 +0000 (GMT) Received: from core.draftnet (client-86-29-107-54.glfd.adsl.virginmedia.com [86.29.107.54]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA for ; Tue, 23 Nov 2010 22:53:22 +0000 (GMT) Date: Tue, 23 Nov 2010 22:52:59 +0000 From: Bruce Cran To: freebsd-scsi@freebsd.org Message-ID: <20101123225259.35bf33e1@core.draftnet> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.22.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/efBNnrXszm2vVrBZA8kY52b" Subject: cam patch: reducing logging output for 'normal' failures X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 22:53:24 -0000 --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: 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--