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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 May 2018 14:59:55 +0000 (07:59 -0700)
commit 505aa4b6a8834a2300971c5220c380c3271ebde3 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/sd.c

index d52af6a89d4c3bfeeea573562c2e91b163ab5b6e..145413a53caa93a775dede76abe183f0719462c7 100644 (file)
@@ -1848,6 +1848,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
                         */