summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2016-04-25 10:45:50 (GMT)
committerTejun Heo <tj@kernel.org>2016-05-09 16:36:45 (GMT)
commit59f68474c2a1f5f0cedede60b60de97c603dc194 (patch)
treebc3fdf2dc88364fbc22cc19ed5b1c5af03e4f8cd
parenta57038496422d7d21b7e41ed70d63bf0c6ff6068 (diff)
downloadlinux-59f68474c2a1f5f0cedede60b60de97c603dc194.tar.xz
libata-scsi: Generate sense code for disabled devices
If a device is disabled after error recovery it doesn't make any sense to generate an ATA sense, but we should rather return a generic sense code indicating the device is gone. Signed-off-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--drivers/ata/libata-scsi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 8b61d63..6d78b4b 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1126,6 +1126,12 @@ static void ata_gen_ata_sense(struct ata_queued_cmd *qc)
cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
+ if (ata_dev_disabled(dev)) {
+ /* Device disabled after error recovery */
+ /* LOGICAL UNIT NOT READY, HARD RESET REQUIRED */
+ ata_scsi_set_sense(dev, cmd, NOT_READY, 0x04, 0x21);
+ return;
+ }
/* Use ata_to_sense_error() to map status register bits
* onto sense key, asc & ascq.
*/