Can't eject a previously mounted CD?
Subsystems (2)
Quoted 9 lines
Does everyone who has this problem by chance have it occuring on an atapi cd recorder. As of 2.6.0-mm1 my cd recorder is being labeled read only by the ide-cd driver. Meaning, no matter if i set the readonly flag in hdparm to 0, cdrecord and others will refuse to write to the drive because it's being told it's read only. I do not have fam loaded at the time of this testing. Are there new ide-cd arguments required to use atapi cd writers in native mode?
I have it happening on both my optical drives. One is a lite-on ATAPI cd-rw, the other an ATAPI Pioneer dvd-rw/cd-rw. No fam/gnome running. I do use automount with these drives, but I can see that the mounts have been expired, yet I can't eject them using the button. Tested last night using both ide-cd and ide-scsi. Same result with either access. When they're locked, fuser shows nothing attached, as does lsof. I can eject them with the eject command.
-Walt
I'd have to say the december 17th listed changes are the culprit here. I'm definitely not up to figuring out what change is the bad one. If any of the cdrom/ide-cd people wanna have me get some data from them then just tell me how. I've tried viewing the debug output from the modules with no success in figuring out the problem.
Quoted 13 lines · Walt H
Quoted 3 lines
Does everyone who has this problem by chance have it occuring on an atapi cd recorder. As of 2.6.0-mm1 my cd recorder is being labeled read only by the ide-cd driver. Meaning, no matter if i set the readonly flag in hdparm to 0, cdrecord and others will refuse to write to the drive because it's being told it's read only. I do not have fam loaded at the time of this testing. Are there new ide-cd arguments required to use atapi cd writers in native mode?
I have it happening on both my optical drives. One is a lite-on ATAPI cd-rw, the other an ATAPI Pioneer dvd-rw/cd-rw. No fam/gnome running. I do use automount with these drives, but I can see that the mounts have been expired, yet I can't eject them using the button. Tested last night using both ide-cd and ide-scsi. Same result with either access. When they're locked, fuser shows nothing attached, as does lsof. I can eject them with the eject command.
-Walt
Quoted 7 lines · Ed Sweetman
I'd have to say the december 17th listed changes are the culprit here. I'm definitely not up to figuring out what change is the bad one. If any of the cdrom/ide-cd people wanna have me get some data from them then just tell me how. I've tried viewing the debug output from the modules with no success in figuring out the problem.
Luckily for me, I built my cdrom drivers as modules, so I could play :) I turned on debugging, and noticed that cdi->use_count continues to increment by 2 for each access. In cdrom_release, only one cdi->use_count-- exists, so the driver never gets to 0 use count and releases. I noticed in drivers/cdrom/cdrom.c line 753:
if (!ret) cdi->use_count++;
Which is our second increment, but I can't find two decrements, because the check further down won't ever be true if the above is true. Hence, two increments and only 1 dec when we reach cdrom_release. What I did, was add a conditional decrement right before the open_for_data call, which makes the value of use_count like it used to be prior to the Mt. Rainier patches. Seems kinda hacky :)
-Walt
drivers/cdrom/cdrom.c 2003-12-28 19:42:04.174098225 -0800 renamed from usr/src/linux/drivers/cdrom/cdrom.c 2003-12-25 09:53:59.000000000 -0800 +4 -1
@@ -744,4 +744,7 @@ } + if (cdi->use_count > 0) + cdi->use_count--; + /* if this was a O_NONBLOCK open and we should honor the flags, * do a quick open without drive/disc integrity checks. */
@@ -931,5 +934,5 @@ struct cdrom_device_ops *cdo = cdi->ops; - cdinfo(CD_CLOSE, "entering cdrom_release\n"); + cdinfo(CD_CLOSE, "entering cdrom_release\n"); if (cdi->use_count > 0)
Quoted 11 lines · Walt H
Quoted 7 lines · Ed Sweetman
I'd have to say the december 17th listed changes are the culprit here. I'm definitely not up to figuring out what change is the bad one. If any of the cdrom/ide-cd people wanna have me get some data from them then just tell me how. I've tried viewing the debug output from the modules with no success in figuring out the problem.
Quoted 1 line
Luckily for me, I built my cdrom drivers as modules, so I could play :)
so did i. I looked at the debugging output and noticed the increments increasing. This had no effect on me unloading the module so i didn't care. It also should have nothing to do with not being able to eject it since being unable to eject would imply that the door is locked, in which case the command "eject" should also fail but it does not. I think the kernel is really really fubarred since the dec 17th patches dealing with ide-cd. My cd writer is no longer able to write in atapi direct mode because the driver isn't giving it the capabalities it should have. It's being shown as a simple cdrom as far as the kernel is concerned. Also, the drive throws errors about being unable to access sector 0, as many others have pointed out. This is an error that should be caught prior to actually sending such a command since media is not in the drive in the first place.
It's definitely not up to me but i would roll back the cdrom and ide-cd changes from dec 17th and re-add them much more carefully because something is really messed up.
cdrecord is showing the TOC as just CdRom and reports the drive as readonly. That's about all the irregular information i can find on my own. I dont know where to look for anything else, the cdrom debugging output doesn't report anything irregular except for the behavior described below and that really doesn't help me with anything except to prove that the patches that went in last are the cause of the problem, not necessarily famd's hackish behavior or hardware.
Quoted 34 lines
I turned on debugging, and noticed that
cdi->use_countcontinues to increment by 2 for each access. Incdrom_release, only one cdi->use_count-- exists, so the driver never gets to 0 use count and releases. I noticed indrivers/cdrom/cdrom.cline 753:if (!ret) cdi->use_count++;Which is our second increment, but I can't find two decrements, because the check further down won't ever be true if the above is true. Hence, two increments and only 1 dec when we reach
cdrom_release. What I did, was add a conditional decrement right before theopen_for_datacall, which makes the value ofuse_countlike it used to be prior to the Mt. Rainier patches. Seems kinda hacky :)(quoted diff) +0
-1-Waltdrivers/cdrom/cdrom.c 2003-12-28 19:42:04.174098225 -0800 renamed from usr/src/linux/drivers/cdrom/cdrom.c 2003-12-25 09:53:59.000000000 -0800 +4
-1@@ -744,4 +744,7 @@ } + if (cdi->use_count > 0) + cdi->use_count--; + /* if this was a O_NONBLOCK open and we should honor the flags, * do a quick open without drive/disc integrity checks. */@@ -931,5 +934,5 @@ struct cdrom_device_ops *cdo = cdi->ops; - cdinfo(CD_CLOSE, "entering cdrom_release\n"); + cdinfo(CD_CLOSE, "entering cdrom_release\n"); if (cdi->use_count > 0)
Just to add to my previous post about the problem with the ide-cd driver. It appears that loading and unloading it and loading it again a couple times causes the driver to mess up it's interrupts. Now i get a recurring "lost interrupt to hdc" message and the device is non-responsive, causing any attempt to rmmod or modprobe ide-cd to hang, and the /dev entry is missing according to hdparm.
Quoted 36 lines · Ed Sweetman
Quoted 11 lines · Walt H
Quoted 7 lines · Ed Sweetman
I'd have to say the december 17th listed changes are the culprit here. I'm definitely not up to figuring out what change is the bad one. If any of the cdrom/ide-cd people wanna have me get some data from them then just tell me how. I've tried viewing the debug output from the modules with no success in figuring out the problem.
Quoted 1 line
Luckily for me, I built my cdrom drivers as modules, so I could play :)
so did i. I looked at the debugging output and noticed the increments increasing. This had no effect on me unloading the module so i didn't care. It also should have nothing to do with not being able to eject it since being unable to eject would imply that the door is locked, in which case the command "eject" should also fail but it does not. I think the kernel is really really fubarred since the dec 17th patches dealing with ide-cd. My cd writer is no longer able to write in atapi direct mode because the driver isn't giving it the capabalities it should have. It's being shown as a simple cdrom as far as the kernel is concerned. Also, the drive throws errors about being unable to access sector 0, as many others have pointed out. This is an error that should be caught prior to actually sending such a command since media is not in the drive in the first place.
It's definitely not up to me but i would roll back the cdrom and ide-cd changes from dec 17th and re-add them much more carefully because something is really messed up.
cdrecord is showing the TOC as just CdRom and reports the drive as readonly. That's about all the irregular information i can find on my own. I dont know where to look for anything else, the cdrom debugging output doesn't report anything irregular except for the behavior described below and that really doesn't help me with anything except to prove that the patches that went in last are the cause of the problem, not necessarily famd's hackish behavior or hardware.
Quoted 14 lines
I turned on debugging, and noticed that
cdi->use_countcontinues to increment by 2 for each access. Incdrom_release, only one cdi->use_count-- exists, so the driver never gets to 0 use count and releases. I noticed indrivers/cdrom/cdrom.cline 753:if (!ret) cdi->use_count++;Which is our second increment, but I can't find two decrements, because the check further down won't ever be true if the above is true. Hence, two increments and only 1 dec when we reach
cdrom_release. What I did, was add a conditional decrement right before theopen_for_datacall, which makes the value ofuse_countlike it used to be prior to the Mt. Rainier patches. Seems kinda hacky :)
In your patch here i think the person who made the code originally confused or got wrong the conditions of success for opening the cdrom drive. This is in the same function as the patch applies to.
if ((fp->f_flags & O_NONBLOCK) && (cdi->options &
CDO_USE_FFLAGS))
ret = cdi->ops->open(cdi, 1);
else
ret = open_for_data(cdi);
if (!ret) cdi->use_count++;Here we see that if the open fails we incriment our use_count. But this doesn't make sense. We increment the use_count at the beginning of the function as a "lock" so that we can't do anything while the open function is executing like rmmod the cdrom (supposedly?). Now removing the if(!ret) line makes sense. Under the out: label, if the open fails, then we close our makeshift lock on the device because our function is done. If it succeeded, then the use_count stays at 1 we go along our merry way.
Quoted 28 lines
(quoted diff) +0
-1-Waltdrivers/cdrom/cdrom.c 2003-12-28 19:42:04.174098225 -0800 renamed from usr/src/linux/drivers/cdrom/cdrom.c 2003-12-25 09:53:59.000000000 -0800 +4
-2@@ -744,4 +744,7 @@ } + if (cdi->use_count > 0) + cdi->use_count--; + /* if this was a O_NONBLOCK open and we should honor the flags, * do a quick open without drive/disc integrity checks. */@@ -931,5 +934,5 @@ struct cdrom_device_ops *cdo = cdi->ops; - cdinfo(CD_CLOSE, "entering cdrom_release\n"); + cdinfo(CD_CLOSE, "entering cdrom_release\n"); if (cdi->use_count > 0) -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 11 lines · Ed Sweetman
In your patch here i think the person who made the code originally confused or got wrong the conditions of success for opening the cdrom drive. This is in the same function as the patch applies to.
if ((fp->f_flags & O_NONBLOCK) && (cdi->options & CDO_USE_FFLAGS)) ret = cdi->ops->open(cdi, 1); else ret = open_for_data(cdi); if (!ret) cdi->use_count++;
Doesn't this increment it if the call succeeds? In open_for_data, ret is the return code from the open call, which should be zero upon success. Problem is, we already incremented it when we entered cdrom_open.
Quoted 10 lines
Here we see that if the open fails we incriment our
use_count. But this doesn't make sense. We increment theuse_countat the beginning of the function as a "lock" so that we can't do anything while the open function is executing like rmmod the cdrom (supposedly?). Now removing the if(!ret) line makes sense. Under the out: label, if the open fails, then we close our makeshift lock on the device because our function is done. If it succeeded, then theuse_countstays at 1 we go along our merry way.
Yeah, my patch is just a hack :) Not really for general use i think, but it allows me to open the door using the button. The cdrom.c from test11-mm1 never incremented use_count until after the success of one of the preceeding calls. I was just undoing the original increment that now happens upon entering cdrom_open. The use_count does control the door lock though. If you look under cdrom_release, the door unlock code never gets executed until use_count=0. I haven't checked overall operation of my cdrom drives enough to know what else is wrong.
-Walt
check out test11-mm1's cdrom.c. I think it'll make things clear. I just replaced the cdrom.c and ide-cd.h and ide-cd.c files in 2.6.0-mm1 with 2.6.0-test11-mm1's and things are working perfect.
Quoted 7 lines · Ed Sweetman
check out test11-mm1's
cdrom.c. I think it'll make things clear. I just replaced thecdrom.candide-cd.handide-cd.cfiles in 2.6.0-mm1 with 2.6.0-test11-mm1's and things are working perfect.
I was just about to that stage as well :) Just noticed that -mm2 is out, and it has specific fixes unlocking tray as well.
-Walt
Quoted 6 lines · Ed Sweetman
check out test11-mm1's
cdrom.c. I think it'll make things clear. I just replaced thecdrom.candide-cd.handide-cd.cfiles in 2.6.0-mm1 with 2.6.0-test11-mm1's and things are working perfect.
Ed,
I can confirm that 2.6.0-mm2 fixes the tray lock issue. On my setup, the drive's capabilities are reported correctly as well. Haven't done serious testing yet, but I could at least blank a cd-rw :) yay!
-Walt
Quoted 8 lines · Walt H
Quoted 6 lines · Ed Sweetman
check out test11-mm1's
cdrom.c. I think it'll make things clear. I just replaced thecdrom.candide-cd.handide-cd.cfiles in 2.6.0-mm1 with 2.6.0-test11-mm1's and things are working perfect.
Quoted 5 lines
Ed,
I can confirm that 2.6.0-mm2 fixes the tray lock issue. On my setup, the drive's capabilities are reported correctly as well. Haven't done serious testing yet, but I could at least blank a cd-rw :) yay!
It was a merge error in -mm1 that caused the problem.
Signature · 1 line
Jens Axboe