From: Mahesh Rajashekhara Date: Tue, 17 Apr 2018 11:33:12 +0000 (+0530) Subject: scsi: sd: Defer spinning up drive while SANITIZE is in progress X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b23b4174275d397281023703ce19ff793e6dfd98;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git scsi: sd: Defer spinning up drive while SANITIZE is in progress 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 Cc: Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 72db0f7d221a..2f9912de2212 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2132,6 +2132,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 */