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