From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 2/3] scsi: Enhance scsi_sense_to_errno
Date: Mon, 21 Aug 2017 19:11:08 +0800 [thread overview]
Message-ID: <20170821111108.GB4371@lemon> (raw)
In-Reply-To: <060c28df-bc84-01da-9c7b-2b47221f5311@redhat.com>
On Fri, 08/18 16:36, Paolo Bonzini wrote:
> On 18/08/2017 16:15, Fam Zheng wrote:
> > Two changes:
> >
> > 1) Look at asc/ascq for NOT_READY and DATA_PROTECT;
> > 2) Translate SPACE_ALLOC_FAILED as ENOSPC;
> >
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> > util/scsi.c | 7 +++----
> > 1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/util/scsi.c b/util/scsi.c
> > index 92ca436cd0..d42ce33449 100644
> > --- a/util/scsi.c
> > +++ b/util/scsi.c
> > @@ -18,13 +18,11 @@
> > int scsi_sense_to_errno(int key, int asc, int ascq)
> > {
> > switch (key) {
> > - case 0x02: /* SCSI_SENSE_NOT_READY */
> > - return EBUSY;
> > - case 0x07: /* SCSI_SENSE_DATA_PROTECTION */
> > - return EACCES;
> > case 0x0b: /* SCSI_SENSE_COMMAND_ABORTED */
> > return ECANCELED;
> > + case 0x02: /* SCSI_SENSE_NOT_READY */
> > case 0x05: /* SCSI_SENSE_ILLEGAL_REQUEST */
> > + case 0x07: /* SCSI_SENSE_DATA_PROTECTION */
> > /* Parse ASCQ */
> > break;
> > default:
>
> UNIT_ATTENTION should also be passed down to the guest without stopping
> the VM. Maybe map it to EAGAIN?
Or just 0?
>
> Looking at what Linux does:
>
> - RECOVERED_ERROR should just return 0
>
> - 0x0401 is "unit in the process of becoming ready", and it should also
> be EAGAIN
>
> - 0x0402 is "initializing command required", and probably can be fixed
> by the guest by scsi-block but not by iscsi so it should be its own
> errno, maybe ENOTCONN? (iscsi might try sending START STOP UNIT
> followed by a bunch of TEST UNIT READYs, see scsi_eh_try_stu in Linux's
> drivers/scsi/scsi_error.c).
These makes sense to me.
Fam
next prev parent reply other threads:[~2017-08-21 11:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 14:15 [Qemu-devel] [PATCH v3 0/3] scsi-block: Support werror/rerror Fam Zheng
2017-08-18 14:15 ` [Qemu-devel] [PATCH v3 1/3] scsi: Refactor scsi sense interpreting code Fam Zheng
2017-08-18 14:15 ` [Qemu-devel] [PATCH v3 2/3] scsi: Enhance scsi_sense_to_errno Fam Zheng
2017-08-18 14:36 ` Paolo Bonzini
2017-08-21 11:11 ` Fam Zheng [this message]
2017-08-21 11:30 ` Paolo Bonzini
2017-08-18 14:15 ` [Qemu-devel] [PATCH v3 3/3] scsi-block: Support rerror/werror Fam Zheng
2017-08-18 14:38 ` Paolo Bonzini
2017-08-18 14:39 ` [Qemu-devel] [PATCH v3 0/3] scsi-block: Support werror/rerror no-reply
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=20170821111108.GB4371@lemon \
--to=famz@redhat.com \
--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 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).