提交 aa531fe9 编写于 作者: L Luo Jiaxing 提交者: Yang Yingliang

scsi: libsas: Set data_dir as DMA_NONE if libata marks qc as NODATA

mainline inclusion
from mainline-v5.9-rc5
commit 53de092f
category: bugfix
bugzilla: NA
CVE: NA

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

It was discovered that sdparm will fail when attempting to disable write
cache on a SATA disk connected via libsas.

In the ATA command set the write cache state is controlled through the SET
FEATURES operation. This is roughly corresponds to MODE SELECT in SCSI and
the latter command is what is used in the SCSI-ATA translation layer. A
subtle difference is that a MODE SELECT carries data whereas SET FEATURES
is defined as a non-data command in ATA.

Set the DMA data direction to DMA_NONE if the requested ATA command is
identified as non-data.

[mkp: commit desc]

Fixes: fa1c1e8f ("[SCSI] Add SATA support to libsas")
Link: https://lore.kernel.org/r/1598426666-54544-1-git-send-email-luojiaxing@huawei.comReviewed-by: NJohn Garry <john.garry@huawei.com>
Reviewed-by: NJason Yan <yanaijie@huawei.com>
Signed-off-by: NLuo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NJason Yan <yanaijie@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 881e5728
...@@ -223,7 +223,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) ...@@ -223,7 +223,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
task->num_scatter = si; task->num_scatter = si;
} }
task->data_dir = qc->dma_dir; if (qc->tf.protocol == ATA_PROT_NODATA)
task->data_dir = DMA_NONE;
else
task->data_dir = qc->dma_dir;
task->scatter = qc->sg; task->scatter = qc->sg;
task->ata_task.retry_count = 1; task->ata_task.retry_count = 1;
task->task_state_flags = SAS_TASK_STATE_PENDING; task->task_state_flags = SAS_TASK_STATE_PENDING;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册