提交 353f54c1 编写于 作者: D Damien Le Moal 提交者: Zheng Zengkai

scsi: libsas: Fix sas_ata_qc_issue() handling of NCQ NON DATA commands

stable inclusion
from stable-v5.10.110
commit aa28075f06b821a7988053cb9b77edc0c9ea4f0d
bugzilla: https://gitee.com/openeuler/kernel/issues/I574AL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=aa28075f06b821a7988053cb9b77edc0c9ea4f0d

--------------------------------

commit 8454563e upstream.

To detect for the DMA_NONE (no data transfer) DMA direction,
sas_ata_qc_issue() tests if the command protocol is ATA_PROT_NODATA.  This
test does not include the ATA_CMD_NCQ_NON_DATA command as this command
protocol is defined as ATA_PROT_NCQ_NODATA (equal to ATA_PROT_FLAG_NCQ) and
not as ATA_PROT_NODATA.

To include both NCQ and non-NCQ commands when testing for the DMA_NONE DMA
direction, use "!ata_is_data()".

Link: https://lore.kernel.org/r/20220220031810.738362-2-damien.lemoal@opensource.wdc.com
Fixes: 176ddd89 ("scsi: libsas: Reset num_scatter if libata marks qc as NODATA")
Cc: stable@vger.kernel.org
Reviewed-by: NJohn Garry <john.garry@huawei.com>
Reviewed-by: NJack Wang <jinpu.wang@ionos.com>
Signed-off-by: NDamien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 33c02831
...@@ -203,7 +203,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) ...@@ -203,7 +203,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
task->total_xfer_len = qc->nbytes; task->total_xfer_len = qc->nbytes;
task->num_scatter = qc->n_elem; task->num_scatter = qc->n_elem;
task->data_dir = qc->dma_dir; task->data_dir = qc->dma_dir;
} else if (qc->tf.protocol == ATA_PROT_NODATA) { } else if (!ata_is_data(qc->tf.protocol)) {
task->data_dir = DMA_NONE; task->data_dir = DMA_NONE;
} else { } else {
for_each_sg(qc->sg, sg, qc->n_elem, si) for_each_sg(qc->sg, sg, qc->n_elem, si)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册