From: Paolo Bonzini <pbonzini@redhat.com>
To: Hannes Reinecke <hare@suse.de>, qemu-devel@nongnu.org
Subject: Re: [PATCH] scsi-disk: convert more errno values back to SCSI statuses
Date: Fri, 13 Nov 2020 19:15:15 +0100 [thread overview]
Message-ID: <6f49b3e9-7a6d-6263-647e-343351e8678a@redhat.com> (raw)
In-Reply-To: <8c23f562-44aa-2cac-eabb-5eb6c2486d45@suse.de>
On 12/11/20 16:04, Hannes Reinecke wrote:
> On 11/12/20 10:52 AM, Paolo Bonzini wrote:
> Well, ironically I'm currently debugging a customer escalation which
> touches exactly this area. It revolves more around the SG_IO handling;
Technically this patch is for *non* passthrough, but yeah it's a similar
case.
> qemu ignores the host_status setting completely, leading to data
> corruption if the host has to abort commands. (Not that the host
> _does_ abort commands, as qemu SG_IO sets an infinite timeout. But
> that's another story).
> And part of the patchset is to enable passing of the host_status code
> back to the drivers. In particular virtio_scsi has a 'response' code
> which matches pretty closely to the linux SCSI DID_XXX codes.
Yeah, most of the time that's just because it's what can go wrong in
SCSI. Sometimes it's because I had no clue when writing the virtio-scsi
spec and just copied blindly from Linux. For example
VIRTIO_SCSI_S_NEXUS_FAILURE probably should have never existed, since
DID_NEXUS_FAILURE really should have been DID_RESRVATION_CONFLICT.
As an aside, I hate Linux host_status. It's never clear when looking at
the code if the statuses have been mapped back to BLK_STS codes or not,
so you don't know if you already have gotten rid of DID_TARGET_FAILURE,
DID_NEXUS_FAILURE, DID_ALLOC_FAILURE and DID_MEDIUM_ERROR (which are
just weird way to store the SCSI status or sense key for future use, and
not really "host statuses), and would really be a nexus failure only in
the rare case of path-specific reservations).
> So my idea is to pass the host_status directly down to the drivers,
> allowing virtio-scsi to do a mapping between DID_XX and virtio response
> codes.
But yeah, this is a good idea. But since I hate host_status, please
define your own enum instead of DID_*. Of course you can use the same
values as DID_* and assert with QEMU_BUILD_BUG_ON that they are the
same, but I don't want people to read the code and have to think of
DID_ALLOC_FAILURE and the like.
Paolo
prev parent reply other threads:[~2020-11-13 18:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 9:52 [PATCH] scsi-disk: convert more errno values back to SCSI statuses Paolo Bonzini
2020-11-12 15:04 ` Hannes Reinecke
2020-11-13 18:15 ` Paolo Bonzini [this message]
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=6f49b3e9-7a6d-6263-647e-343351e8678a@redhat.com \
--to=pbonzini@redhat.com \
--cc=hare@suse.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).