scsi regression fixes
Hi Martin,
two regression fixes for my recently merged series, uncovered by libata.
PATCH 1/2 sr: initialize ->cmd_len
Ensure the command length is properly set. Previously the command code tried to find this out using the command opcode.
--- drivers/scsi/sr.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/sr.c +1 -0
@@ -503,6 +503,7 @@ static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt) SCpnt->transfersize = cd->device->sector_size; SCpnt->underflow = this_count <<9 ; SCpnt->allowed =MAX_RETRIES ; + SCpnt->cmd_len =10 ;/* * This indicates that the command is ready from our end to be queued.
Signature · 1 line
2.28.0
Re: [PATCH 1/2] sr: initialize ->cmd_len
Quoted 3 lines · Christoph Hellwig
Ensure the command length is properly set. Previously the command code tried to find this out using the command opcode.
The reported problem [1] is fixed by applying this set of two patches on top of linux next 20201008 tag kernel and tested on arm64, arm and x86_64 and i386 devices and qemu.
Here is the two patches applied on linux next 20201008 tag [PATCH 1/2] sr: initialize ->cmd_len[PATCH 1/2] sr: initialize ->cmd_len [PATCH 2/2] scsi: set sc_data_direction to DMA_NONE for no-transfer commands
- Boot test PASS
- mkfs -t ext4 /dev/sda1 test PASS
Quoted 5 lines
Fixes 2ceda20f0a99 ("scsi: core: Move command size detection out of the fast path")Reported-by Qian Cai <[email protected]>Reported-by Naresh Kamboju <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
Quoted 17 lines
--- drivers/scsi/sr.c | 1 + 1 file changed, 1 insertion(+)drivers/scsi/sr.c +1
-1@@ -503,6 +503,7 @@ static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt) SCpnt->transfersize = cd->device->sector_size; SCpnt->underflow = this_count <<9 ; SCpnt->allowed =MAX_RETRIES ; + SCpnt->cmd_len =10 ;/* * This indicates that the command is ready from our end to be queued. --
Quoted 2 lines
2.28.0
[1] https://lore.kernel.org/linux-block/[email protected]/T/#m4fe8f4ccc1f54d93740f310ce80230a92929e94b
Martin K. Petersen
AppliedRe: [PATCH 1/2] sr: initialize ->cmd_len
In reply to Christoph HellwigQuoted 2 lines · Christoph Hellwig
Ensure the command length is properly set. Previously the command code tried to find this out using the command opcode.
Applied to 5.10/scsi-queue, thanks!
[1/2] scsi: sr: Initialize ->cmd_len
https://git.kernel.org/mkp/scsi/c/9120ac54cce6 [2/2] scsi: core: Set sc_data_direction to DMA_NONE for no-transfer commands https://git.kernel.org/mkp/scsi/c/b6ba9b0e201a
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
PATCH 2/2 scsi: set sc_data_direction to DMA_NONE for no-transfer commands
In reply to Christoph HellwigNo having the special DMA_NONE logic makes libata rather unhappy.
--- drivers/scsi/scsi_lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +4 -1
@@ -1545,7 +1545,10 @@ static blk_status_t scsi_prepare_cmd(struct request *req) cmd->request = req; cmd->tag = req->tag; cmd->prot_op =SCSI_PROT_NORMAL ; - cmd->sc_data_direction =rq_dma_dir (req); +if (blk_rq_bytes (req)) + cmd->sc_data_direction =rq_dma_dir (req); +else + cmd->sc_data_direction =DMA_NONE ; sg = (void *)cmd +sizeof (struct scsi_cmnd ) + shost->hostt->cmd_size; cmd->sdb.table.sgl = sg;
Signature · 1 line
2.28.0
Martin K. Petersen
AppliedChristoph,
Quoted 2 lines
two regression fixes for my recently merged series, uncovered by libata.
Applied to 5.10/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering