Bug 5485
Summary: | cdrom door locked when pktcdvd is attached | ||
---|---|---|---|
Product: | Drivers | Reporter: | Ulrich Holeschak (ulrich) |
Component: | Other | Assignee: | Jens Axboe (axboe) |
Status: | CLOSED CODE_FIX | ||
Severity: | low | CC: | akpm, alan, axboe, bunk, protasnb, satyam |
Priority: | P2 | ||
Hardware: | i386 | ||
OS: | Linux | ||
Kernel Version: | 2.6.13.3 | Subsystem: | |
Regression: | --- | Bisected commit-id: |
Description
Ulrich Holeschak
2005-10-23 06:15:20 UTC
Reply-To: petero2@telia.com On Sun, 23 Oct 2005, Andrew Morton wrote: > When pktcdvd driver is attached to a cdrom device, mounting the cdrom > directly (without the packet driver) leads to a locked cdrom door after > unmount. Reason: cdrom.c:cdrom_release() only unlocks the door if the > use_count is zero. The pktcdvd driver always keeps one O_NONBLOCK > connection open, so use_count will never get zero. > I have attached a patch, that counts open device connections that don't > have the O_NONBLOCK flag set (data connections). If the data connection > counter is zero, the door is unlocked. Does this really work? I tried something similar myself several months ago, but it didn't work because the fp parameter to cdrom_release() was always NULL. This still appears to be the case. blkdev_put() calls the release function like this: ret = disk->fops->release(bd_inode, NULL); On Sun, Oct 23 2005, Peter Osterlund wrote:
> On Sun, 23 Oct 2005, Andrew Morton wrote:
>
> > When pktcdvd driver is attached to a cdrom device, mounting the cdrom
> > directly (without the packet driver) leads to a locked cdrom door after
> > unmount. Reason: cdrom.c:cdrom_release() only unlocks the door if the
> > use_count is zero. The pktcdvd driver always keeps one O_NONBLOCK
> > connection open, so use_count will never get zero.
>
> > I have attached a patch, that counts open device connections that don't
> > have the O_NONBLOCK flag set (data connections). If the data connection
> > counter is zero, the door is unlocked.
>
> Does this really work? I tried something similar myself several months
> ago, but it didn't work because the fp parameter to cdrom_release() was
> always NULL. This still appears to be the case. blkdev_put() calls the
> release function like this:
>
> ret = disk->fops->release(bd_inode, NULL);
The patch is also broken, what if the app(s) use fcntl() to set/clear
O_NONBLOCK after open? Nogo.
so what do we do? I my case this is working perfecly, but perhaps it depends on how the application (umount) closes the device ... Jens? Any thought on a suitable fix for this one? Hi Ulrich, To refresh the data, can you please try newest kernel to confirm that the problem still exists? Thanks. At least this bug is still present in the 2.4.21 kernel. At the moment i am using a mount.udf script to circumvent this problem. This script dynamically calls pktsetup if an udf filesystem is mounted/unmounted. Ulrich (In reply to comment #7) > At least this bug is still present in the 2.4.21 kernel. > At the moment i am using a mount.udf script to circumvent this problem. > This script dynamically calls pktsetup if an udf filesystem is > mounted/unmounted. > > Ulrich > Sorry i mean kernel 2.6.21 ... Hi Ulrich Can you reproduce on 2.6.23-rc1? I tried reproducing this, but failed, and saw some weird behaviour, see below: (In reply to comment #0) > Distribution: SUSE 9.3, Standard kernel 2.6.13.3 > > Problem Description: > When pktcdvd driver is attached to a cdrom device, mounting the cdrom > directly > (without the packet driver) leads to a locked cdrom door after unmount. > Reason: cdrom.c:cdrom_release() only unlocks the door if the use_count is > zero. > The pktcdvd driver always keeps one O_NONBLOCK connection open, so use_count > will never get zero. Right. > Steps to reproduce: > pktsetup 0 /dev/hdxx > mount /dev/hdxx /mnt > umount /mnt > -> cdrom door locked I reproduced the "situation", but not the the "problem". I did the above, and although the use_count didn't become zero (was 1) after the umount(2), *and* the last call to cdrom_ops->lock_door() was to *lock* it (I have an "ide_cd" based driver, and this was from mount(2) codepath), I could still use "eject" (or manually eject) the tray after the umount itself. Which is weird, because it would appear that the "door_is_locked" state and eject/open_tray commands are being maintained / given by independent modules in the kernel ... so although I didn't reproduce the problem, I think this could be a case of another bug hiding/"solving" the previous. Hello, i tried with kernel 2.6.22.1, you are right, something has changed in the behaviour ... After umount /proc/sys/dev/cdrom/lock still shows that the device is locked, but i could eject the cdrom using the button on the front panel. Also after the eject /proc/sys/dev/cdrom/lock still shows that the lock it set. It seems that the 'lock' is not locking any more ... Any update on the problem? Does it still behave the same with recent kernel, 2.6.25+? Thanks. |