public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi/sd: Fix Opal support
@ 2021-02-20 17:39 Bart Van Assche
  2021-02-21  8:15 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2021-02-20 17:39 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Bart Van Assche, chriscjsus, Christoph Hellwig,
	Jens Axboe, Alan Stern

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: chriscjsus@yahoo.com
Tested-by: chriscjsus@yahoo.com
Cc: chriscjsus@yahoo.com
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/sd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a3d2d4bc4a3d..aaebf166066a 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -707,9 +707,10 @@ 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,
+		/*sense=*/NULL, /*sshdr=*/NULL, SD_TIMEOUT, sdkp->max_retries,
+		/*flags=*/0, /*rq_flags=*/RQF_PM, /*resid=*/NULL);
 	return ret <= 0 ? ret : -EIO;
 }
 #endif /* CONFIG_BLK_SED_OPAL */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi/sd: Fix Opal support
  2021-02-20 17:39 [PATCH] scsi/sd: Fix Opal support Bart Van Assche
@ 2021-02-21  8:15 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2021-02-21  8:15 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, James E . J . Bottomley, linux-scsi,
	chriscjsus, Christoph Hellwig, Jens Axboe, Alan Stern

> -	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,
> +		/*sense=*/NULL, /*sshdr=*/NULL, SD_TIMEOUT, sdkp->max_retries,
> +		/*flags=*/0, /*rq_flags=*/RQF_PM, /*resid=*/NULL);

Please keep the existing style here.  Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-21  8:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-20 17:39 [PATCH] scsi/sd: Fix Opal support Bart Van Assche
2021-02-21  8:15 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox