[SCSI] isci: Immediately fail I/O to removed devices.
authorJeff Skirvin <jeffrey.d.skirvin@intel.com>
Thu, 27 Oct 2011 22:04:56 +0000 (15:04 -0700)
committerJames Bottomley <JBottomley@Parallels.com>
Mon, 31 Oct 2011 09:15:17 +0000 (13:15 +0400)
In the case where an I/O fails to start in isci_request_execute,
only allow retries if the device is not already gone.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/isci/task.c

index e2d9418683ce66ce45f2522eff72556287064464..e8cf17b024a4f890c8eb9d75b96c8fb6fd99de7f 100644 (file)
@@ -212,16 +212,27 @@ int isci_task_execute_task(struct sas_task *task, int num, gfp_t gfp_flags)
                                        task->task_state_flags &= ~SAS_TASK_AT_INITIATOR;
                                        spin_unlock_irqrestore(&task->task_state_lock, flags);
 
-                                       /* Indicate QUEUE_FULL so that the scsi
-                                       * midlayer retries. if the request
-                                       * failed for remote device reasons,
-                                       * it gets returned as
-                                       * SAS_TASK_UNDELIVERED next time
-                                       * through.
-                                       */
-                                       isci_task_refuse(ihost, task,
-                                                        SAS_TASK_COMPLETE,
-                                                        SAS_QUEUE_FULL);
+                                       if (test_bit(IDEV_GONE, &idev->flags)) {
+
+                                               /* Indicate that the device
+                                                * is gone.
+                                                */
+                                               isci_task_refuse(ihost, task,
+                                                       SAS_TASK_UNDELIVERED,
+                                                       SAS_DEVICE_UNKNOWN);
+                                       } else {
+                                               /* Indicate QUEUE_FULL so that
+                                                * the scsi midlayer retries.
+                                                * If the request failed for
+                                                * remote device reasons, it
+                                                * gets returned as
+                                                * SAS_TASK_UNDELIVERED next
+                                                * time through.
+                                                */
+                                               isci_task_refuse(ihost, task,
+                                                       SAS_TASK_COMPLETE,
+                                                       SAS_QUEUE_FULL);
+                                       }
                                }
                        }
                }