lkml.org 
[lkml]   [2003]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] blk API update (and bug fix) to CDU535 cdrom driver
	Hi Jens,

Jens Axboe wrote:
> held! Ugh, and the request function do_cdu535_request calls
> schedule_timeout with the queue lock held (that is held when that
> function is entered), that is very buggy as well. Should also use
> set_current_state() right above that call, not open code it (that also
> misses a memory barrier). Same function also has problems with request
> handling. You should kill:
>
> if (!(req->flags & REQ_CMD))
> continue; /* FIXME */
>
> that is very broken, make that:
>
> if (!blk_fs_request(req)) {
> end_request(req, 0);
> continue;
> }
>
> and kill these two lines:
>
> if (rq_data_dir(req) != READ)
> panic("Unknown SONY CD cmd");
>
> they are screwy too.
>
> Care to fix the things I outlined above?

This patch I think fixes all these, doesn't it?

It applies on top of my latest cli-sti-removal patch that I sent you.

The only place I'm not sure is on releasing the queue lock before
calling schedule_timeout.

Please apply if it looks good to you.

Thanks for all your help!

Felipe
--- linux-2.6.0-test5/drivers/cdrom/sonycd535.c Tue Sep 9 14:42:52 2003
+++ linux-2.6.0-test5-fwd/drivers/cdrom/sonycd535.c Tue Sep 9 14:41:30 2003
@@ -812,14 +812,14 @@

block = req->sector;
nsect = req->nr_sectors;
- if (!(req->flags & REQ_CMD))
- continue; /* FIXME */
+ if (!blk_fs_request(req)) {
+ end_request(req, 0);
+ continue;
+ }
if (rq_data_dir(req) == WRITE) {
end_request(req, 0);
continue;
}
- if (rq_data_dir(req) != READ)
- panic("Unknown SONY CD cmd");
/*
* If the block address is invalid or the request goes beyond
* the end of the media, return an error.
@@ -896,8 +896,10 @@
}
if (readStatus == BAD_STATUS) {
/* Sleep for a while, then retry */
- current->state = TASK_INTERRUPTIBLE;
+ set_current_state(TASK_INTERRUPTIBLE);
+ spin_unlock_irq(&sonycd535_lock);
schedule_timeout(RETRY_FOR_BAD_STATUS*HZ/10);
+ spin_lock_irq(&sonycd535_lock);
}
#if DEBUG > 0
printk(CDU535_MESSAGE_NAME
@@ -1481,7 +1483,7 @@
/* look for the CD-ROM, follows the procedure in the DOS driver */
inb(select_unit_reg);
/* wait for 40 18 Hz ticks (reverse-engineered from DOS driver) */
- current->state = TASK_INTERRUPTIBLE;
+ set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout((HZ+17)*40/18);
inb(result_reg);
\
 
 \ /
  Last update: 2005-03-22 13:48    [from the cache]
©2003-2011 Jasper Spaans