Bug 13628
| Summary: | CD-ROM is not locked if a volume is mounted. | ||
|---|---|---|---|
| Product: | [Retired] Red Hat Linux | Reporter: | Sam Varshavchik <mrsam> |
| Component: | magicdev | Assignee: | Owen Taylor <otaylor> |
| Status: | CLOSED RAWHIDE | QA Contact: | |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.1 | CC: | bero, david.balazic, harald, henris, herrold, menthos, redhat |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i386 | ||
| OS: | Linux | ||
| Whiteboard: | Florence RC-1 | ||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2001-02-07 23:23:12 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
I can verify this with 6.2 as well, but it only seems to do this with IDE drives. A Sony CDU33a locks just fine. I have a compaq 32x and a BCD-8X 1996-09-04, ATAPI CDROM drive that do not lock under 6.2. Verified that the problem still exists in beta4. Pinstripe still ejects a mounted CD. Another pinstripe datapoint: pinstripe install on a laptop with an IDE CDROM *does* properly lock the CD when it's mounted, and it cannot be ejected. Looks like a SCSI driver issue. Evidently works with IDE CD-Roms now. *** Bug 15520 has been marked as a duplicate of this bug. *** Everything is OK until magicdev mounts ( automatically ) a CD. After that the CD drive is never locked. Mounted or unmounted. magicdev running or not. my cd is /dev/hdc ( IDE secondary master ) Here is what happens. When magicdev is run, it runs the following
function ( in magicdev/magicmedia.c ) :
-----
static void
cdrom_ioctl_frenzy(int fd)
{
/* I have no idea what these ioctl's do - I just copied them from autorun ;-)
*/
ioctl(fd, CDROM_CLEAR_OPTIONS, CDO_LOCK|CDO_AUTO_CLOSE|CDO_AUTO_EJECT);
ioctl(fd, CDROM_SET_OPTIONS, CDO_USE_FFLAGS|CDO_CHECK_TYPE);
#ifdef CDROM_LOCKDOOR
ioctl(fd, CDROM_LOCKDOOR, 0);
#else
#warning "Need Linux kernel >= 2.2.4 to work with IDE."
#endif
}
-----
I think the comment says it all :-(
What happens is that it clears the CDO_LOCK flag of the CD drive,
which means that the drive is no more automatically locked when
mounted.
To fix this, do :
echo 0 > /proc/sys/dev/cdrom/lock
echo 1 > /proc/sys/dev/cdrom/lock
I think the magicdev people should think first and code later !
A quick fix to the magicdev code is to leave the CDO_LOCK flag
alone , since magicdev doesn't watch for ejects and then
automatically unmount the media, so it is left mounted and ejected.
Maybe the entire cdrom_ioctl_frenzy() function could be deleted ?
I recomend leaving automounting to the automounter !
( with a short umount timeout )
!
Bug still there in in Redhat Linux 7.0. And in Florence beta2. And in Redhat 7.1 ( isn't released yet , but wanna bet ? ) This bug is must fix for RC1. Bero/Harald, you also need to check out the autorun code and make sure it isn't doing something similarly stupid. This defect is considered MUST-FIX for Florence Release-Candidate #1 *** Bug 18680 has been marked as a duplicate of this bug. *** *** Bug 18680 has been marked as a duplicate of this bug. *** OK, here is a rewritten version of the function, leaving in
only one of the ioctls as a sanity check.
====
static void
cdrom_ioctl_frenzy(int fd)
{
/* This is complete paranoia - if someone cleared CDO_USE_FFLAGS (meaning
* "ignore O_NONBLOCK"), and CDO_CHECK_TYPE is set, then things will
* be messed up.
*/
ioctl(fd, CDROM_SET_OPTIONS, CDO_USE_FFLAGS);
/* Stuff in here before that I've turned off. OWT - 7 Feb. 2001
*/
/* Auto-close and auto-eject should work fine with magicdev, so leave them
* at their defaults
*/
#if 0
ioctl(fd, CDROM_CLEAR_OPTIONS, CDO_AUTO_CLOSE|CDO_AUTO_EJECT);
#endif
/* CDO_CHECK_TYPE breaks some crufy programs - it's cleared by default as
* a backwards-compat thing. It doesn't really help us to set it.
*/
#if 0
ioctl(fd, CDROM_SET_OPTIONS, CDO_CHECK_TYPE);
#endif
/* We used to try and unlock the door here, but it could be considered
* bad form. The problem is that if programs don't notice the disk change,
* they can get very much confused. We could alternatively look for the media,
* unmount, then remount, but (as long as the user is running gmc) having
* having to right click on the icon and select eject isn't too bad.
*/
#if 0
ioctl(fd, CDROM_CLEAR_OPTIONS, CDO_LOCK);
#ifdef CDROM_LOCKDOOR
ioctl(fd, CDROM_LOCKDOOR, 0);
#else
#warning "Need Linux kernel >= 2.2.4 to work with IDE."
#endif
#endif /* 0 */
}
|
I can always eject a CD in beta3, even if the volume is mounted. I have two boxes with two identical CD-ROM drives: Host: scsi0 Channel: 00 Id: 04 Lun: 00 Vendor: YAMAHA Model: CRW8424S Rev: 1.0d Type: CD-ROM ANSI SCSI revision: 02 and Host: scsi0 Channel: 00 Id: 03 Lun: 00 Vendor: YAMAHA Model: CRW8424S Rev: 1.0d Type: CD-ROM ANSI SCSI revision: 02 The first box runs RH 6.2, kernel 2.2.16-3, onboard SCSI controller: Bus 0, device 6, function 0: SCSI storage controller: Adaptec AIC-7890/1 (rev 0). Medium devsel. Fast back-to-back capable. BIST capable. IRQ 9. Master Capable. Latency=32. Min Gnt=39.Max Lat=25. I/O at 0xd000 [0xd001]. Non-prefetchable 64 bit memory at 0xe0800000 [0xe0800004]. The second box has beta3 installed, uses a PCI controller: Bus 0, device 15, function 0: SCSI storage controller: Adaptec AHA-2940U2 (rev 0). Medium devsel. Fast back-to-back capable. BIST capable. IRQ 10. Master Capable. Latency=32. Min Gnt=39.Max Lat=25. I/O at 0xa800 [0xa801]. Non-prefetchable 64 bit memory at 0xec000000 [0xec000004]. This is basically the PCI version of the same AIC78xx controller. The RH 6.2 box uses autofs, and I can NEVER eject a CD while its mounted. The beta3 box ALWAYS lets me eject a CD, no matter what.