diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2019-07-02 10:23:20 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-07-15 11:20:42 +0200 |
commit | bdf9613b7f87248eb84884b0bdff94e8ad0eab9b (patch) | |
tree | d4317b6e2fda7ceea1fe3b95295c0b9cbc7c84c2 /hw | |
parent | d31347f5ff6c637a11245d244ff5449a94bf8256 (diff) |
scsi: explicitly list guest-recoverable sense codes
It's not really possible to fit all sense codes into errno codes,
especially in such a way that sense codes can be properly categorized as
either guest-recoverable or host-handled. Create a new function that
checks for guest recoverable sense, then scsi_sense_buf_to_errno only
needs to be called for host handled sense codes.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/scsi/scsi-disk.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 5d3fb3c9d5..8e95e3e38d 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -454,14 +454,13 @@ static bool scsi_handle_rw_error(SCSIDiskReq *r, int error, bool acct_failed) * pause the host. */ assert(r->status && *r->status); - error = scsi_sense_buf_to_errno(r->req.sense, sizeof(r->req.sense)); - if (error == ECANCELED || error == EAGAIN || error == ENOTCONN || - error == 0) { + 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)); break; case ENOMEDIUM: scsi_check_condition(r, SENSE_CODE(NO_MEDIUM)); |