File hw-scsi-scsi-generic-Fixup-VPD-block-lim.patch of Package qemu.28164
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 26 Oct 2022 12:31:21 +0200
Subject: hw/scsi/scsi-generic: Fixup VPD block limits emulation
Move the check for SG_IO errors after the VPD block limits emulation,
otherwise the emulation will never the triggered.
References: bsc#1202364
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
hw/scsi/scsi-generic.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index e48cc7818d9104a741a93480f382..cdacb111dfa4d63444915c79b1c4 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -268,10 +268,7 @@ static void scsi_read_complete(void * opaque, int ret)
aio_context_acquire(blk_get_aio_context(s->conf.blk));
- if (ret || r->req.io_canceled ||
- r->io_header.status ||
- r->io_header.driver_status ||
- r->io_header.host_status) {
+ if (ret || r->req.io_canceled) {
scsi_command_complete_noio(r, ret);
goto done;
}
@@ -307,7 +304,9 @@ static void scsi_read_complete(void * opaque, int ret)
}
}
- if (len == 0) {
+ if (len == 0 || r->io_header.status ||
+ r->io_header.driver_status ||
+ r->io_header.host_status) {
scsi_command_complete_noio(r, 0);
goto done;
}
@@ -385,10 +384,7 @@ static void scsi_write_complete(void * opaque, int ret)
aio_context_acquire(blk_get_aio_context(s->conf.blk));
- if (ret || r->req.io_canceled ||
- r->io_header.status ||
- r->io_header.driver_status ||
- r->io_header.host_status) {
+ if (ret || r->req.io_canceled) {
scsi_command_complete_noio(r, ret);
goto done;
}