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

Pekka J Enberg
2007-04-02T07:37:28Z

On Mon, 2 Apr 2007, Jens Axboe wrote:
> Updated patch attached :-)
>
> diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
> index 0bc8b0b..cff761a 100644
> --- a/Documentation/feature-removal-schedule.txt
> +++ b/Documentation/feature-removal-schedule.txt
> @@ -324,3 +324,10 @@ Why: the i8xx_tco watchdog driver has been replaced by the iTCO_wdt
> Who: Wim Van Sebroeck <wim@iguana.be>
>
> ---------------------------
> +
> +What: The legacy CDROM drivers (drivers/cdrom/, except cdrom.c)
> +When: In 2.6.23
> +Why: They are all terminally broken (most don't even compile)
> +Who: Jens Axboe <jens.axboe@oracle.com>
> +
> +---------------------------

I am certainly ok with that. But until then, update patch below =)

Pekka

diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c
index f574962..a1e4297 100644
--- a/drivers/cdrom/mcdx.c
+++ b/drivers/cdrom/mcdx.c
@@ -577,56 +577,57 @@ static void do_mcdx_request(request_queu
if (!req)
return;

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

if (!stuffp->present) {
xwarn("do_request(): bad device: %s\n",req->rq_disk->disk_name);
xtrace(REQUEST, "end_request(0): bad device\n");
end_request(req, 0);
- return;
+ goto again;
}

if (stuffp->audio) {
xwarn("do_request() attempt to read from audio cd\n");
xtrace(REQUEST, "end_request(0): read from audio\n");
end_request(req, 0);
- return;
+ goto again;
}

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);
- return;
- }
- else {
- stuffp->status = 0;
- while (req->nr_sectors) {
- int i;
-
- i = mcdx_transfer(stuffp,
- req->buffer,
- req->sector,
- req->nr_sectors);
-
- if (i == -1) {
- end_request(req, 0);
- goto again;
- }
- req->sector += i;
- req->nr_sectors -= i;
- req->buffer += (i * 512);
- }
- end_request(req, 1);
goto again;
-
- xtrace(REQUEST, "end_request(1)\n");
- end_request(req, 1);
}

+ stuffp->status = 0;
+ while (req->nr_sectors) {
+ int i;
+
+ spin_unlock_irq(q->queue_lock);
+ i = mcdx_transfer(stuffp,
+ req->buffer,
+ req->sector,
+ req->nr_sectors);
+ spin_lock_irq(q->queue_lock);
+
+ if (i == -1) {
+ end_request(req, 0);
+ goto again;
+ }
+ req->sector += i;
+ req->nr_sectors -= i;
+ req->buffer += (i * 512);
+ }
+ end_request(req, 1);
goto again;
}