public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [scsi]: Add offline state checking while dispatch a scsi cmd
@ 2007-03-08  9:22 Joe Jin
  2007-03-08 16:02 ` James Bottomley
  0 siblings, 1 reply; 8+ messages in thread
From: Joe Jin @ 2007-03-08  9:22 UTC (permalink / raw)
  To: akpm, dgilbert, James.Bottomley; +Cc: linux-scsi, linux-kernel, haobo.zhou

While a scsi device hw error occured, device's status maybe setting 
to SDEV_OFFLINE, So at scsi_dispatch_cmd function, we should checking
if device have offline, if yes, do nothing and just return error to
user directly.


Signed-off-by: Joe Jin <lkmaillist@gmail.com>
--
--- linux-2.6.21-rc2/drivers/scsi/scsi.c.orig	2007-03-08 16:50:14.000000000 +0800
+++ linux-2.6.21-rc2/drivers/scsi/scsi.c	2007-03-08 16:52:45.000000000 +0800
@@ -486,10 +486,12 @@
 	int rtn = 0;
 
 	/* check if the device is still usable */
-	if (unlikely(cmd->device->sdev_state == SDEV_DEL)) {
-		/* in SDEV_DEL we error all commands. DID_NO_CONNECT
-		 * returns an immediate error upwards, and signals
-		 * that the device is no longer present */
+	if (unlikely(cmd->device->sdev_state == SDEV_DEL || 
+		     cmd->device->sdev_state == SDEV_OFFLINE)) {
+		/* in SDEV_DEL or SDEV_OFFLINE we error all commands. 
+		 * DID_NO_CONNECT returns an immediate error upwards,
+		 * and signals that the device is no longer present 
+		 */
 		cmd->result = DID_NO_CONNECT << 16;
 		atomic_inc(&cmd->device->iorequest_cnt);
 		__scsi_done(cmd);


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

end of thread, other threads:[~2007-03-12  3:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-08  9:22 [PATCH] [scsi]: Add offline state checking while dispatch a scsi cmd Joe Jin
2007-03-08 16:02 ` James Bottomley
2007-03-09  1:40   ` Joe Jin
2007-03-11  9:53     ` Andrew Morton
2007-03-12  2:52       ` Joe Jin
2007-03-12  3:15         ` Andrew Morton
2007-03-11 15:21     ` James Bottomley
2007-03-12  1:03       ` Joe Jin

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