NetBSD Problem Report #51331
From www@NetBSD.org Sun Jul 10 17:33:24 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 2C0587AAB6
for <gnats-bugs@gnats.NetBSD.org>; Sun, 10 Jul 2016 17:33:24 +0000 (UTC)
Message-Id: <20160710173323.423977AABC@mollari.NetBSD.org>
Date: Sun, 10 Jul 2016 17:33:23 +0000 (UTC)
From: scole_mail@gmx.com
Reply-To: scole_mail@gmx.com
To: gnats-bugs@NetBSD.org
Subject: cdrom will not mount after first time
X-Send-Pr-Version: www-1.0
>Number: 51331
>Category: bin
>Synopsis: cdrom will not mount after first time
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jul 10 17:35:00 +0000 2016
>Closed-Date:
>Last-Modified: Thu Sep 17 20:30:01 +0000 2020
>Originator: scole_mail
>Release: 7.0.1
>Organization:
none
>Environment:
NetBSD dstar 7.0.1_PATCH NetBSD 7.0.1_PATCH (GENERIC) #0: Sat May 28 11:24:19 EDT 2016 scole@dstar:/home/scole/nbsd/7_0/obj/sys/arch/i386/compile/GENERIC i386
>Description:
My cdrom drive seems only to be able to mount a cd 1 time. After that
I need to reboot the machine to use it:
dstar# mount /cdrom
dstar# df /cdrom
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/cd0a 358 358 0 100% /cdrom
dstar# umount /cdrom
The eject button on cd-drive doesn't work anymore after that, but
doing
dstar# eject -v cdrom
device type == disk, floppy, or cdrom
Ejecting /dev/rcd0d...
done.
will eject it. But, then trying to remount again won't work anymore
dstar# mount /cdrom
mount_cd9660: /dev/cd0a on /cdrom: Device not configured
A reboot then seems required to mount the CD again.
My fstab contains this for the cdrom
/dev/cd0a /cdrom cd9660 ro,noauto
and dmesg output
cd0 at atapibus0 drive 0: <HL-DT-STDVD-RAM GH22NS30, , 1.00> cdrom removable
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
cd0(ahcisata0:2:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100) (using DMA)
Thanks
>How-To-Repeat:
Insert cdrom, mount cdrom, unmount cdrom, eject cdrom, try to mount cdrom again
>Fix:
>Release-Note:
>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/51331: cdrom will not mount after first time
Date: Sun, 10 Jul 2016 22:14:20 +0000
On Sun, Jul 10, 2016 at 05:35:00PM +0000, scole_mail@gmx.com wrote:
> My cdrom drive seems only to be able to mount a cd 1 time. After that
> I need to reboot the machine to use it:
>
> dstar# mount /cdrom
> dstar# df /cdrom
> Filesystem 1K-blocks Used Avail %Cap Mounted on
> /dev/cd0a 358 358 0 100% /cdrom
> dstar# umount /cdrom
>
> The eject button on cd-drive doesn't work anymore after that,
Does eject -U help? (probably not, but...)
Everything you're doing seems to be fine, so I'm wondering if the
problem is that it's not sensing media presence correctly. (And if so,
whether it's because of bugs or because the device is failing...)
--
David A. Holland
dholland@netbsd.org
From: John Nemeth <jnemeth@cue.bc.ca>
To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
scole_mail@gmx.com
Cc:
Subject: Re: bin/51331: cdrom will not mount after first time
Date: Sun, 10 Jul 2016 15:30:07 -0700
On Jul 10, 10:15pm, David Holland wrote:
}
} The following reply was made to PR bin/51331; it has been noted by GNATS.
}
} From: David Holland <dholland-bugs@netbsd.org>
} To: gnats-bugs@NetBSD.org
} Date: Sun, 10 Jul 2016 22:14:20 +0000
}
} On Sun, Jul 10, 2016 at 05:35:00PM +0000, scole_mail@gmx.com wrote:
} > My cdrom drive seems only to be able to mount a cd 1 time. After that
} > I need to reboot the machine to use it:
} >
} > dstar# mount /cdrom
} > dstar# df /cdrom
} > Filesystem 1K-blocks Used Avail %Cap Mounted on
} > /dev/cd0a 358 358 0 100% /cdrom
} > dstar# umount /cdrom
} >
} > The eject button on cd-drive doesn't work anymore after that,
}
} Does eject -U help? (probably not, but...)
}
} Everything you're doing seems to be fine, so I'm wondering if the
} problem is that it's not sensing media presence correctly. (And if so,
} whether it's because of bugs or because the device is failing...)
I would go with device is failing. For some reason, optical
drives are notoriously failure prone.
}-- End of excerpt from David Holland
From: scole_mail@gmx.com
To: John Nemeth <jnemeth@cue.bc.ca>
Cc: gnats-bugs@NetBSD.org
Subject: Re: bin/51331: cdrom will not mount after first time
Date: Sun, 10 Jul 2016 19:19:36 -0400
Actually, it won't eject the cdrom with the "-U" flag, but doesn't print
any errors either.
My cdrom is definitely old enough to be failing, but I'm not sure that
is the cause.
So far the reboot trick keeps working, but it is not like I use my cdrom
everyday. I guess I can try testing it more regularly, but it seems
like the cd-drive wouldn't work once in awhile after a reboot?
If you want to close the PR feel free, I can re-open it if convinced it
is not a bad cdrom. Unfortunately, I don't have another machine or
cdrom to swap and test at the moment.
Thanks
From: scole_mail@gmx.com
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/51331: cdrom will not mount after first time
Date: Mon, 11 Jul 2016 16:40:18 -0400
I messed around with this a little bit today and am more inclined to
think software bug and not bad hardware.
So I could mount/unmount the cdrom any number of times, but only if
didn't eject. Once ejected, I could not mount any longer and had to
reboot.
Even after I couldn't "mount /cdrom" anymore, I was able to burn and
read a CD fine with cdrtools. I could also use readcd from cdrtools to
read the iso data, and then mount the raw iso file with vnd0, but still
not mount the cdrom.
dstar# readcd dev=31,0,0 f=cd.raw
Read speed: 8468 kB/s (CD 48x, DVD 6x, BD 1x).
Write speed: 8468 kB/s (CD 48x, DVD 6x, BD 1x).
Capacity: 69488 Blocks = 138976 kBytes = 135 MBytes = 142 prMB
Sectorsize: 2048 Bytes
Copy from SCSI (31,0,0) disk to file 'cd.raw'
end: 69488
addr: 69488 cnt: 80
Time total: 38.406sec
Read 138976.00 kB at 3618.6 kB/sec.
dstar# mount /cdrom
mount_cd9660: /dev/cd0a on /cdrom: Device not configured
So it seems like the eject command is breaking "mount" somehow.
Thanks
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/51331: cdrom will not mount after first time
Date: Tue, 12 Jul 2016 07:32:58 +0700
Date: Mon, 11 Jul 2016 20:45:00 +0000 (UTC)
From: scole_mail@gmx.com
Message-ID: <20160711204501.02BE17AAB6@mollari.NetBSD.org>
| I messed around with this a little bit today and am more inclined to
| think software bug and not bad hardware.
From what I have read of your reports, I agree - it never really looked like
a hardware problem to me.
My guess from what you have described is that what is happening, is that
upon eject, the in-core label is set so that all partitions are FS_UNUSED
and when you attempt to open a FS_UNUSED partition, the driver returns
ENXIO (Device not configured) - which fits the symptoms exactly.
That check doesn't happen when the raw partition is opened, so accessing via
/dev/[r]cd0d would still work, which is probably why the other programs
(that access the CD via lower level mechanisms) still function fine.
You could test this hypothesis by getting to the point where /dev/cd0a mounts
are failing, and then try
mount -t cd9660 -r /dev/cd0d /cdrom
and see if that works.
What is supposed to happen is that when the CD is first opened, if the
media is not marked "loaded" ...
if ((periph->periph_flags & PERIPH_MEDIA_LOADED) == 0) {
the label is read (of there is one, which is unusual on a CD) or a
default label is constructed (the more normal case, with cd0a set to
FS_ISO9660 instead of FS_UNUSED).
What I don't see in sys/dev/scsipi/cd.c is any code to clear PERIPH_MEDIA_LOADED
after an eject is done. Yet the p_fstype of all entries in the label is
set to FS_UNUSED - so it seems likely than on any open after an eject,
on anything other than the raw partition is guaranteed to fail.
| So I could mount/unmount the cdrom any number of times, but only if
| didn't eject. Once ejected, I could not mount any longer and had to
| reboot.
You could also test this more by ejecting using the button on the drive,
rather than the command - if you can still mount the cd after ejecting
and reloading that way, I suspect we will have understood the problem,
and only need a suitable patch to clear PERIPH_MEDIA_LOADED at appropriate
places.
kre
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/51331: cdrom will not mount after first time
Date: Tue, 12 Jul 2016 05:41:52 +0000 (UTC)
kre@munnari.OZ.AU (Robert Elz) writes:
> What I don't see in sys/dev/scsipi/cd.c is any code to clear PERIPH_MEDIA_LOADED
> after an eject is done. Yet the p_fstype of all entries in the label is
> set to FS_UNUSED - so it seems likely than on any open after an eject,
> on anything other than the raw partition is guaranteed to fail.
The flag is supposed to be cleared by a UNIT ATTENTION sense which is
supposed to be generated always when the media is changed or a
NOT READY sense which is supposed to be returned for most commands
when no disk is loaded. This is handled by generic code in scsipi_base.c
and atapi_base.c.
Either event should be triggered by the scsipi_test_unit_ready()
or the following scsipi_start() call in cdopen().
So in theory, the code should just work....
--
--
Michael van Elst
Internet: mlelstv@serpens.de
"A potential Snark may lurk in every tree."
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/51331: cdrom will not mount after first time
Date: Tue, 12 Jul 2016 15:37:44 +0700
Date: Tue, 12 Jul 2016 05:45:01 +0000 (UTC)
From: mlelstv@serpens.de (Michael van Elst)
Message-ID: <20160712054501.6DEE87AAAD@mollari.NetBSD.org>
| The flag is supposed to be cleared by a UNIT ATTENTION sense which is
| supposed to be generated always when the media is changed or a
| NOT READY sense which is supposed to be returned for most commands
| when no disk is loaded. This is handled by generic code in scsipi_base.c
| and atapi_base.c.
Yes, I saw that (the ATAPI) version after I sent my last message ... however
I also saw that there are cases where the sense info can be sent, and not
reset the MEDIA_LOADED bit .. the generic sense handler first calls the
driver specific error handler (if there is one, and there is for the cd
driver) and if that returns anything other than EJUSTRETURN then the
generic routine just returns, and does not clear MEDIA_LOADED.
There appear to be 2 sense results which could clear MEDIA_LOADED,
SKEY_NOT_READY and SKEY_UNIT_ATTENTION - if the second happens, all
should be OK, but in the SKEY_NOT_READY case, there are several cases
(filled with magic numbers) in the cd driver that cause it to return
something other than EJUSTRETURN.
What is actually happening here I have no idea, but from the symptoms
described, I'd say that something in this area is very likely the cause
of the problem described. Perhaps the drive has some odd behaviour
that needs a quirk to deal with it (wouldn't be the first CD drive that
deviates from the standards...).
I think I'd just clear the MEDIA_LOADED bit in the case of an eject ioctl
(where the command is actually sent to the drive - ie: about the same place
that the previous label is invalidated) in all cases - what harm can it do?
The intent is clearly to cause the drive to eject the CD, so when it is
reloaded new info needs to be acquired - if the drive (for some reason)
refuses the eject, all that would happen is that the label (and other
init data) would be acquired again (the label needs to be to undo the
FS_UNUSED settings in any case).
But PC hardware is all voodoo to me, so don't do anything just because I
think it makes sense....
kre
From: scole_mail@gmx.com
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/51331: cdrom will not mount after first time
Date: Tue, 12 Jul 2016 10:14:07 -0400
Robert Elz <kre@munnari.OZ.AU> writes:
>
> You could test this hypothesis by getting to the point where /dev/cd0a mounts
> are failing, and then try
>
> mount -t cd9660 -r /dev/cd0d /cdrom
>
> and see if that works.
>
>
> You could also test this more by ejecting using the button on the drive,
> rather than the command - if you can still mount the cd after ejecting
> and reloading that way, I suspect we will have understood the problem,
> and only need a suitable patch to clear PERIPH_MEDIA_LOADED at appropriate
> places.
>
So I went through a typical sequence below (as well as others), most
of the time mounting the cd0d would work, either with the button or
eject command, but I did eventually get the error below, and then
couldn't mount anymore with either cd0a or cd0d.
The error seemed to happen (most of the time?) when the cd motor sounded
like it was still spinning and trying to do the mount command, but it
didn't happen every time, i.e., the mount command would succeed.
dstar# mount /cdrom (cd0a, works)
dstar# umount /cdrom (works fine)
(try to eject cdrom with button, fails)
dstar# eject cdrom (works)
(close cdrom door with button)
dstar# mount /cdrom
mount_cd9660: /dev/cd0a on /cdrom: Device not configured
dstar# mount -t cd9660 -r /dev/cd0d /cdrom (works)
dstar# umount /cdrom (command works)
(eject with button, works)
(close cdrom with button)
dstar# mount -t cd9660 -r /dev/cd0d /cdrom (works)
dstar# umount /cdrom (works)
dstar# mount -t cd9660 -r /dev/cd0d /cdrom (works)
dstar# umount /cdrom (works)
dstar# eject cdrom (works)
(close cdrom with button)
dstar# mount -t cd9660 -r /dev/cd0d /cdrom (works)
dstar# umount /cdrom (works)
(eject with button)
dstar# mount -t cd9660 -r /dev/cd0d /cdrom
mount_cd9660: /dev/cd0d on /cdrom: Input/output error (kernel logged error below)
Jul 12 09:45:28 dstar /netbsd: cd0(ahcisata0:2:0): Check Condition on CDB: 0x28 00 00 00 00 10 00 00 01 00
Jul 12 09:45:28 dstar /netbsd: SENSE KEY: Unit Attention
Jul 12 09:45:28 dstar /netbsd: ASC/ASCQ: Not Ready To Ready Transition (Medium May Have Changed)
Jul 12 09:45:28 dstar /netbsd:
(Yes the last line from kernel error messages was blank)
Thanks
From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, scole_mail@gmx.com
Subject: re: bin/51331: cdrom will not mount after first time
Date: Wed, 13 Jul 2016 18:37:39 +1000
> I messed around with this a little bit today and am more inclined to
> think software bug and not bad hardware.
>
> So I could mount/unmount the cdrom any number of times, but only if
> didn't eject. Once ejected, I could not mount any longer and had to
> reboot.
this reminds me heavily of a problem i have.
i can't run "eject" on my new desktop cdrom, i see the same problem
i guess. i have to use the manual button.
it also makes my whole system kind of suck -- there's something
holding the kernel lock i guess, as it is extremely slow and has
multiple 10s of non-responsive periods before the eject times out.
i never got around to testing beyond avoiding it yet, or testing
out a different drive. i've been using netbsd-7 on that system.
i wonder if it is some new(?) software problem or some new hardware
support issue.
.mrg.
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/51331: cdrom will not mount after first time
Date: Wed, 13 Jul 2016 16:02:48 +0000
On Tue, Jul 12, 2016 at 12:45:01AM +0000, Robert Elz wrote:
> | I messed around with this a little bit today and am more inclined to
> | think software bug and not bad hardware.
>
> From what I have read of your reports, I agree - it never really
> looked like a hardware problem to me.
Me too; or if it was, it was some weirdness/quirk pertaining to media
loading, not generic failure.
> You could also test this more by ejecting using the button on the drive,
> rather than the command - if you can still mount the cd after ejecting
> and reloading that way, I suspect we will have understood the problem,
> and only need a suitable patch to clear PERIPH_MEDIA_LOADED at appropriate
> places.
This sounds very promising :-)
--
David A. Holland
dholland@netbsd.org
State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 27 Aug 2016 03:49:28 +0000
State-Changed-Why:
Can you test as suggested?
From: scole_mail <scole_mail@gmx.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/51331: cdrom will not mount after first time
Date: Tue, 06 Sep 2016 12:56:20 -0700
Sorry I haven't responded earlier, I've been on travel. I think the
feedback asked for was
> You could also test this more by ejecting using the button on the drive,
> rather than the command - if you can still mount the cd after ejecting
> and reloading that way, I suspect we will have understood the problem,
> and only need a suitable patch to clear PERIPH_MEDIA_LOADED at appropriate
> places.
open door with button ok
insert cd & close door with button ok
eject cd with button ok
close door with button and cd ok
mount cd0a ok
umount /dev/cd0a ok
try to eject with button fails
"eject cdrom" ok
insert cdrom with button ok
try to mount fails
eject cdrom with button works
In summary, I can't eject the cdrom with the button after the first
mount.
The button will open and close the cdrom door fine until the cdrom has
been mounted.
After the cdrom has been mounted, then umounted, only an "eject" command
will open door. The button will not work at this point.
Once the cdrom is then ejected with a "eject" command (after first
mount), it can no longer be mounted:
mount_cd9660: /dev/cd0a on /cdrom: Device not configured
After the first mount/umount/eject-command sequence, the button and
eject command will still both open & close the door (before rebooting).
I cannot mount the cdrom a 2nd time after the first mount/umount.
Hope this helps
Thanks
State-Changed-From-To: feedback->open
State-Changed-By: scole@NetBSD.org
State-Changed-When: Tue, 20 Sep 2016 08:25:00 -0700
State-Changed-Why:
feedback provided
From: scole@netbsd.org (Sean Cole)
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/51331: cdrom will not mount after first time
Date: Thu, 17 Sep 2020 20:28:22 +0000 (UTC)
Just an update, this is still broken for amd64/9.0
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.