scsi: core: Set sc_data_direction to DMA_NONE for no-transfer commands

No having the special DMA_NONE logic makes libata rather unhappy.

Link: https://lore.kernel.org/r/20201008200611.1818099-3-hch@lst.de
Fixes: 40b93836a1 ("scsi: core: Use rq_dma_dir in scsi_setup_cmnd()")
Reported-by: Qian Cai <cai@redhat.com>
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Christoph Hellwig 2020-10-08 22:06:11 +02:00 committed by Martin K. Petersen
parent 9120ac54cc
commit b6ba9b0e20

View File

@ -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;