* [Qemu-devel] [PATCH] scsi: report thin provisioning errors with werror=report
@ 2014-01-27 13:08 Paolo Bonzini
2014-01-28 12:07 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2014-01-27 13:08 UTC (permalink / raw)
To: qemu-devel
SCSI defines a status code for when a thin-provisioned LUNs would
exceed the allocated space, map ENOSPC to it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/scsi/scsi-bus.c | 5 +++++
hw/scsi/scsi-disk.c | 3 +++
include/hw/scsi/scsi.h | 2 ++
3 files changed, 10 insertions(+)
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 50b89ad..054a7d4 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -1367,6 +1367,11 @@ const struct SCSISense sense_code_WRITE_PROTECTED = {
.key = DATA_PROTECT, .asc = 0x27, .ascq = 0x00
};
+/* Data Protection, Space Allocation Failed Write Protect */
+const struct SCSISense sense_code_SPACE_ALLOC_FAILED = {
+ .key = DATA_PROTECT, .asc = 0x27, .ascq = 0x07
+};
+
/*
* scsi_build_sense
*
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index a8d0f15..24621f4 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -428,6 +428,9 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int error)
case EINVAL:
scsi_check_condition(r, SENSE_CODE(INVALID_FIELD));
break;
+ case ENOSPC:
+ scsi_check_condition(r, SENSE_CODE(SPACE_ALLOC_FAILED));
+ break;
default:
scsi_check_condition(r, SENSE_CODE(IO_ERROR));
break;
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
index bf6da3d..89e8759 100644
--- a/include/hw/scsi/scsi.h
+++ b/include/hw/scsi/scsi.h
@@ -223,6 +223,8 @@ extern const struct SCSISense sense_code_REPORTED_LUNS_CHANGED;
extern const struct SCSISense sense_code_DEVICE_INTERNAL_RESET;
/* Data Protection, Write Protected */
extern const struct SCSISense sense_code_WRITE_PROTECTED;
+/* Data Protection, Space Allocation Failed Write Protect */
+extern const struct SCSISense sense_code_SPACE_ALLOC_FAILED;
#define SENSE_CODE(x) sense_code_ ## x
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] scsi: report thin provisioning errors with werror=report
2014-01-27 13:08 [Qemu-devel] [PATCH] scsi: report thin provisioning errors with werror=report Paolo Bonzini
@ 2014-01-28 12:07 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2014-01-28 12:07 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On Mon, Jan 27, 2014 at 02:08:56PM +0100, Paolo Bonzini wrote:
> SCSI defines a status code for when a thin-provisioned LUNs would
> exceed the allocated space, map ENOSPC to it.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/scsi/scsi-bus.c | 5 +++++
> hw/scsi/scsi-disk.c | 3 +++
> include/hw/scsi/scsi.h | 2 ++
> 3 files changed, 10 insertions(+)
The SBC confirms that SPACE ALLOCATION WRITE PROTECT is used when there
is no space.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-28 12:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-27 13:08 [Qemu-devel] [PATCH] scsi: report thin provisioning errors with werror=report Paolo Bonzini
2014-01-28 12:07 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).