diff options
-rw-r--r-- | usr.sbin/bhyve/block_if.c | 2 | ||||
-rw-r--r-- | usr.sbin/bhyve/pci_ahci.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c index 23aad01..ceb48fe 100644 --- a/usr.sbin/bhyve/block_if.c +++ b/usr.sbin/bhyve/block_if.c @@ -230,6 +230,8 @@ blockif_proc(struct blockif_ctxt *bc, struct blockif_elem *be) case BOP_DELETE: if (!bc->bc_candelete) err = EOPNOTSUPP; + else if (bc->bc_rdonly) + err = EROFS; else if (bc->bc_ischr) { arg[0] = br->br_offset; arg[1] = br->br_iov[0].iov_len; diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c index 6a0af28..2303882 100644 --- a/usr.sbin/bhyve/pci_ahci.c +++ b/usr.sbin/bhyve/pci_ahci.c @@ -840,10 +840,11 @@ handle_identify(struct ahci_port *p, int slot, uint8_t *cfis) } else { uint16_t buf[256]; uint64_t sectors; - int sectsz, psectsz, psectoff, candelete; + int sectsz, psectsz, psectoff, candelete, ro; uint16_t cyl; uint8_t sech, heads; + ro = blockif_is_ro(p->bctx); candelete = blockif_candelete(p->bctx); sectsz = blockif_sectsz(p->bctx); sectors = blockif_size(p->bctx) / sectsz; @@ -906,7 +907,7 @@ handle_identify(struct ahci_port *p, int slot, uint8_t *cfis) buf[101] = (sectors >> 16); buf[102] = (sectors >> 32); buf[103] = (sectors >> 48); - if (candelete) { + if (candelete && !ro) { buf[69] |= ATA_SUPPORT_RZAT | ATA_SUPPORT_DRAT; buf[105] = 1; buf[169] = ATA_SUPPORT_DSM_TRIM; |