public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* possible bug in rmmod scsi controllers?
@ 2004-06-10 18:01 Jiang, Dave
  2004-06-10 19:53 ` Mike Anderson
  0 siblings, 1 reply; 2+ messages in thread
From: Jiang, Dave @ 2004-06-10 18:01 UTC (permalink / raw)
  To: linux-scsi; +Cc: Boji T Kannanthanam (Kannanthanam, Boji T)

While playing around with scsi_debug on 2.6.7-rc3, I noticed that
whenever I rmmod scsi_debug, the sync cache command always fails. After
a little looking around it seems that whenever scsi_remove_host() is
called, the host state is set to SHOST_CANCEL. If the disk is configured
as write-back cache, then a SYNCH_CACHE command is issued. However, in
scsi_dispatch_cmd() function in scsi.c a check is done to see if
SHOST_CANCEL state is set and if so the command is rejected. Therefore
the sync cache command always fails during unload. Something such as
below fixes the problem:

--- scsi.c.old	2004-06-10 10:43:02.478538016 -0700
+++ scsi.c	2004-06-10 10:41:52.627157040 -0700
@@ -576,7 +576,8 @@
 	}
 
 	spin_lock_irqsave(host->host_lock, flags);
-	if (unlikely(test_bit(SHOST_CANCEL, &host->shost_state))) {
+	if (unlikely(test_bit(SHOST_CANCEL, &host->shost_state)) &&
+			unlikely(cmd->device->sdev_state == SDEV_DEL)) {
 		cmd->result = (DID_NO_CONNECT << 16);
 		scsi_done(cmd);
 	} else {

However, this is a quick hack and I'm sure there are better ways to do
this. There was a similar issue on 2.6.5 with the device state that was
fixed in 2.6.6 which exposed this issue. 

----

    -= Dave =- 

Software Engineer - Advanced Development Engineering Team 
Storage Component Division - Intel Corp. 
mailto://dave-DOT-jiang-AT-intel.com 
----
The views expressed in this email are
mine alone and do not necessarily 
reflect the views of my employer
(Intel Corp.).


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-10 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-10 18:01 possible bug in rmmod scsi controllers? Jiang, Dave
2004-06-10 19:53 ` Mike Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox