Re: Linux 2.2.0-pre6 bug -- error mounting CDROM

Jens Axboe (axboe@image.dk)
Wed, 13 Jan 1999 01:41:38 +0100


"Todd A. Wood" wrote:
> I have seen the same thing since the pre5 patch to cdrom.c (pre6 patched
> looked to be a spelling patch)
>
> >diff -u --recursive --new-file v2.2.0-pre4/linux/drivers/cdrom/cdrom.c linux/drivers/cdrom/cdrom.c
> >--- v2.2.0-pre4/linux/drivers/cdrom/cdrom.c Mon Dec 28 15:00:52 1998
> >+++ linux/drivers/cdrom/cdrom.c Mon Jan 4 11:58:44 1999
> >@@ -376,8 +376,10 @@
> > }
> > cdinfo(CD_OPEN, "the tray is now closed.\n");
> > }
> >- if (ret!=CDS_DISC_OK)
> >+ if (ret!=CDS_DISC_OK) {
> >+ ret = -ENOMEDIUM;
> > goto clean_up_and_return;
> >+ }
> > }
> > cdrom_count_tracks(cdi, &tracks);
> > if (tracks.error == CDS_NO_DISC) {
> >
>
> I can recreate the problem with running an AfterStep app to play cd's
> "ascd". The problem only manifested itself when I booted w/o any CDROM
> in the drive. Before that time, ascd had found an audio cd in the
> drive.

Ah, now I see. It's basically a ascd "bug". Try this little patch
against ascd-0.7. Probably also works with earlier versions,
plat_linux.c doesn't look like it's been touched in years.

--- plat_linux.c~ Wed Jan 13 01:32:41 1999
+++ plat_linux.c Wed Jan 13 01:36:43 1999
@@ -338,7 +338,7 @@
if (fcntl(fd, F_SETLK, &fl) < 0)
exit(0);

- if (open(cd_device, 0) >= 0)
+ if (open(cd_device, O_RDONLY | O_NONBLOCK) >= 0)
{
brk(&end);
pause();
@@ -435,7 +435,7 @@
if (d->fd >= 0) /* Device already open? */
return (0);

- d->fd = open(cd_device, 0);
+ d->fd = open(cd_device, O_RDONLY | O_NONBLOCK);
if (d->fd < 0)
{
if (errno == EACCES)
> The drive is otherwise functional.. Insert CD it plays.. insert data cd,
> it mounts.

And now we should probably move this discussion out of linux-kernel,
since it isn't that on-topic anymore.

-- 
*  Jens Axboe <axboe@image.dk>
*  Linux CD-ROM Maintainer
* "The only thing that interferes with my
*  learning is my education." -- A. Einstein

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/