From: Hannes Reinecke <hare@suse.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Hannes Reinecke <hare@suse.de>
Subject: [PATCH 0/7] scsi: scsi-disk corrupts data
Date: Mon, 16 Nov 2020 19:40:34 +0100 [thread overview]
Message-ID: <20201116184041.60465-1-hare@suse.de> (raw)
Hi all,
a customer of ours reported repeated data corruption in the guest following a command abort.
After lengthy debugging we found that scsi-disk (and scsi-generic, for that matter) ignores
the host_status field from SG_IO once a command is aborted. If the command is aborted, SG_IO
will return with a SCSI status 'GOOD', and host_status 'DID_TIME_OUT'. scsi-disk will now
ignore the DID_TIME_OUT setting, and just report the SCSI status back to the guest.
The guest will then assume everything is okay and not retry the command, leading to the data
corruption.
This patchset moves the (linux only) SG_ERR host_status codes to generic code as SCSI_HOST
values, and adds a host_status field to SCSIRequest. With that some drivers like virtio_scsi
can interpret the host_status code and map it onto it driver-specific status.
This status is then visible to the guest, which then is able to take appropriate action.
As usual, comments and reviews are welcome.
Hannes Reinecke (6):
scsi-disk: Add sg_io callback to evaluate status
scsi: drop 'result' argument from command_complete callback
scsi: Rename linux-specific SG_ERR codes to generic SCSI_HOST error
codes
scsi: Add mapping for generic SCSI_HOST status to sense codes
scsi: split sg_io_sense_from_errno() in two functions
scsi: move host_status handling into SCSI drivers
Paolo Bonzini (1):
scsi-disk: convert more errno values back to SCSI statuses
hw/scsi/esp-pci.c | 5 +--
hw/scsi/esp.c | 17 +++++--
hw/scsi/lsi53c895a.c | 17 +++++--
hw/scsi/megasas.c | 15 +++++--
hw/scsi/mptsas.c | 14 +++++-
hw/scsi/scsi-bus.c | 2 +-
hw/scsi/scsi-disk.c | 75 ++++++++++++++++++++-----------
hw/scsi/scsi-generic.c | 21 ++++++---
hw/scsi/spapr_vscsi.c | 20 ++++++---
hw/scsi/virtio-scsi.c | 44 ++++++++++++++++--
hw/scsi/vmw_pvscsi.c | 29 +++++++++++-
hw/usb/dev-storage.c | 6 +--
hw/usb/dev-uas.c | 7 ++-
include/hw/scsi/esp.h | 2 +-
include/hw/scsi/scsi.h | 5 ++-
include/scsi/utils.h | 29 +++++++-----
scsi/qemu-pr-helper.c | 14 ++++--
scsi/utils.c | 119 ++++++++++++++++++++++++++++++++++++-------------
18 files changed, 328 insertions(+), 113 deletions(-)
--
2.16.4
next reply other threads:[~2020-11-16 18:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-16 18:40 Hannes Reinecke [this message]
2020-11-16 18:40 ` [PATCH 1/7] scsi-disk: Add sg_io callback to evaluate status Hannes Reinecke
2020-11-16 18:40 ` [PATCH 2/7] scsi: drop 'result' argument from command_complete callback Hannes Reinecke
2020-11-16 18:40 ` [PATCH 3/7] scsi-disk: convert more errno values back to SCSI statuses Hannes Reinecke
2020-11-16 18:40 ` [PATCH 4/7] scsi: Rename linux-specific SG_ERR codes to generic SCSI_HOST error codes Hannes Reinecke
2020-11-16 18:40 ` [PATCH 5/7] scsi: Add mapping for generic SCSI_HOST status to sense codes Hannes Reinecke
2020-11-16 18:57 ` Paolo Bonzini
2020-11-16 19:03 ` Hannes Reinecke
2020-11-16 20:05 ` Paolo Bonzini
2020-11-17 6:53 ` Hannes Reinecke
2020-11-16 18:40 ` [PATCH 6/7] scsi: split sg_io_sense_from_errno() in two functions Hannes Reinecke
2020-11-16 18:40 ` [PATCH 7/7] scsi: move host_status handling into SCSI drivers Hannes Reinecke
2020-11-16 18:58 ` Paolo Bonzini
2020-11-16 19:05 ` Hannes Reinecke
2020-11-16 22:00 ` Paolo Bonzini
2020-11-17 6:55 ` Hannes Reinecke
2020-11-17 7:38 ` Paolo Bonzini
2020-11-17 8:50 ` Hannes Reinecke
2020-11-17 11:10 ` Paolo Bonzini
2020-12-17 10:07 ` [PATCH 0/7] scsi: scsi-disk corrupts data Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201116184041.60465-1-hare@suse.de \
--to=hare@suse.de \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.