aboutsummaryrefslogtreecommitdiff
path: root/hw/ide/piix.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/ide/piix.c')
-rw-r--r--hw/ide/piix.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index c190fcaa3c..d5777fd0b3 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -179,6 +179,10 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
if (di != NULL && !di->media_cd) {
BlockBackend *blk = blk_by_legacy_dinfo(di);
DeviceState *ds = blk_get_attached_dev(blk);
+
+ blk_drain(blk);
+ blk_flush(blk);
+
if (ds) {
blk_detach_dev(blk, ds);
}