Re: broken scsi_reset (patch)

Manfred Spraul (masp0008@stud.uni-sb.de)
Sun, 10 Jan 1999 00:36:23 +0100


>No patch attached.
Here is the attachment. I forgot to attach it.

The problems were discussed in 2 threads:
Oops while booting
oops after scsi reset (ncr53c8xx)

Manfred
----------
diff -r -u linuxsav/drivers/scsi/scsi.h linux/drivers/scsi/scsi.h
--- linuxsav/drivers/scsi/scsi.h Sat Jan 9 17:30:44 1999
+++ linux/drivers/scsi/scsi.h Sat Jan 9 18:18:43 1999
@@ -317,7 +317,7 @@
#define IS_RESETTING 0x08
#define IS_ABORTING 0x10
#define ASKED_FOR_SENSE 0x20
-
+#define SYNC_RESET 0x40

#if defined(__mc68000__) || defined(CONFIG_APUS)
#include <asm/pgtable.h>
diff -r -u linuxsav/drivers/scsi/scsi_obsolete.c
linux/drivers/scsi/scsi_obsolete.c
--- linuxsav/drivers/scsi/scsi_obsolete.c Sat Jan 9 17:30:49 1999
+++ linux/drivers/scsi/scsi_obsolete.c Sat Jan 9 18:29:52 1999
@@ -23,6 +23,9 @@
* Major improvements to the timeout, abort, and reset processing,
* as well as performance modifications for large queue depths by
* Leonard N. Zubkoff <lnz@dandelion.com>
+ *
+ * Improved compatibility with 2.0 behaviour by Manfred Spraul
+ * <masp0008@stud.uni-sb.de>
*/

/*
@@ -354,6 +357,18 @@
printk("In scsi_done(host = %d, result = %06x)\n", host->host_no,
result);
#endif

+ if(SCpnt->flags & SYNC_RESET)
+ {
+ /*
+ * The behaviou of scsi_reset(SYNC) was changed in 2.1.? .
+ * The scsi mid-layer does a REDO after every sync reset, the driver
+ * must not do that any more. In order to prevent old drivers from
+ * crashing, all scsi_done() calls during sync resets are ignored.
+ */
+ printk("scsi%d: device driver called scsi_done() for a syncronous
reset.\n",
+ SCpnt->host->host_no);
+ return;
+ }
if(SCpnt->flags & WAS_SENSE)
{
SCpnt->use_sg = SCpnt->old_use_sg;
@@ -377,7 +392,9 @@
" failed, performing reset.\n",
SCpnt->host->host_no, SCpnt->channel, SCpnt->target,
SCpnt->lun);
+ SCpnt->flags |= SYNC_RESET;
scsi_reset(SCpnt, SCSI_RESET_SYNCHRONOUS);
+ SCpnt->flags &= ~SYNC_RESET;
status = REDO;
break;
}
@@ -494,7 +511,9 @@
case RESERVATION_CONFLICT:
printk("scsi%d, channel %d : RESERVATION CONFLICT performing"
" reset.\n", SCpnt->host->host_no, SCpnt->channel);
- scsi_reset(SCpnt, SCSI_RESET_SYNCHRONOUS);
+ SCpnt->flags |= SYNC_RESET;
+ scsi_reset(SCpnt, SCSI_RESET_SYNCHRONOUS);
+ SCpnt->flags &= ~SYNC_RESET;
status = REDO;
break;
default:
@@ -612,8 +631,10 @@
{
printk("scsi%d channel %d : resetting for second half of retries.\n",
SCpnt->host->host_no, SCpnt->channel);
+ SCpnt->flags |= SYNC_RESET;
scsi_reset(SCpnt, SCSI_RESET_SYNCHRONOUS);
- break;
+ SCpnt->flags &= ~SYNC_RESET;
+ /* fall through to REDO */
}
}
else

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