qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] scsi-block: Add qdev error properties
Date: Fri, 18 Aug 2017 21:21:57 +0800	[thread overview]
Message-ID: <20170818132157.GD15392@lemon> (raw)
In-Reply-To: <39e28f27-c45c-b2a2-bb46-16b65f9d04f8@redhat.com>

On Fri, 08/18 08:41, Paolo Bonzini wrote:
> On 18/08/2017 05:38, Fam Zheng wrote:
> > On Thu, 08/17 16:23, Paolo Bonzini wrote:
> >>> +        if (scsi_sense_matches(r, SENSE_CODE(NO_MEDIUM))) {
> >>> +            error = ENOMEDIUM;
> >>> +        } else if (scsi_sense_matches(r, SENSE_CODE(TARGET_FAILURE))) {
> >>> +            error = ENOMEM;
> >>> +        } else if (scsi_sense_matches(r, SENSE_CODE(INVALID_FIELD))) {
> >>> +            error = EINVAL;
> >>> +        } else if (scsi_sense_matches(r, SENSE_CODE(SPACE_ALLOC_FAILED))) {
> >>> +            error = ENOSPC;
> >>> +        } else {
> >>> +            error = EIO;
> >>
> >> Nice touch :) and in fact the ENOSPC case is needed for correctness.
> >>
> > 
> > Offline you mentioned iscsi_translate_sense(). Makes sense to unify both. We can
> > create a util/scsi.c to move it there.
> > 
> > About the error/non-error condition, is it enough to add a check "status ==
> > CHECK_CONDITION"?
> 
> No, CHECK_CONDITION is for almost every error.
> 
> Of those in iscsi_translate_sense:
> 
> - DATA_PROTECTION should be an error
> 
> - COMMAND_ABORTED should be passed down
> 
> - of the various ILLEGAL_REQUEST cases, only ENOMEDIUM and ENOACCES
> should stop.  LBA out of range should never happen (see
> scsi_disk_dma_command).
> 
> - NOT_READY should also look at asc/ascq individually, like
> ILLEGAL_REQUEST, see below

And the same to DATA PROTECT.

> 
> Of those in your list above, these are missing in iscsi_translate_sense:
> 
> - SPACE_ALLOC_FAILED (which should stop the VM)
> 
> - NOT_READY should also look at asc/ascq individually, like
> ILLEGAL_REQUEST.  NO_MEDIUM is returning -EBUSY instead of -ENOMEDIUM.
> 
> Among other sense keys, MEDIUM_ERROR and HARDWARE_ERROR probably should
> stop the VM.

Thanks, I'll work on a new version.

Fam

      reply	other threads:[~2017-08-18 13:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-17 14:11 [Qemu-devel] [PATCH v2] scsi-block: Add qdev error properties Fam Zheng
2017-08-17 14:23 ` Paolo Bonzini
2017-08-18  3:38   ` Fam Zheng
2017-08-18  6:41     ` Paolo Bonzini
2017-08-18 13:21       ` Fam Zheng [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=20170818132157.GD15392@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).