[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 4/9] scsi: clarify sense codes for LUN0 emulation
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 4/9] scsi: clarify sense codes for LUN0 emulation |
Date: |
Tue, 8 Aug 2017 17:29:36 +0200 |
From: Hannes Reinecke <address@hidden>
The LUN0 emulation is just that, an emulation for a non-existing
LUN0. So we should be returning LUN_NOT_SUPPORTED for any request
coming from any other LUN.
And we should be aborting unhandled commands with INVALID OPCODE,
not LUN NOT SUPPORTED.
Signed-off-by: Hannes Reinecke <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/scsi/scsi-bus.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 23c51de66a..e364410a23 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -517,6 +517,11 @@ static int32_t scsi_target_send_command(SCSIRequest *req,
uint8_t *buf)
{
SCSITargetReq *r = DO_UPCAST(SCSITargetReq, req, req);
+ if (req->lun != 0) {
+ scsi_req_build_sense(req, SENSE_CODE(LUN_NOT_SUPPORTED));
+ scsi_req_complete(req, CHECK_CONDITION);
+ return 0;
+ }
switch (buf[0]) {
case REPORT_LUNS:
if (!scsi_target_emulate_report_luns(r)) {
@@ -542,7 +547,7 @@ static int32_t scsi_target_send_command(SCSIRequest *req,
uint8_t *buf)
case TEST_UNIT_READY:
break;
default:
- scsi_req_build_sense(req, SENSE_CODE(LUN_NOT_SUPPORTED));
+ scsi_req_build_sense(req, SENSE_CODE(INVALID_OPCODE));
scsi_req_complete(req, CHECK_CONDITION);
return 0;
illegal_request:
--
2.13.3
- [Qemu-devel] [PULL 0/9] Misc patches for 2017-08-08, Paolo Bonzini, 2017/08/08
- [Qemu-devel] [PULL 1/9] rcu: completely disable pthread_atfork callbacks as soon as possible, Paolo Bonzini, 2017/08/08
- [Qemu-devel] [PULL 5/9] target/i386: set rip_offset for some SSE4.1 instructions, Paolo Bonzini, 2017/08/08
- [Qemu-devel] [PULL 6/9] qemu-img: Sort sub-command names in --help, Paolo Bonzini, 2017/08/08
- [Qemu-devel] [PULL 3/9] kvm: workaround build break on gcc-7.1.1 / fedora26, Paolo Bonzini, 2017/08/08
- [Qemu-devel] [PULL 4/9] scsi: clarify sense codes for LUN0 emulation,
Paolo Bonzini <=
- [Qemu-devel] [PULL 2/9] Revert "rcu: do not create thread in pthread_atfork callback", Paolo Bonzini, 2017/08/08
- [Qemu-devel] [PULL 7/9] qemu-io: Give more --version information, Paolo Bonzini, 2017/08/08
- [Qemu-devel] [PULL 8/9] qga: Give more --version information, Paolo Bonzini, 2017/08/08
- [Qemu-devel] [PULL 9/9] maint: Include bug-reporting info in --help output, Paolo Bonzini, 2017/08/08
- Re: [Qemu-devel] [PULL 0/9] Misc patches for 2017-08-08, Peter Maydell, 2017/08/08