|
|
ae23c9 |
From d186ce91950c1cd0d1ba354daca53a072390fb53 Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
ae23c9 |
Date: Thu, 20 Dec 2018 12:31:03 +0000
|
|
|
ae23c9 |
Subject: [PATCH 8/8] scsi-generic: do not do VPD emulation for sense other
|
|
|
ae23c9 |
than ILLEGAL_REQUEST
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
ae23c9 |
Message-id: <20181220123103.29579-9-pbonzini@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 83716
|
|
|
ae23c9 |
O-Subject: [PATCH 8/8] scsi-generic: do not do VPD emulation for sense other than ILLEGAL_REQUEST
|
|
|
ae23c9 |
Bugzilla: 1639957
|
|
|
ae23c9 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Pass other sense, such as UNIT_ATTENTION or BUSY, directly to the
|
|
|
ae23c9 |
guest.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Reported-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit 763c56872b08b98fde062a1feca003f200e7bd5c)
|
|
|
ae23c9 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
hw/scsi/scsi-generic.c | 8 +++++---
|
|
|
ae23c9 |
1 file changed, 5 insertions(+), 3 deletions(-)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
|
|
|
ae23c9 |
index f218cef..4ac53e4 100644
|
|
|
ae23c9 |
--- a/hw/scsi/scsi-generic.c
|
|
|
ae23c9 |
+++ b/hw/scsi/scsi-generic.c
|
|
|
ae23c9 |
@@ -247,7 +247,6 @@ static void scsi_read_complete(void * opaque, int ret)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
SCSIGenericReq *r = (SCSIGenericReq *)opaque;
|
|
|
ae23c9 |
SCSIDevice *s = r->req.dev;
|
|
|
ae23c9 |
- SCSISense sense;
|
|
|
ae23c9 |
int len;
|
|
|
ae23c9 |
|
|
|
ae23c9 |
assert(r->req.aiocb != NULL);
|
|
|
ae23c9 |
@@ -270,11 +269,14 @@ static void scsi_read_complete(void * opaque, int ret)
|
|
|
ae23c9 |
* resulted in sense error but would need emulation.
|
|
|
ae23c9 |
* In this case, emulate a valid VPD response.
|
|
|
ae23c9 |
*/
|
|
|
ae23c9 |
- if (s->needs_vpd_bl_emulation &&
|
|
|
ae23c9 |
+ if (s->needs_vpd_bl_emulation && ret == 0 &&
|
|
|
ae23c9 |
+ (r->io_header.driver_status & SG_ERR_DRIVER_SENSE) &&
|
|
|
ae23c9 |
r->req.cmd.buf[0] == INQUIRY &&
|
|
|
ae23c9 |
(r->req.cmd.buf[1] & 0x01) &&
|
|
|
ae23c9 |
r->req.cmd.buf[2] == 0xb0) {
|
|
|
ae23c9 |
- if (sg_io_sense_from_errno(-ret, &r->io_header, &sense)) {
|
|
|
ae23c9 |
+ SCSISense sense =
|
|
|
ae23c9 |
+ scsi_parse_sense_buf(r->req.sense, r->io_header.sb_len_wr);
|
|
|
ae23c9 |
+ if (sense.key == ILLEGAL_REQUEST) {
|
|
|
ae23c9 |
len = scsi_generic_emulate_block_limits(r, s);
|
|
|
ae23c9 |
/*
|
|
|
ae23c9 |
* No need to let scsi_read_complete go on and handle an
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|