[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 20/48] scsi-disk: catch write protection errors in UN
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 20/48] scsi-disk: catch write protection errors in UNMAP |
Date: |
Fri, 6 Dec 2013 17:36:19 +0100 |
From: Paolo Bonzini <address@hidden>
This is the same that is already done for WRITE SAME.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/scsi/scsi-disk.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 74e6a14..4138268 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -1543,6 +1543,7 @@ done:
static void scsi_disk_emulate_unmap(SCSIDiskReq *r, uint8_t *inbuf)
{
+ SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
uint8_t *p = inbuf;
int len = r->req.cmd.xfer;
UnmapCBData *data;
@@ -1560,6 +1561,11 @@ static void scsi_disk_emulate_unmap(SCSIDiskReq *r,
uint8_t *inbuf)
goto invalid_param_len;
}
+ if (bdrv_is_read_only(s->qdev.conf.bs)) {
+ scsi_check_condition(r, SENSE_CODE(WRITE_PROTECTED));
+ return;
+ }
+
data = g_new0(UnmapCBData, 1);
data->r = r;
data->inbuf = &p[8];
--
1.8.4.2
- [Qemu-devel] [PULL 10/48] vpc, vhdx: add get_info, (continued)
- [Qemu-devel] [PULL 10/48] vpc, vhdx: add get_info, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 11/48] block drivers: add discard/write_zeroes properties to bdrv_get_info implementation, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 12/48] block drivers: expose requirement for write same alignment from formats, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 15/48] block/iscsi: check WRITE SAME support differently depending on MAY_UNMAP, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 13/48] block/iscsi: remove .bdrv_has_zero_init, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 14/48] block/iscsi: updated copyright, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 16/48] raw-posix: implement write_zeroes with MAY_UNMAP for files, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 17/48] raw-posix: implement write_zeroes with MAY_UNMAP for block devices, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 18/48] raw-posix: add support for write_zeroes on XFS and block devices, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 19/48] qemu-iotests: 033 is fast, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 20/48] scsi-disk: catch write protection errors in UNMAP,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 21/48] scsi-disk: reject ANCHOR=1 for UNMAP and WRITE SAME commands, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 22/48] scsi-disk: correctly implement WRITE SAME, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 23/48] block: Close backing file early in bdrv_img_create, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 24/48] qcow2: Zero-initialise first cluster for new images, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 25/48] qemu-iotests: Add "-c <cache-mode>" option, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 26/48] qemu-iotests: Honour cache mode in iotests.py, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 27/48] qemu-iotests: Add _default_cache_mode and _supported_cache_modes, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 28/48] qemu-iotests: Change default cache mode to "writeback", Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 29/48] qemu-iotests: Clean up spaces in usage output, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 30/48] qemu-iotests: Split qcow2 only cases in 048, Stefan Hajnoczi, 2013/12/06