public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dougg@torque.net>
To: wrlk@riede.org
Cc: linux-scsi@vger.kernel.org
Subject: Re: ide-scsi error handling
Date: Tue, 20 May 2003 21:24:49 +1000	[thread overview]
Message-ID: <3ECA1081.805@torque.net> (raw)
In-Reply-To: <20030519234254.GG19202@linnie.riede.org>

[-- Attachment #1: Type: text/plain, Size: 1331 bytes --]

Willem Riede wrote:
> On 2003.05.19 09:01, Douglas Gilbert wrote:
> 
>>Debug: sleeping function called from illegal context at include/linux/rwsem.h:43
>>Call Trace:
>> [<c011f92c>] __might_sleep+0x5c/0x5e
>> [<c011b2d8>] do_page_fault+0x78/0x4a8
>> [<e0823c4b>] idescsi_transfer_pc+0xfb/0x130 [ide_scsi]
> 
> 
> A page fault while in idescsi_transfer_pc?!
> What memory would be accessed that is allowed to be paged out?
> 
> By the way, I have never seen that problem. When ide-scsi fails for me, it
> is in the same way Randy reports. While my change improves mean-time-to-hang
> significantly on my machine, it obviously doesn't for Randy. Back to the
> drawing board :-(

Willem,
When I tried today, my test went for a while then
failed with a timeout and an abort lockup (which
you reported as fixed but I don't have that fix):
   hdb: irq timeout: status=0xd0 { Busy }
   ide-scsi: abort called for 330982
   hdb: ATAPI reset complete
  <<machine lockup, alt-sysrq inactive>>

Attached is a patch to idescsi_queue(). Won't fix the
problems we are seeing now. Changes:
   - returns 0 on error (not 1 which means "busy")
   - yield DID_NO_CONNECT for channel, id or lun
     invalid (this should fix the "responding to
     multiple lun" problem often seen in lk 2.4
   - memset the whole of pc and rq to zero

Doug Gilbert



[-- Attachment #2: ide-scsi2569bk13wr_d1.diff --]
[-- Type: text/plain, Size: 1741 bytes --]

--- linux/drivers/scsi/ide-scsi.c	2003-05-19 12:30:34.000000000 +1000
+++ linux/drivers/scsi/ide-scsi.c2569bk13wr_d1	2003-05-20 20:30:46.000000000 +1000
@@ -795,11 +795,20 @@
 
 static int idescsi_queue (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
 {
+	struct scsi_device * sdev = cmd->device;
 	idescsi_scsi_t *scsi = scsihost_to_idescsi(cmd->device->host);
 	ide_drive_t *drive = scsi->drive;
 	struct request *rq = NULL;
 	idescsi_pc_t *pc = NULL;
 
+	if ((sdev->channel > 0) ||
+	    (sdev->id >= sdev->host->max_id) ||
+	    (sdev->lun >= sdev->host->max_lun)) {
+		printk(KERN_INFO "ide-scsi: channel:id:lun %d:%d:%d not "
+		       "present\n", sdev->channel, sdev->id, sdev->lun);
+		cmd->result = DID_NO_CONNECT << 16;
+		goto abort1;
+	}
 	if (!drive) {
 		printk (KERN_ERR "ide-scsi: drive id %d not present\n", cmd->device->id);
 		goto abort;
@@ -811,9 +820,8 @@
 		printk (KERN_ERR "ide-scsi: %s: out of memory\n", drive->name);
 		goto abort;
 	}
-
-	memset (pc->c, 0, 12);
-	pc->flags = 0;
+	memset(pc, 0, sizeof(idescsi_pc_t));
+	memset(rq, 0, sizeof(struct request));
 	pc->rq = rq;
 	memcpy (pc->c, cmd->cmnd, cmd->cmd_len);
 	if (cmd->use_sg) {
@@ -846,16 +854,17 @@
 	rq->special = (char *) pc;
 	rq->bio = idescsi_dma_bio (drive, pc);
 	rq->flags = REQ_SPECIAL;
-	spin_unlock_irq(cmd->device->host->host_lock);
+	spin_unlock_irq(sdev->host->host_lock);
 	(void) ide_do_drive_cmd (drive, rq, ide_end);
-	spin_lock_irq(cmd->device->host->host_lock);
+	spin_lock_irq(sdev->host->host_lock);
 	return 0;
 abort:
+	cmd->result = DID_ERROR << 16;
+abort1:
 	if (pc) kfree (pc);
 	if (rq) kfree (rq);
-	cmd->result = DID_ERROR << 16;
 	done(cmd);
-	return 1;
+	return 0;
 }
 
 static int idescsi_scsi_eh_abort (Scsi_Cmnd *cmd)

  reply	other threads:[~2003-05-20 11:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-18 23:07 ide-scsi error handling Willem Riede
2003-05-19 13:01 ` Douglas Gilbert
2003-05-19 23:42   ` Willem Riede
2003-05-20 11:24     ` Douglas Gilbert [this message]
2003-05-19 14:36 ` Randy.Dunlap
2003-05-19 14:37   ` Randy.Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ECA1081.805@torque.net \
    --to=dougg@torque.net \
    --cc=linux-scsi@vger.kernel.org \
    --cc=wrlk@riede.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox