]> git.karo-electronics.de Git - linux-beck.git/commitdiff
libata-scsi: Generate sense code for disabled devices
authorHannes Reinecke <hare@suse.de>
Mon, 25 Apr 2016 10:45:50 +0000 (12:45 +0200)
committerTejun Heo <tj@kernel.org>
Mon, 9 May 2016 16:36:45 +0000 (12:36 -0400)
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>
drivers/ata/libata-scsi.c

index 8b61d63ab0be30e3561bc5b674b8465dff7bb31a..6d78b4b422a43d1ebb764d603f46aea4d96366d2 100644 (file)
@@ -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.
         */