NetBSD-Bugs archive

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

kern/43785: ejecting cd causes error messages



>Number:         43785
>Category:       kern
>Synopsis:       ejecting a cd causes error messages.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 21 17:05:00 +0000 2010
>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@localhost:/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) {



Home | Main Index | Thread Index | Old Index