Re: mcdx -- do_request(): non-read command to cd!!

Jens Axboe
2007-03-31T06:52:24Z

On Fri, Mar 30 2007, Rene Herman wrote:
> Hi Al.
>
> GIT doesn't remember, it's been too long, but IIRC you were the last one
> to do some work on mcdx (the old proprietary mitsumi cd-rom driver). The
> thing builds without warnings on 2.6.20.4, unlike most other proprietary
> CD-ROM drivers, so someone did...
>
> In any case, I just bet you're positively thrilled receiving bug-reports
> for the thing right? Mmm?
>
> I dug up a 1-speed Mitsumi CRMC-LU005S today. Brilliant drive! You push
> on the front, after which it comes loose and you then yank the entire
> drive, mechanism and all, out of its casing over some kind of magnetic
> resistance it seems and then open a _second_ top-loading door, put in
> the CD and follow the procedure backwards again. I've done that at least
> 20 times now and I'm not by any means done yet. Brilliant.
>
> The drive works fine under DOS (*), with both IRQ-less and IRQ-enabled
> controllers. The linux driver does not work though:
>
> root@5va2:~# modprobe mcdx
>
> root@5va2:~# dmesg | tail -4
> mcdx Version 2.14(hs)
> mcdx $Id: mcdx.c,v 1.21 1997/01/26 07:12:59 davem Exp $
> Uniform CD-ROM driver Revision: 3.20
> mcdx: Mitsumi CD-ROM installed at 0x300, irq 15. (Firmware version M 4)
>
> root@5va2:~# mount /dev/mcdx0 /mnt/cdrom
> mount: block device /dev/mcdx0 is write-protected, mounting read-only
> mount: /dev/mcdx0: can't read superblock
>
> root@5va2:~# dmesg | tail -4
> mcdx: Mitsumi CD-ROM installed at 0x300, irq 15. (Firmware version M 4)
> mcdx do_request(): non-read command to cd!!
> end_request: I/O error, dev mcdx0, sector 0
> FAT: unable to read boot sector
> root@5va2:~#
>
> This same 300/15 pair works under DOS in the same machine and IRQ15 is
> firing. The error sounds very block-ish. Would you happen to know?
>
> I'll happily test patches :-)

Try this.

diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c
index f574962..7086313 100644
--- a/drivers/cdrom/mcdx.c
+++ b/drivers/cdrom/mcdx.c
@@ -577,6 +577,11 @@ static void do_mcdx_request(request_queue_t * q)
if (!req)
return;

+ if (!blk_fs_request(req)) {
+ end_request(req, 0);
+ goto again;
+ }
+
stuffp = req->rq_disk->private_data;

if (!stuffp->present) {
@@ -596,7 +601,7 @@ static void do_mcdx_request(request_queue_t * q)
xtrace(REQUEST, "do_request() (%lu + %lu)\n",
req->sector, req->nr_sectors);

- if (req->cmd != READ) {
+ if (rq_data_dir(req) != READ) {
xwarn("do_request(): non-read command to cd!!\n");
xtrace(REQUEST, "end_request(0): write\n");
end_request(req, 0);

--
Jens Axboe