[SCSI] libsas: Don't issue commands to devices that have been hot-removed
[pandora-kernel.git] / drivers / scsi / libsas / sas_scsi_host.c
index f0cfba9..1787bd2 100644 (file)
@@ -228,6 +228,13 @@ int sas_queuecommand(struct scsi_cmnd *cmd,
                        goto out;
                }
 
+               /* If the device fell off, no sense in issuing commands */
+               if (dev->gone) {
+                       cmd->result = DID_BAD_TARGET << 16;
+                       scsi_done(cmd);
+                       goto out;
+               }
+
                res = -ENOMEM;
                task = sas_create_task(cmd, dev, GFP_ATOMIC);
                if (!task)