diff mbox series

scsi: ignore a failure to synchronize cache due to lack of authorization

Message ID 20190903101840.16483-1-oneukum@suse.com (mailing list archive)
State Mainlined
Commit 21e3d6c81179bbdfa279efc8de456c34b814cfd2
Headers show
Series scsi: ignore a failure to synchronize cache due to lack of authorization | expand

Commit Message

Oliver Neukum Sept. 3, 2019, 10:18 a.m. UTC
I've got a report about a UAS drive enclosure reporting back
Sense: Logical unit access not authorized
if the drive it holds is password protected. While the drive
is obviously unusable in that state as a mass storage device,
it still exists as a sd device and when the system is asked
to perform a suspend of the drive, it will be sent a
SYNCHRONIZE CACHE. If that fails due to password protection,
the error must be ignored.
---
 drivers/scsi/sd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Martin K. Petersen Oct. 1, 2019, 3:36 a.m. UTC | #1
Oliver,

> I've got a report about a UAS drive enclosure reporting back Sense:
> Logical unit access not authorized if the drive it holds is password
> protected. While the drive is obviously unusable in that state as a
> mass storage device, it still exists as a sd device and when the
> system is asked to perform a suspend of the drive, it will be sent a
> SYNCHRONIZE CACHE. If that fails due to password protection, the error
> must be ignored.  --- drivers/scsi/sd.c | 3 ++- 1 file changed, 2
> insertions(+), 1 deletion(-)

Applied to 5.4/scsi-fixes, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 149d406aacc9..2d77f32e13d5 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1655,7 +1655,8 @@  static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)
 		/* we need to evaluate the error return  */
 		if (scsi_sense_valid(sshdr) &&
 			(sshdr->asc == 0x3a ||	/* medium not present */
-			 sshdr->asc == 0x20))	/* invalid command */
+			 sshdr->asc == 0x20 ||	/* invalid command */
+			 (sshdr->asc == 0x74 && sshdr->ascq == 0x71)))	/* drive is password locked */
 				/* this is no error here */
 				return 0;