summaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptsas.c
diff options
context:
space:
mode:
authorMoore, Eric <Eric.Moore@lsil.com>2006-01-25 18:05:12 -0700
committerJames Bottomley <jejb@mulgrave.(none)>2006-01-31 14:39:38 -0600
commit7d3eecf7b2195c64d26f7e7d105d00e5a6dd702e (patch)
tree9de227b1c38f68e6c7312e85028ebb734457c7cd /drivers/message/fusion/mptsas.c
parentc73787eecdbe4691d4e3f989052db8b552e1ac34 (diff)
[SCSI] fusion: target reset when drive is being removed
The issuing of the target reset used in device hot removal case so the firmware queue is flushed out off outstanding commands. Signed-off-by: Eric Moore <Eric.Moore@lsil.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion/mptsas.c')
-rw-r--r--drivers/message/fusion/mptsas.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 8e77837c07e..190bd940bb0 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -324,6 +324,7 @@ mptsas_slave_destroy(struct scsi_device *sdev)
struct sas_rphy *rphy;
struct mptsas_portinfo *p;
int i;
+ VirtDevice *vdev;
/*
* Handle hotplug removal case.
@@ -347,8 +348,29 @@ mptsas_slave_destroy(struct scsi_device *sdev)
out:
mutex_unlock(&hd->ioc->sas_topology_mutex);
/*
- * TODO: Issue target reset to flush firmware outstanding commands.
+ * Issue target reset to flush firmware outstanding commands.
*/
+ vdev = sdev->hostdata;
+ if (vdev->configured_lun){
+ if (mptscsih_TMHandler(hd,
+ MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
+ vdev->bus_id,
+ vdev->target_id,
+ 0, 0, 5 /* 5 second timeout */)
+ < 0){
+
+ /* The TM request failed!
+ * Fatal error case.
+ */
+ printk(MYIOC_s_WARN_FMT
+ "Error processing TaskMgmt id=%d TARGET_RESET\n",
+ hd->ioc->name,
+ vdev->target_id);
+
+ hd->tmPending = 0;
+ hd->tmState = TM_STATE_NONE;
+ }
+ }
mptscsih_slave_destroy(sdev);
}