Re: [PATCH v2] scsi: libsas: Reset num_scatter if libata mark qc as NODATA

From: Martin K. Petersen
Date: Tue Apr 13 2021 - 01:48:21 EST


On Thu, 18 Mar 2021 15:56:32 -0700, Jolly Shah wrote:

> When the cache_type for the scsi device is changed, the scsi layer
> issues a MODE_SELECT command. The caching mode details are communicated
> via a request buffer associated with the scsi command with data
> direction set as DMA_TO_DEVICE (scsi_mode_select). When this command
> reaches the libata layer, as a part of generic initial setup, libata
> layer sets up the scatterlist for the command using the scsi command
> (ata_scsi_qc_new). This command is then translated by the libata layer
> into ATA_CMD_SET_FEATURES (ata_scsi_mode_select_xlat). The libata layer
> treats this as a non data command (ata_mselect_caching), since it only
> needs an ata taskfile to pass the caching on/off information to the
> device. It does not need the scatterlist that has been setup, so it does
> not perform dma_map_sg on the scatterlist (ata_qc_issue). Unfortunately,
> when this command reaches the libsas layer(sas_ata_qc_issue), libsas
> layer sees it as a non data command with a scatterlist. It cannot
> extract the correct dma length, since the scatterlist has not been
> mapped with dma_map_sg for a DMA operation. When this partially
> constructed SAS task reaches pm80xx LLDD, it results in below warning.
>
> [...]

Applied to 5.12/scsi-fixes, thanks!

[1/1] scsi: libsas: Reset num_scatter if libata mark qc as NODATA
https://git.kernel.org/mkp/scsi/c/176ddd89171d

--
Martin K. Petersen Oracle Linux Engineering