[SCSI] mptfusion: block device when target is being removed by FW
authorKashyap, Desai <kashyap.desai@lsi.com>
Wed, 16 Dec 2009 13:32:29 +0000 (19:02 +0530)
committerJames Bottomley <James.Bottomley@suse.de>
Mon, 18 Jan 2010 16:48:11 +0000 (10:48 -0600)
Add support to set the sdev state to SDEV_BLOCK during device removal
to stop IOs comming to the deleting driver immediately.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/message/fusion/mptsas.c

index 1b7f550daebcbadf5c5e4bc2238deeaad4cfb7a7..c20bbe45da82d4811d57618cb1144fa8af44f662 100644 (file)
@@ -1075,6 +1075,19 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id)
        return 0;
 }
 
+static void
+mptsas_block_io_sdev(struct scsi_device *sdev, void *data)
+{
+       scsi_device_set_state(sdev, SDEV_BLOCK);
+}
+
+static void
+mptsas_block_io_starget(struct scsi_target *starget)
+{
+       if (starget)
+               starget_for_each_device(starget, NULL, mptsas_block_io_sdev);
+}
+
 /**
  * mptsas_target_reset_queue
  *
@@ -1098,10 +1111,11 @@ mptsas_target_reset_queue(MPT_ADAPTER *ioc,
        id = sas_event_data->TargetID;
        channel = sas_event_data->Bus;
 
-       if (!(vtarget = mptsas_find_vtarget(ioc, channel, id)))
-               return;
-
-       vtarget->deleted = 1; /* block IO */
+       vtarget = mptsas_find_vtarget(ioc, channel, id);
+       if (vtarget) {
+               mptsas_block_io_starget(vtarget->starget);
+               vtarget->deleted = 1; /* block IO */
+       }
 
        target_reset_list = kzalloc(sizeof(struct mptsas_target_reset_event),
            GFP_ATOMIC);
@@ -1868,7 +1882,8 @@ mptsas_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
        if (ioc->sas_discovery_quiesce_io)
                return SCSI_MLQUEUE_HOST_BUSY;
 
-//     scsi_print_command(SCpnt);
+       if (ioc->debug_level & MPT_DEBUG_SCSI)
+               scsi_print_command(SCpnt);
 
        return mptscsih_qcmd(SCpnt,done);
 }