NetBSD Problem Report #43785
From christos@zoulas.com Sat Aug 21 17:01:01 2010
Return-Path: <christos@zoulas.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 9AB6263BC30
for <gnats-bugs@gnats.NetBSD.org>; Sat, 21 Aug 2010 17:01:01 +0000 (UTC)
Message-Id: <20100821170100.6EB8E56426@rebar.astron.com>
Date: Sat, 21 Aug 2010 17:01:00 +0000 (UTC)
From: christos@netbsd.org
Reply-To: christos@netbsd.org
To: gnats-bugs@gnats.NetBSD.org
Subject: ejecting cd causes error messages
X-Send-Pr-Version: 3.95
>Number: 43785
>Category: kern
>Synopsis: ejecting a cd causes error messages.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: martin
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Aug 21 17:05:00 +0000 2010
>Closed-Date: Sun Dec 30 07:55:44 +0000 2012
>Last-Modified: Sun Dec 30 07:55:44 +0000 2012
>Originator: Christos Zoulas
>Release:
>Organization:
Entropy and Noise Reduction, LLC.
>Environment:
System:
NetBSD bulky.astron.com 5.99.38 NetBSD 5.99.38 (BULKY) #2: Sat Aug 14 13:22:23 EDT 2010 christos@bulky.astron.com:/usr/src/sys/arch/amd64/compile/BULKY amd64
Architecture: amd64
Machine: amd64
>Description:
Ejecting a CD or DVD produces a rather annoying error message.
>How-To-Repeat:
Eject messages with a written DVD in drive.
------------------------------------------------------------------------
Aug 21 11:03:24 t61 /netbsd: cd0(piixide0:1:0): Check Condition on CDB: 0x35 00 00 00 00 00 00 00 00 00
Aug 21 11:03:24 t61 /netbsd: SENSE KEY: Not Ready
Aug 21 11:03:24 t61 /netbsd: ASC/ASCQ: Medium Not Present
Aug 21 11:03:24 t61 /netbsd:
------------------------------------------------------------------------
This started with:
"$NetBSD: cd.c,v 1.289 2009/03/17 21:25:47 reinoud Exp $"
when the cdcachesync() call was added to cdclose(). The problem here
is that the drive is open when cdclose() is called after the eject
ioctl is done.
More recently (the last few months), ejecting a blank DVD started to
produce even more error messages; formerly, the error message was the
same for both blank and written DVDs.
Eject messages with a blank DVD in drive.
------------------------------------------------------------------------
Aug 21 11:02:36 t61 /netbsd: cd0(piixide0:1:0): Check Condition on CDB: 0x43 00 00 00 00 00 00 00 0c 40
Aug 21 11:02:36 t61 /netbsd: SENSE KEY: Illegal Request
Aug 21 11:02:36 t61 /netbsd: ASC/ASCQ: Illegal Field in CDB
Aug 21 11:02:36 t61 /netbsd:
Aug 21 11:02:36 t61 /netbsd: cd0(piixide0:1:0): Check Condition on CDB: 0x28 00 00 00 00 00 00 00 01 00
Aug 21 11:02:36 t61 /netbsd: SENSE KEY: Illegal Request
Aug 21 11:02:36 t61 /netbsd: ASC/ASCQ: Logical Block Address Out of Range
Aug 21 11:02:36 t61 /netbsd:
Aug 21 11:02:36 t61 /netbsd: cd0: dos partition I/O error
Aug 21 11:02:36 t61 /netbsd: cd0(piixide0:1:0): Check Condition on CDB: 0x43 00 00 00 00 00 00 00 0c 40
Aug 21 11:02:36 t61 /netbsd: SENSE KEY: Illegal Request
Aug 21 11:02:36 t61 /netbsd: ASC/ASCQ: Illegal Field in CDB
Aug 21 11:02:36 t61 /netbsd:
Aug 21 11:02:39 t61 /netbsd: cd0(piixide0:1:0): Check Condition on CDB: 0x35 00 00 00 00 00 00 00 00 00
Aug 21 11:02:39 t61 /netbsd: SENSE KEY: Not Ready
Aug 21 11:02:39 t61 /netbsd: ASC/ASCQ: Medium Not Present
Aug 21 11:02:39 t61 /netbsd:
------------------------------------------------------------------------
I have not looked to see what is producing these extra messages in the
blank DVD eject case.
>Fix:
Set "silent" to XS_CTL_SILENT in cdclose() when the drive is open
(detected via PERIPH_OPEN) or when ejecting (add CDF_EJECTING and set
it in the eject ioctl). Either will take care of the "Medium Not
Present" error message. I have not looked at eliminating the other
blank DVD eject messages.
Index: cd.c
=====================================================================
RCS file: /s/NetBSD/cvsroot/src/sys/dev/scsipi/cd.c,v
retrieving revision 1.302
diff -u -r1.302 cd.c
--- cd.c 4 Apr 2010 21:36:22 -0000 1.302
+++ cd.c 21 Aug 2010 15:15:21 -0000
@@ -517,6 +517,11 @@
cd->sc_dk.dk_label->d_partitions[part].p_fstype == FS_UNUSED)))
silent = XS_CTL_SILENT;
+ if ((cd->flags & CDF_EJECTING) != 0) {
+ cd->flags &= ~CDF_EJECTING;
+ silent = XS_CTL_SILENT;
+ }
+
mutex_enter(&cd->sc_lock);
switch (fmt) {
@@ -1581,6 +1586,7 @@
/* FALLTHROUGH */
case CDIOCEJECT: /* FALLTHROUGH */
case ODIOCEJECT:
+ cd->flags |= CDF_EJECTING;
return (scsipi_start(periph, SSS_STOP|SSS_LOEJ, 0));
case DIOCCACHESYNC:
/* SYNCHRONISE CACHES command */
Index: cdvar.h
=====================================================================
RCS file: /s/NetBSD/cvsroot/src/sys/dev/scsipi/cdvar.h,v
retrieving revision 1.29
diff -u -r1.29 cdvar.h
--- cdvar.h 19 Oct 2009 18:41:16 -0000 1.29
+++ cdvar.h 21 Aug 2010 15:15:33 -0000
@@ -35,6 +35,7 @@
#define CDF_WLABEL 0x04 /* label is writable */
#define CDF_LABELLING 0x08 /* writing label */
#define CDF_ANCIENT 0x10 /* disk is ancient; for minphys */
+#define CDF_EJECTING 0x20 /* ejecting disc */
struct scsipi_periph *sc_periph;
Index: cd.c
=====================================================================
RCS file: /s/NetBSD/cvsroot/src/sys/dev/scsipi/cd.c,v
retrieving revision 1.302
diff -u -r1.302 cd.c
--- cd.c 4 Apr 2010 21:36:22 -0000 1.302
+++ cd.c 21 Aug 2010 15:55:22 -0000
@@ -517,6 +517,9 @@
cd->sc_dk.dk_label->d_partitions[part].p_fstype == FS_UNUSED)))
silent = XS_CTL_SILENT;
+ if ((periph->periph_flags & PERIPH_OPEN) != 0)
+ silent = XS_CTL_SILENT;
+
mutex_enter(&cd->sc_lock);
switch (fmt) {
>Release-Note:
>Audit-Trail:
From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc:
Subject: Re: kern/43785: ejecting cd causes error messages
Date: Sun, 22 Aug 2010 10:12:51 -0400
The second patch is silly; perhaps this is better?
Index: cd.c
=====================================================================
RCS file: /s/NetBSD/cvsroot/src/sys/dev/scsipi/cd.c,v
retrieving revision 1.302
diff -u -r1.302 cd.c
--- cd.c 4 Apr 2010 21:36:22 -0000 1.302
+++ cd.c 22 Aug 2010 13:45:47 -0000
@@ -511,6 +511,7 @@
struct scsipi_adapter *adapt = periph->periph_channel->chan_adapter;
int part = CDPART(dev);
int silent = 0;
+ int error;
if (part == RAW_PART && ((cd->sc_dk.dk_label->d_npartitions == 0)=
||
(part < cd->sc_dk.dk_label->d_npartitions &&
@@ -519,6 +520,13 @@
mutex_enter(&cd->sc_lock);
+ error = scsipi_test_unit_ready(periph,
+ XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_MEDIA_CHANGE |
+ XS_CTL_SILENT);
+ /* XXX: is ENODEV sufficient here? */
+ if (error == ENODEV)
+ silent = XS_CTL_SILENT;
+
switch (fmt) {
case S_IFCHR:
cd->sc_dk.dk_copenmask &= ~(1 << part);
From: Antti Kantee <pooka@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/43785 CVS commit: src/tests/dev
Date: Tue, 24 Aug 2010 11:29:46 +0000
Module Name: src
Committed By: pooka
Date: Tue Aug 24 11:29:45 UTC 2010
Modified Files:
src/tests/dev: Makefile
Added Files:
src/tests/dev/scsipi: Makefile t_cd.c
Log Message:
Test for cache sync noises after disk is ejected.
test case for PR kern/43785
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/dev/scsipi/Makefile \
src/tests/dev/scsipi/t_cd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: kern-bug-people->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Sun, 06 May 2012 17:24:12 +0000
Responsible-Changed-Why:
Should be fixed now.
State-Changed-From-To: open->feedback
State-Changed-By: martin@NetBSD.org
State-Changed-When: Sun, 06 May 2012 17:24:12 +0000
State-Changed-Why:
I think I fixed it, can you confirm?
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/43785 CVS commit: src/sys/dev/scsipi
Date: Sun, 6 May 2012 17:23:11 +0000
Module Name: src
Committed By: martin
Date: Sun May 6 17:23:10 UTC 2012
Modified Files:
src/sys/dev/scsipi: cd.c
Log Message:
When ejecting a medium, invalidate the in core disklabel - it is not
meaningfull anymore. This makes the following cdclose() use silent
mode and finally fixes PR kern/43785.
To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/sys/dev/scsipi/cd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 30 Dec 2012 07:55:44 +0000
State-Changed-Why:
Feedback timeout.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.