]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
scsi: esp_scsi: Track residual for PIO transfers
authorFinn Thain <fthain@telegraphics.com.au>
Tue, 16 Oct 2018 05:31:25 +0000 (16:31 +1100)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:56:44 +0000 (19:56 -0600)
commitac9da72d259c35abb119e5af7845c9896df93821
treeed79c5f9493aee455ce1ce99e5480253bd2a69f4
parent59d01a4e7d5705d248c8d533fb485edf0639b5a8
scsi: esp_scsi: Track residual for PIO transfers

BugLink: https://bugs.launchpad.net/bugs/1836802
[ Upstream commit fd47d919d0c336e7c22862b51ee94927ffea227a ]

If a target disconnects during a PIO data transfer the command may fail
when the target reconnects:

scsi host1: DMA length is zero!
scsi host1: cur adr[04380000] len[00000000]

The scsi bus is then reset. This happens because the residual reached
zero before the transfer was completed.

The usual residual calculation relies on the Transfer Count registers.
That works for DMA transfers but not for PIO transfers. Fix the problem
by storing the PIO transfer residual and using that to correctly
calculate bytes_sent.

Fixes: 6fe07aaffbf0 ("[SCSI] m68k: new mac_esp scsi driver")
Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/scsi/esp_scsi.c
drivers/scsi/esp_scsi.h
drivers/scsi/mac_esp.c