public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* Fix for issue - The device is removed in blocked state
@ 2012-07-19  2:51 sreekanth.reddy
  0 siblings, 0 replies; only message in thread
From: sreekanth.reddy @ 2012-07-19  2:51 UTC (permalink / raw)
  To: linux-scsi, Sathya.Prakash, Nagalakshmi.Nandigama, jejb, stable
  Cc: sreekanth.reddy

Fix for issue - The device is removed in blocked state.

The device is set to blocked state when I/Os running and the cable is pulled.
Also if the device missing delay timer is started. When the device missing
delay timer expires, the device is removed but the device state is not set to
unblocked state. This will cause problems  if there are commands in block
queue.

To fix this issue, added code to unblock the device before removing it.

Signed-off-by: Sreekanth Reddy <sreekanth.reddy@lsi.com>
Cc: <stable@kernel.org>
---

diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 551262e..4d02d5d 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1088,7 +1088,13 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id)
 static void
 mptsas_block_io_sdev(struct scsi_device *sdev, void *data)
 {
-	scsi_device_set_state(sdev, SDEV_BLOCK);
+	scsi_internal_device_block(sdev);
+}
+
+static void
+mptsas_ublock_io_sdev(struct scsi_device *sdev, void *data)
+{
+	scsi_internal_device_unblock(sdev);
 }
 
 static void
@@ -1098,6 +1104,13 @@ mptsas_block_io_starget(struct scsi_target *starget)
 		starget_for_each_device(starget, NULL, mptsas_block_io_sdev);
 }
 
+static void
+mptsas_ublock_io_starget(struct scsi_target *starget)
+{
+	if (starget)
+		starget_for_each_device(starget, NULL, mptsas_ublock_io_sdev);
+}
+
 /**
  * mptsas_target_reset_queue
  *
@@ -1502,6 +1515,7 @@ mptsas_del_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info)
 	char *ds = NULL;
 	u8 fw_id;
 	u64 sas_address;
+	VirtTarget	*vtarget;
 
 	if (!phy_info)
 		return;
@@ -1545,6 +1559,13 @@ mptsas_del_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info)
 	    phy_info->attached.id, phy_info->attached.phy_id,
 	    (unsigned long long) sas_address);
 
+	vtarget = mptsas_find_vtarget(ioc,
+			 phy_info->attached.channel, phy_info->attached.id);
+	if (vtarget && vtarget->deleted == 1) {
+		mptsas_ublock_io_starget(vtarget->starget);
+		vtarget->deleted = 0; /* unblock IO */
+	}
+
 	port = mptsas_get_port(phy_info);
 	if (!port) {
 		dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
diff --git a/drivers/message/fusion/mptsas.h b/drivers/message/fusion/mptsas.h
index 57e86ab..1567f57 100644
--- a/drivers/message/fusion/mptsas.h
+++ b/drivers/message/fusion/mptsas.h
@@ -189,4 +189,7 @@ struct mptsas_enclosure {
 };
 
 /*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
+
+extern int scsi_internal_device_block(struct scsi_device *sdev);
+extern int scsi_internal_device_unblock(struct scsi_device *sdev);
 #endif

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-19  9:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-19  2:51 Fix for issue - The device is removed in blocked state sreekanth.reddy

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