Re: 'bad: scheduling while atomic!', preempt kernel, 2.6.1-test11,reading an apparently duff DVD-R

From: Linus Torvalds
Date: Mon Dec 15 2003 - 13:48:12 EST




On Mon, 15 Dec 2003, Toad wrote:
>
> ide-scsi: reset called for 133

Ok, I can't trigger an IDE reset even with a bad CDROM, so I'm kind of out
of luck on testing this. Can you try out the following silly patch, and
report what it says?

The old ide-scsi reset function is just terminally broken, there's no way
it can work. This patch _might_ make it work, but is more likely to just
print out what it's trying to do.

Linus

----
--- 1.34/drivers/scsi/ide-scsi.c Tue Dec 2 19:03:55 2003
+++ edited/drivers/scsi/ide-scsi.c Mon Dec 15 10:17:52 2003
@@ -882,35 +882,26 @@
return FAILED;
}

-static int idescsi_reset (Scsi_Cmnd *cmd)
+static int idescsi_device_reset(Scsi_Cmnd *cmd)
+{
+ printk("IDE device reset requested\n");
+ return FAILED;
+}
+
+static int idescsi_bus_reset(Scsi_Cmnd *cmd)
{
- unsigned long flags;
- struct request *req;
idescsi_scsi_t *idescsi = scsihost_to_idescsi(cmd->device->host);
ide_drive_t *drive = idescsi->drive;

- printk (KERN_ERR "ide-scsi: reset called for %lu\n", cmd->serial_number);
- /* first null the handler for the drive and let any process
- * doing IO (on another CPU) run to (partial) completion
- * the lock prevents processing new requests */
- spin_lock_irqsave(&ide_lock, flags);
- while (HWGROUP(drive)->handler) {
- HWGROUP(drive)->handler = NULL;
- schedule_timeout(1);
- }
- /* now nuke the drive queue */
- while ((req = elv_next_request(drive->queue))) {
- blkdev_dequeue_request(req);
- end_that_request_last(req);
- }
- /* FIXME - this will probably leak memory */
- HWGROUP(drive)->rq = NULL;
- if (drive_to_idescsi(drive))
- drive_to_idescsi(drive)->pc = NULL;
- spin_unlock_irqrestore(&ide_lock, flags);
- /* finally, reset the drive (and its partner on the bus...) */
- ide_do_reset (drive);
+ printk("IDE bus reset requested\n");
+ ide_do_reset(drive);
return SUCCESS;
+}
+
+static int idescsi_host_reset(Scsi_Cmnd *cmd)
+{
+ printk("IDE host reset requested\n");
+ return FAILED;
}

static int idescsi_bios(struct scsi_device *sdev, struct block_device *bdev,
@@ -935,7 +926,9 @@
.ioctl = idescsi_ioctl,
.queuecommand = idescsi_queue,
.eh_abort_handler = idescsi_abort,
- .eh_device_reset_handler = idescsi_reset,
+ .eh_device_reset_handler = idescsi_device_reset,
+ .eh_bus_reset_handler = idescsi_bus_reset,
+ .eh_host_reset_handler = idescsi_host_reset,
.bios_param = idescsi_bios,
.can_queue = 40,
.this_id = -1,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/