lkml.org 
[lkml]   [1999]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] SCSI drivers SMP problems
On Wed, 16 Jun 1999, Marcelo Tosatti wrote:

> This patch fixes problems with some drivers which dont locked the
> io_request_lock before calling scsi_done.
> Drivers with problems :
> wd33c93.c, 53c7xx.c, NCR53C9x.c (Linus, update your tree with the current
> driver which fixes this and another problems), atp870u.c (i sent the patch
> a while ago), sym53c416.c, sgiwd93.c and aha152x (will be in 2.2.10ac3)

Marcelo forgot the in2000.c patch, Im attaching it.

--
Augusto Cesar Radtke
Sekure SDI
http://www.sekure.org

--- in2000.orig Thu Jun 17 00:35:48 1999
+++ in2000.c Thu Jun 17 00:41:18 1999
@@ -6,6 +6,9 @@
* john@geolog.com
* jshiffle@netcom.com
*
+ * Changes:
+ * Augusto Cesar Radtke <bishop@sekure.org>: Added io_request_lock locking
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
@@ -107,6 +110,7 @@
#include <linux/module.h>

#include <asm/system.h>
+#include <asm/spinlock.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/delay.h>
@@ -334,7 +338,9 @@
*/

cmd->host_scribble = NULL;
+ spin_lock_irqsave(&io_request_lock, flags);
cmd->scsi_done = done;
+ spin_unlock_irqrestore(&io_request_lock, flags);
cmd->result = 0;

/* We use the Scsi_Pointer structure that's included with each command
@@ -1088,7 +1094,9 @@
cmd->result = DID_NO_CONNECT << 16;
hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
hostdata->state = S_UNCONNECTED;
+ spin_lock_irqsave(&io_request_lock, flags);
cmd->scsi_done(cmd);
+ spin_unlock_irqrestore(&io_request_lock, flags);

/* We are not connected to a target - check to see if there
* are commands waiting to be executed.
@@ -1358,7 +1366,9 @@
cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
else
cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
+ spin_lock_irqsave(&io_request_lock, flags);
cmd->scsi_done(cmd);
+ spin_unlock_irqrestore(&io_request_lock, flags);

/* We are no longer connected to a target - check to see if
* there are commands waiting to be executed.
@@ -1444,7 +1454,10 @@
cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
else
cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
+ spin_lock_irqsave(&io_request_lock, flags);
cmd->scsi_done(cmd);
+ spin_unlock_irqrestore(&io_request_lock, flags);
+

/* We are no longer connected to a target - check to see if
* there are commands waiting to be executed.
@@ -1476,7 +1489,10 @@
cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
else
cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
+ spin_lock_irqsave(&io_request_lock, flags);
cmd->scsi_done(cmd);
+ spin_unlock_irqrestore(&io_request_lock, flags);
+
break;
case S_PRE_TMP_DISC:
case S_RUNNING_LEVEL2:
@@ -1735,7 +1751,9 @@
cmd->result = DID_ABORT << 16;
printk("scsi%d: Abort - removing command %ld from input_Q. ",
instance->host_no, cmd->pid);
+ spin_lock_irqsave(&io_request_lock, flags);
cmd->scsi_done(cmd);
+ spin_unlock_irqrestore(&io_request_lock, flags);
restore_flags(flags);
return SCSI_ABORT_SUCCESS;
}
@@ -1796,7 +1814,9 @@
hostdata->connected = NULL;
hostdata->state = S_UNCONNECTED;
cmd->result = DID_ABORT << 16;
+ spin_lock_irqsave(&io_request_lock, flags);
cmd->scsi_done(cmd);
+ spin_unlock_irqrestore(&io_request_lock, flags);

in2000_execute (instance);
\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.203 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site