diff options
| author | Niklas Cassel <cassel@kernel.org> | 2026-09-29 10:25:04 +0200 |
|---|---|---|
| committer | Martin K. Petersen (Oracle) <mkp@kernel.org> | 2026-10-03 10:14:29 -0400 |
| commit | 7c000c4ad2c0a7b2da06ffe28f5a7489fc52ca2d (patch) | |
| tree | 8bd36f4c4f46d69207e138fb3f300de1581fbe0d /tools/lib/python/kdoc/python_version.py | |
| parent | 92feb036a2d33c7b78b8daa2384f5c70d6679a91 (diff) | |
| download | linux-next-7c000c4ad2c0a7b2da06ffe28f5a7489fc52ca2d.tar.gz linux-next-7c000c4ad2c0a7b2da06ffe28f5a7489fc52ca2d.zip | |
scsi: scsi_debug: Report the residual of a write
Documentation/scsi/scsi_mid_low_api.rst defines the residual as the length
of the data buffer less the number of bytes actually transferred, so a
write whose data buffer is larger than its transfer length leaves
one. resp_read_dt0() and resp_write_tape() report it, but the write paths
for a disk do not, so such a write completes with GOOD status and a
residual of zero while a READ of the same length into the same buffer
reports it correctly.
Report it in resp_write_dt0(), resp_write_scat() and resp_atomic_write().
resp_write_scat() differs twice over. Its data-out buffer also holds the
parameter list header and the LBA range descriptors, so what the command
consumed is sg_off rather than the bytes that the last range transferred;
and sg_off counts what was asked for rather than what was transferred, so
it can exceed the buffer and needs a guard. A command with no LBA range
descriptors or a buffer transfer length of zero transfers nothing, so the
whole buffer is residual. An error, real or injected, can end the command
after some ranges have been written, so the residual is reported on every
exit once the parameter list has been fetched.
Assisted-by: LLM
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20260929082456.857423-22-cassel@kernel.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
