|
|
0a122b |
From 79d13d1e7d0934198a2774235b70f688aa5f433f Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
From: Fam Zheng <famz@redhat.com>
|
|
|
0a122b |
Date: Wed, 19 Mar 2014 05:33:13 +0100
|
|
|
0a122b |
Subject: [PATCH 1/2] scsi: Change scsi sense buf size to 252
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
0a122b |
Message-id: <1395207194-25330-2-git-send-email-famz@redhat.com>
|
|
|
0a122b |
Patchwork-id: 58139
|
|
|
0a122b |
O-Subject: [RHEL-7 qemu-kvm PATCH v2 1/2] scsi: Change scsi sense buf size to 252
|
|
|
0a122b |
Bugzilla: 1058173
|
|
|
0a122b |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1058173
|
|
|
0a122b |
Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7141744
|
|
|
0a122b |
|
|
|
0a122b |
Current buffer size fails the assersion check in like
|
|
|
0a122b |
|
|
|
0a122b |
hw/scsi/scsi-bus.c:1655: assert(req->sense_len <= sizeof(req->sense));
|
|
|
0a122b |
|
|
|
0a122b |
when backend (block/iscsi.c) returns more data then 96.
|
|
|
0a122b |
|
|
|
0a122b |
Exercise the core dump path by booting an Gentoo ISO with scsi-generic
|
|
|
0a122b |
device backed with iscsi (built with libiscsi 1.7.0):
|
|
|
0a122b |
|
|
|
0a122b |
x86_64-softmmu/qemu-system-x86_64 \
|
|
|
0a122b |
-drive file=iscsi://localhost:3260/iqn.foobar/0,if=none,id=drive-disk \
|
|
|
0a122b |
-device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x6 \
|
|
|
0a122b |
-device scsi-generic,drive=drive-disk,bus=scsi1.0,id=iscsi-disk \
|
|
|
0a122b |
-boot d \
|
|
|
0a122b |
-cdrom gentoo.iso
|
|
|
0a122b |
|
|
|
0a122b |
qemu-system-x86_64: hw/scsi/scsi-bus.c:1655: scsi_req_complete:
|
|
|
0a122b |
Assertion `req->sense_len <= sizeof(req->sense)' failed.
|
|
|
0a122b |
|
|
|
0a122b |
According to SPC-4, section 4.5.2.1, 252 is the limit of sense data. So
|
|
|
0a122b |
increase the value to fix it.
|
|
|
0a122b |
|
|
|
0a122b |
Also remove duplicated define for the macro.
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
0a122b |
Reviewed-by: Benoit Canet <benoit@irqsave.net>
|
|
|
0a122b |
Cc: qemu-stable@nongnu.org
|
|
|
0a122b |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
0a122b |
(cherry picked from commit c5f52875b980e54e6bebad6121c76863356e1d7f)
|
|
|
0a122b |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
hw/scsi/scsi-generic.c | 2 --
|
|
|
0a122b |
hw/scsi/spapr_vscsi.c | 1 -
|
|
|
0a122b |
include/hw/scsi/scsi.h | 2 +-
|
|
|
0a122b |
3 files changed, 1 insertion(+), 4 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
hw/scsi/scsi-generic.c | 2 --
|
|
|
0a122b |
hw/scsi/spapr_vscsi.c | 1 -
|
|
|
0a122b |
include/hw/scsi/scsi.h | 2 +-
|
|
|
0a122b |
3 files changed, 1 insertions(+), 4 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
|
|
|
0a122b |
index f08b64e..8d92e0d 100644
|
|
|
0a122b |
--- a/hw/scsi/scsi-generic.c
|
|
|
0a122b |
+++ b/hw/scsi/scsi-generic.c
|
|
|
0a122b |
@@ -37,8 +37,6 @@ do { fprintf(stderr, "scsi-generic: " fmt , ## __VA_ARGS__); } while (0)
|
|
|
0a122b |
#include <scsi/sg.h>
|
|
|
0a122b |
#include "block/scsi.h"
|
|
|
0a122b |
|
|
|
0a122b |
-#define SCSI_SENSE_BUF_SIZE 96
|
|
|
0a122b |
-
|
|
|
0a122b |
#define SG_ERR_DRIVER_TIMEOUT 0x06
|
|
|
0a122b |
#define SG_ERR_DRIVER_SENSE 0x08
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
|
|
|
0a122b |
index e8978bf..514ab88 100644
|
|
|
0a122b |
--- a/hw/scsi/spapr_vscsi.c
|
|
|
0a122b |
+++ b/hw/scsi/spapr_vscsi.c
|
|
|
0a122b |
@@ -60,7 +60,6 @@
|
|
|
0a122b |
#define VSCSI_MAX_SECTORS 4096
|
|
|
0a122b |
#define VSCSI_REQ_LIMIT 24
|
|
|
0a122b |
|
|
|
0a122b |
-#define SCSI_SENSE_BUF_SIZE 96
|
|
|
0a122b |
#define SRP_RSP_SENSE_DATA_LEN 18
|
|
|
0a122b |
|
|
|
0a122b |
typedef union vscsi_crq {
|
|
|
0a122b |
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
|
|
|
0a122b |
index 2eccb72..4a1de1b 100644
|
|
|
0a122b |
--- a/include/hw/scsi/scsi.h
|
|
|
0a122b |
+++ b/include/hw/scsi/scsi.h
|
|
|
0a122b |
@@ -31,7 +31,7 @@ typedef struct SCSISense {
|
|
|
0a122b |
uint8_t ascq;
|
|
|
0a122b |
} SCSISense;
|
|
|
0a122b |
|
|
|
0a122b |
-#define SCSI_SENSE_BUF_SIZE 96
|
|
|
0a122b |
+#define SCSI_SENSE_BUF_SIZE 252
|
|
|
0a122b |
|
|
|
0a122b |
struct SCSICommand {
|
|
|
0a122b |
uint8_t buf[SCSI_CMD_BUF_SIZE];
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.1
|
|
|
0a122b |
|