scsi: sd: Defer spinning up drive while SANITIZE is in progress
authorMahesh Rajashekhara <mahesh.rajashekhara@microsemi.com>
Tue, 17 Apr 2018 11:33:12 +0000 (17:03 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 19 Apr 2018 03:37:40 +0000 (23:37 -0400)
A drive being sanitized will return NOT READY / ASC 0x4 / ASCQ
0x1b ("LOGICAL UNIT NOT READY. SANITIZE IN PROGRESS").

Prevent spinning up the drive until this condition clears.

[mkp: tweaked commit message]

Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekhara@microsemi.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c

index a6201e696ab9c5a20e0e75e1ee9b3a7b87c14461..9421d987773051e72af159ce1b4cc1f5f961e2a6 100644 (file)
@@ -2121,6 +2121,8 @@ sd_spinup_disk(struct scsi_disk *sdkp)
                                break;  /* standby */
                        if (sshdr.asc == 4 && sshdr.ascq == 0xc)
                                break;  /* unavailable */
+                       if (sshdr.asc == 4 && sshdr.ascq == 0x1b)
+                               break;  /* sanitize in progress */
                        /*
                         * Issue command to spin up drive when not ready
                         */