qemu/hw/scsi
Kevin Wolf 61b6d9b749 scsi-disk: Apply error policy for host_status errors again
Originally, all failed SG_IO requests called scsi_handle_rw_error() to
apply the configured error policy. However, commit f3126d65, which was
supposed to be a mere refactoring for scsi-disk.c, broke this and
accidentally completed the SCSI request without considering the error
policy any more if the error was signalled in the host_status field.

Apart from the commit message not describing the change as intended,
errors indicated in host_status are also obviously backend errors and
not something the guest must deal with independently of the error
policy.

This behaviour means that some recoverable errors (such as a path error
in multipath configurations) were reported to the guest anyway, which
might not expect it and might consider its disk broken.

Make sure that we apply the error policy again for host_status errors,
too. This addresses an existing FIXME comment and allows us to remove
some comments warning that callbacks weren't always called. With this
fix, they are called in all cases again.

The return value passed to the request callback doesn't have more free
values that could be used to indicate host_status errors as well as SAM
status codes and negative errno. Store the value in the host_status
field of the SCSIRequest instead and use -ENODEV as the return value (if
a path hasn't been reachable for a while, blk_aio_ioctl() will return
-ENODEV instead of just setting host_status, so just reuse it here -
it's not necessarily entirely accurate, but it's as good as any errno).

Cc: qemu-stable@nongnu.org
Fixes: f3126d65b3 ('scsi: move host_status handling into SCSI drivers')
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20250407155949.44736-1-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-04-08 14:59:19 +02:00
..
emulation.c scsi-generic: avoid invalid access to struct when emulating block limits 2018-11-06 21:35:06 +01:00
esp-pci.c hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
esp.c hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
Kconfig hw/scsi: Introduce VHOST_SCSI_COMMON symbol in Kconfig 2023-06-23 02:54:44 -04:00
lsi53c895a.c hw/scsi/lsi53c895a: fix memory leak in lsi_scsi_realize() 2025-03-31 21:32:43 +02:00
megasas.c Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
meson.build hw/virtio: Build various target-agnostic objects just once 2023-06-23 02:54:44 -04:00
mfi.h hw/other: spelling fixes 2023-09-21 11:31:16 +03:00
mpi.h hw: Add support for LSI SAS1068 (mptsas) device 2016-02-09 15:45:26 +01:00
mptconfig.c nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
mptendian.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
mptsas.c Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
mptsas.h include/hw/pci: Split pci_device.h off pci.h 2023-01-08 01:54:22 -05:00
scsi-bus.c scsi: introduce requests_lock 2025-03-13 17:57:23 +01:00
scsi-disk.c scsi-disk: Apply error policy for host_status errors again 2025-04-08 14:59:19 +02:00
scsi-generic.c Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
spapr_vscsi.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
srp.h spapr-vscsi: add task management 2013-09-12 08:46:21 +02:00
trace-events hw/scsi/lsi53c895a: add timer to scripts processing 2024-03-08 15:51:21 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
vhost-scsi-common.c vhost-user-scsi: support reconnect to backend 2023-10-22 05:18:17 -04:00
vhost-scsi.c Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
vhost-user-scsi.c Accel & Exec patch queue 2024-12-21 11:07:00 -05:00
viosrp.h Updated the FSF address to <https://www.gnu.org/licenses/> 2023-02-27 09:15:39 +01:00
virtio-scsi-dataplane.c virtio-scsi: only expose cmd vqs via iothread-vq-mapping 2025-03-13 17:57:23 +01:00
virtio-scsi.c virtio-scsi: handle ctrl virtqueue in main loop 2025-03-13 17:57:23 +01:00
vmw_pvscsi.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
vmw_pvscsi.h scsi: VMWare PVSCSI paravirtual device implementation 2013-04-19 10:44:17 +02:00