scsi-disk: catch write protection errors in UNMAP
This is the same that is already done for WRITE SAME. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
e18d90c15b
commit
c5fd1fb038
|
@ -1543,6 +1543,7 @@ done:
|
||||||
|
|
||||||
static void scsi_disk_emulate_unmap(SCSIDiskReq *r, uint8_t *inbuf)
|
static void scsi_disk_emulate_unmap(SCSIDiskReq *r, uint8_t *inbuf)
|
||||||
{
|
{
|
||||||
|
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
|
||||||
uint8_t *p = inbuf;
|
uint8_t *p = inbuf;
|
||||||
int len = r->req.cmd.xfer;
|
int len = r->req.cmd.xfer;
|
||||||
UnmapCBData *data;
|
UnmapCBData *data;
|
||||||
|
@ -1560,6 +1561,11 @@ static void scsi_disk_emulate_unmap(SCSIDiskReq *r, uint8_t *inbuf)
|
||||||
goto invalid_param_len;
|
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 = g_new0(UnmapCBData, 1);
|
||||||
data->r = r;
|
data->r = r;
|
||||||
data->inbuf = &p[8];
|
data->inbuf = &p[8];
|
||||||
|
|
Loading…
Reference in a new issue