Small IDE patch for 2.1.110 [was Re: ide-scsi hang]

Gadi Oxman (gadio@netvision.net.il)
Sun, 26 Jul 1998 20:39:20 +0400 (IDT)


Hi,

> Using xcdroast with ATAPI cdrom and ide-scsi drivers I hit
> system hangs a few times. Either when copying the disk or when
> verifying the copy. The only way to recover from these hangs is to
> hit the "reset" button.
> Xcdroast is just doing a sequencial read from the disk. Hangs
> are not persistent but they happen more often with certain
> disks than with others.
>
> This happened on Linux-2.1.110 compiled for SMP but running on
> single processor. I experienced similar hangs with other recent
> 2.1.xx kernels which were fixed by recompiling the kernel without
> SMP support.
>
> Ingo, I remember that you had a tool to assist in tracking
> such hangs. Where can I find it and how can I use it?
>
> Itai
> --
> Itai Nahshon nahshon@actcom.co.il
> Also nahshon@vnet.ibm.com

Sorry, we fixed this a while ago, but I forgot to submit the patch.
The following patch should fix the ide-scsi lockup with SMP, and in
addition will support the CDROMEJECT ioctl in ide-floppy, and fix a
missing set_blocksize() in ide.c (required for re-reading the partition
table after mounting a media with a blocksize of 512 bytes).

Gadi

--- linux/drivers/scsi/ide-scsi.c~ Sun Jul 26 20:28:32 1998
+++ linux/drivers/scsi/ide-scsi.c Sun Jul 26 20:28:32 1998
@@ -772,7 +772,7 @@
rq->cmd = IDESCSI_PC_RQ;
spin_unlock(&io_request_lock);
(void) ide_do_drive_cmd (drive, rq, ide_end);
- spin_lock(&io_request_lock);
+ spin_lock_irq(&io_request_lock);
return 0;
abort:
if (pc) kfree (pc);

--- linux/drivers/block/ide-floppy.c~ Wed Jul 8 00:11:15 1998
+++ linux/drivers/block/ide-floppy.c Wed Jul 8 00:11:15 1998
@@ -43,6 +43,7 @@
#include <linux/errno.h>
#include <linux/genhd.h>
#include <linux/malloc.h>
+#include <linux/cdrom.h>

#include <asm/byteorder.h>
#include <asm/irq.h>
@@ -1141,7 +1142,18 @@
static int idefloppy_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
- return -EIO;
+ idefloppy_pc_t pc;
+
+ if (cmd == CDROMEJECT) {
+ if (drive->usage > 1)
+ return -EBUSY;
+ idefloppy_create_prevent_cmd (&pc, 0);
+ (void) idefloppy_queue_pc_tail (drive, &pc);
+ idefloppy_create_start_stop_cmd (&pc, 2);
+ (void) idefloppy_queue_pc_tail (drive, &pc);
+ return 0;
+ }
+ return -EIO;
}

/*

--- linux/drivers/block/ide.c~ Sun Jul 12 22:15:49 1998
+++ linux/drivers/block/ide.c Sun Jul 12 22:15:49 1998
@@ -1525,6 +1525,7 @@
if (sb)
invalidate_inodes(sb);
invalidate_buffers (devp);
+ set_blocksize(devp, 1024);
}
drive->part[p].start_sect = 0;
drive->part[p].nr_sects = 0;
--- linux/mm/swapfile.c~ Sun Jul 26 20:31:43 1998
+++ linux/mm/swapfile.c Sun Jul 26 20:31:43 1998
@@ -532,6 +532,7 @@
error = blkdev_open(swap_dentry->d_inode, &filp);
if (error)
goto bad_swap_2;
+ set_blocksize(p->swap_device, PAGE_SIZE);
error = -ENODEV;
if (!p->swap_device ||
(blk_size[MAJOR(p->swap_device)] &&

-
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.altern.org/andrebalsa/doc/lkml-faq.html