All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, Qian Cai <cai@redhat.com>,
	Naresh Kamboju <naresh.kamboju@linaro.org>
Subject: [PATCH 2/2] scsi: set sc_data_direction to DMA_NONE for no-transfer commands
Date: Thu,  8 Oct 2020 22:06:11 +0200	[thread overview]
Message-ID: <20201008200611.1818099-3-hch@lst.de> (raw)
In-Reply-To: <20201008200611.1818099-1-hch@lst.de>

No having the special DMA_NONE logic makes libata rather unhappy.

Fixes: 40b93836a136 ("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>
---
 drivers/scsi/scsi_lib.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 6b0fccda9af2ee..1a2e9bab42efab 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -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;
-- 
2.28.0


  parent reply	other threads:[~2020-10-08 20:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 20:06 scsi regression fixes Christoph Hellwig
2020-10-08 20:06 ` [PATCH 1/2] sr: initialize ->cmd_len Christoph Hellwig
2020-10-09  6:36   ` Naresh Kamboju
2020-10-13 22:42   ` Martin K. Petersen
2020-10-08 20:06 ` Christoph Hellwig [this message]
2020-10-08 20:32 ` scsi regression fixes Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201008200611.1818099-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=cai@redhat.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=naresh.kamboju@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.