From: Paolo Bonzini <pbonzini@redhat.com>
To: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
Alistair Francis <alistair23@gmail.com>
Cc: "fam@euphon.net" <fam@euphon.net>,
Alistair Francis <Alistair.Francis@wdc.com>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v1 1/1] hw/scsi: Report errors and sense to guests through scsi-block
Date: Tue, 2 Jul 2019 12:22:55 +0200 [thread overview]
Message-ID: <5a741004-fc88-f31a-2abf-70f4a9b0d5a9@redhat.com> (raw)
In-Reply-To: <CY1PR04MB22683409CB203BF5042697FBEDF80@CY1PR04MB2268.namprd04.prod.outlook.com>
On 02/07/19 08:44, Shinichiro Kawasaki wrote:
> On 7/1/19 8:56 PM, Paolo Bonzini wrote:
>> On 01/07/19 12:14, Shinichiro Kawasaki wrote:
>>> I observe four of them listed below in sense data,
>>> when I ran basic operations to the zoned storage from the guest via scsi-block.
>>>
>>> 21h 04h: UNALIGNED WRITE COMMAND
>>> 21h 05h: WRITE BOUNDARY VIOLATION
>>> 21h 06h: ATTEMPT TO READ INVALID DATA
>>> 55h 0Eh: INSUFFICIENT ZONE RESOURCES
>>>
>>> These ASCs can be reported for write or read commands due to unexpected zone
>>> status or write pointer status. Reporting these ASCs to the guest, the user
>>> applications can handle them to manage zone/write pointer status, or help the
>>> user application developers to understand the failure reason and fix bugs.
>>>
>>> I took a look in scsi_sense_to_errno() and learned that ASCs are grouped in
>>> errnos. To report the ASCs above to the guest, is it good to add them in EINVAL
>>> group defined in scsi_sense_to_errno()? The ASCs are reported with sense key
>>> ILLEGAL_REQUEST or DATA_PROTECT, then I think it fits in the function.
>>
>> The grouping by errno is historical and pretty much broken. It should
>> be possible to change it to return just a bool.
>
> The errno grouping of scsi_sense_to_errno() is used not only by scsi-disk but
> also by block/iscsi for error reporting. Can we avoid errno grouping for iscsi also?
No, but we can do something like
if (scsi_sense_buf_is_guest_recoverable(r->req.sense,
sizeof(r->req.sense))) {
/* These errors are handled by guest. */
sdc->update_sense(&r->req);
scsi_req_complete(&r->req, *r->status);
return true;
}
error = scsi_sense_buf_to_errno(r->req.sense, sizeof(r->req.sense));
This way there's generally no need to shoehorn ASC codes into errno. I
still have to test my changes, but I hope to send something within a
couple of days.
Paolo
next prev parent reply other threads:[~2019-07-02 10:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-26 22:46 [Qemu-devel] [PATCH v1 1/1] hw/scsi: Report errors and sense to guests through scsi-block Alistair Francis
2019-06-27 9:01 ` Paolo Bonzini
2019-06-28 21:57 ` Alistair Francis
2019-06-28 22:14 ` Paolo Bonzini
2019-06-28 22:18 ` Alistair Francis
2019-07-01 10:14 ` Shinichiro Kawasaki
2019-07-01 11:56 ` Paolo Bonzini
2019-07-02 6:44 ` Shinichiro Kawasaki
2019-07-02 10:22 ` Paolo Bonzini [this message]
2019-07-05 10:31 ` Shinichiro Kawasaki
2019-07-05 17:08 ` Paolo Bonzini
2019-07-09 8:27 ` Shinichiro Kawasaki
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=5a741004-fc88-f31a-2abf-70f4a9b0d5a9@redhat.com \
--to=pbonzini@redhat.com \
--cc=Alistair.Francis@wdc.com \
--cc=alistair23@gmail.com \
--cc=fam@euphon.net \
--cc=qemu-devel@nongnu.org \
--cc=shinichiro.kawasaki@wdc.com \
/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).