From owner-freebsd-scsi@FreeBSD.ORG Tue Apr 5 11:26:07 2011 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 1F0CE106566B for ; Tue, 5 Apr 2011 11:26:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 688DA8FC1A for ; Tue, 5 Apr 2011 11:26:05 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id OAA02330 for ; Tue, 05 Apr 2011 14:26:05 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Q74Oa-0005vq-Nk for freebsd-scsi@freebsd.org; Tue, 05 Apr 2011 14:26:04 +0300 Message-ID: <4D9AFC4C.9070702@FreeBSD.org> Date: Tue, 05 Apr 2011 14:26:04 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110308 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: freebsd-scsi@FreeBSD.org X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=X-VIET-VPS Content-Transfer-Encoding: 7bit Cc: Subject: silence CDIOREADTOCHEADER 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, 05 Apr 2011 11:26:07 -0000 Please consider the following patch: diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 4c49e2d3..3e86eb8 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -2135,7 +2135,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td) ("trying to do CDIOREADTOCHEADER\n")); error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, - sizeof (*th), /*sense_flags*/0); + sizeof (*th), /*sense_flags*/SF_NO_PRINT); if (error) { free(th, M_SCSICD); cam_periph_unlock(periph); The idea is the READ_TOC command is bound to fail with "Invalid field in CDB" if a disc in CD drive doesn't have any tracks, e.g. it is a blank disk. This is a quite normal condition that doesn't require verbose logging. Elsewhere in scsi_cd code we already call cdreadtoc with SF_NO_PRINT when we try find out disk information for internal cd(4) use. That is done for the same reason according to the comments. Main reason to want this change is that some userland applications, most prominently hald, have a habit of calling CDIOREADTOCHEADER while "tasting" a new disk in a drive. -- Andriy Gapon