Skip to contentSkip to conversation

scsi/sd: Fix Opal support

PATCH Applied Bart Van Assche 3 participants 4 messages Feb 22, 2021 – Feb 26, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 scsi/sd: Fix Opal support

The SCSI core has been modified recently such that it only processes PM requests if rpm_status != RPM_ACTIVE. Since some Opal requests are submitted while rpm_status != RPM_ACTIVE, set flag RQF_PM for Opal requests.

See also https://bugzilla.kernel.org/show_bug.cgi?id=211227.

Fixes d80210f25ff0 ("sd: add support for TCG OPAL self encrypting disks")
Fixes 271822bbf9fe ("scsi: core: Only process PM requests if rpm_status != RPM_ACTIVE")
Reported-by [email protected]
Cc Jens Axboe <[email protected]>
Cc Alan Stern <[email protected]>

---
Changes compared to v1:
- Addressed Christoph's review comments.
- Added Cc: stable.

---
 drivers/scsi/sd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/sd.c +3 -3
index a3d2d4bc4a3d..6a3a163b0706 100644
@@ -707,9 +707,9 @@ static int sd_sec_submit(void *data, u16 spsp, u8 secp, void *buffer,
 	put_unaligned_be16(spsp, &cdb[2]);
 	put_unaligned_be32(len, &cdb[6]);
 
-	ret = scsi_execute_req(sdev, cdb,
-			send ? DMA_TO_DEVICE : DMA_FROM_DEVICE,
-			buffer, len, NULL, SD_TIMEOUT, sdkp->max_retries, NULL);
+	ret = scsi_execute(sdev, cdb, send ? DMA_TO_DEVICE : DMA_FROM_DEVICE,
+		buffer, len, NULL, NULL, SD_TIMEOUT, sdkp->max_retries, 0,
+		RQF_PM, NULL);
 	return ret <= 0 ? ret : -EIO;
 }
 #endif /* CONFIG_BLK_SED_OPAL */
#2 lore raw
In reply to Bart Van Assche

Bart,

Quoted 4 lines

The SCSI core has been modified recently such that it only processes PM requests if rpm_status != RPM_ACTIVE. Since some Opal requests are submitted while rpm_status != RPM_ACTIVE, set flag RQF_PM for Opal requests.

Applied to 5.12/scsi-staging. Thanks for fixing this up!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw
In reply to Bart Van Assche
Quoted 6 lines · Bart Van Assche

The SCSI core has been modified recently such that it only processes PM requests if rpm_status != RPM_ACTIVE. Since some Opal requests are submitted while rpm_status != RPM_ACTIVE, set flag RQF_PM for Opal requests.

See also https://bugzilla.kernel.org/show_bug.cgi?id=211227.

Applied to 5.12/scsi-queue, thanks!

[1/1] scsi/sd: Fix Opal support

      https://git.kernel.org/mkp/scsi/c/aaf15f8c6de9
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering