ide_do_drive_cmd() problems

Jens Axboe (axboe@image.dk)
Sun, 12 Sep 1999 17:10:35 +0200


Hi all,

I've been having problems with the above command in the
ATAPI driver - it can cause complete lockups, no magic
keys, just dead. I have been unable to find out what
is causing these problems, so I wrote a replacement
function. Why this fixes the problem I don't know?!
Hints appreciated!

/*
* Like ide_do_drive_cmd(), but with ide_wait as ide_action. Only
* disables interrupts locally.
*/
int ide_do_drive_cmd_wait (ide_drive_t *drive, struct request *rq)
{
unsigned long flags;
ide_hwgroup_t *hwgroup = HWGROUP(drive);
unsigned int major = HWIF(drive)->major;
struct request *cur_rq = drive->queue;
struct semaphore sem = MUTEX_LOCKED;

#ifdef CONFIG_BLK_DEV_PDC4030
if (HWIF(drive)->chipset == ide_pdc4030 && rq->buffer != NULL)
return -ENOSYS; /* special drive cmds not supported */
#endif

rq->errors = 0;
rq->rq_status = RQ_ACTIVE;
rq->rq_dev = MKDEV(major,(drive->select.b.unit)<<PARTN_BITS);
rq->sem = &sem;

spin_lock_irqsave(&io_request_lock, flags);
if (cur_rq == NULL) {
rq->next = cur_rq;
drive->queue = rq;
} else {
while (cur_rq->next != NULL) /* find end of list */
cur_rq = cur_rq->next;
rq->next = cur_rq->next;
cur_rq->next = rq;
}
spin_unlock_irqrestore(&io_request_lock, flags);
do_hwgroup_request(hwgroup);
__save_flags(flags);
__cli();
if (rq->rq_status != RQ_INACTIVE)
down(&sem);
__restore_flags(flags);
return rq->errors ? -EIO : 0;
}

-- 
*  Jens Axboe <axboe@image.dk>
*  Linux CD-ROM Maintainer
*  http://www.kernel.dk

- 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/