|
|
9ae3a8 |
From 25760de201dc5c29d171fc4ae4f34d6eaabbdad6 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <25760de201dc5c29d171fc4ae4f34d6eaabbdad6.1389014116.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 9 Dec 2013 14:09:23 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 35/50] scsi-disk: catch write protection errors in UNMAP
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1386598178-11845-38-git-send-email-pbonzini@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56074
|
|
|
9ae3a8 |
O-Subject: [RHEL 7.0 qemu-kvm PATCH 37/52] scsi-disk: catch write protection errors in UNMAP
|
|
|
9ae3a8 |
Bugzilla: 1007815
|
|
|
9ae3a8 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This is the same that is already done for WRITE SAME.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit c5fd1fb038405ed13496761970b3b531f747a892)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/scsi/scsi-disk.c | 6 ++++++
|
|
|
9ae3a8 |
1 file changed, 6 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/scsi/scsi-disk.c | 6 ++++++
|
|
|
9ae3a8 |
1 file changed, 6 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
|
|
|
9ae3a8 |
index 74e6a14..4138268 100644
|
|
|
9ae3a8 |
--- a/hw/scsi/scsi-disk.c
|
|
|
9ae3a8 |
+++ b/hw/scsi/scsi-disk.c
|
|
|
9ae3a8 |
@@ -1543,6 +1543,7 @@ done:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void scsi_disk_emulate_unmap(SCSIDiskReq *r, uint8_t *inbuf)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
+ SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
|
|
|
9ae3a8 |
uint8_t *p = inbuf;
|
|
|
9ae3a8 |
int len = r->req.cmd.xfer;
|
|
|
9ae3a8 |
UnmapCBData *data;
|
|
|
9ae3a8 |
@@ -1560,6 +1561,11 @@ static void scsi_disk_emulate_unmap(SCSIDiskReq *r, uint8_t *inbuf)
|
|
|
9ae3a8 |
goto invalid_param_len;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ if (bdrv_is_read_only(s->qdev.conf.bs)) {
|
|
|
9ae3a8 |
+ scsi_check_condition(r, SENSE_CODE(WRITE_PROTECTED));
|
|
|
9ae3a8 |
+ return;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
data = g_new0(UnmapCBData, 1);
|
|
|
9ae3a8 |
data->r = r;
|
|
|
9ae3a8 |
data->inbuf = &p[8];
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|