public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: <sreekanth.reddy@lsi.com>
To: linux-scsi@vger.kernel.org, Sathya.Prakash@lsi.com,
	Nagalakshmi.Nandigama@lsi.com, jejb@kernel.org,
	stable@vger.kernel.org
Cc: sreekanth.reddy@lsi.com
Subject: Fix for issue - The device is removed in blocked state
Date: Thu, 19 Jul 2012 08:21:56 +0530	[thread overview]
Message-ID: <20120719025156.GA3075@localhost.localdomain> (raw)

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

                 reply	other threads:[~2012-07-19  9:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120719025156.GA3075@localhost.localdomain \
    --to=sreekanth.reddy@lsi.com \
    --cc=Nagalakshmi.Nandigama@lsi.com \
    --cc=Sathya.Prakash@lsi.com \
    --cc=jejb@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox