scsi: target: core: Change the way target_xcopy_do_work() sets restiction on max I/O
authorAnastasia Kovaleva <a.kovaleva@yadro.com>
Mon, 14 Nov 2022 10:25:00 +0000 (13:25 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:19 +0000 (23:03 +0900)
commit87ee7227cce318c62ae022609b3a982c6e4f7dcf
tree0a87f70ffed9c5f29f6fd2c0a10228c330d3b6e2
parentf9361cf40b4d212213b13879ffff922647bedb07
scsi: target: core: Change the way target_xcopy_do_work() sets restiction on max I/O

[ Upstream commit 689d94ec208cfdf95101d99319cb4bdc5f55774d ]

To determine how many blocks sends in one command, the minimum value is
selected from the hw_max_sectors of both devices. In target_xcopy_do_work,
hw_max_sectors are used as blocks, not sectors; it also ignores the fact
that sectors can be of different sizes, for example 512 and 4096
bytes. Because of this, a number of blocks can be transmitted that the
device will not be able to accept.

Change the selection of max transmission size into bytes.

Reviewed-by: Konstantin Shelekhin <k.shelekhin@yadro.com>
Reviewed-by: Dmitriy Bogdanov <d.bogdanov@yadro.com>
Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com>
Link: https://lore.kernel.org/r/20221114102500.88892-4-a.kovaleva@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stable-dep-of: 395cee83d02d ("scsi: target: iscsit: Stop/wait on cmds during conn close")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/target/target_core_xcopy.c
drivers/target/target_core_xcopy.h