summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2015-08-03 13:56:57 +0000
committerMichael Roth <mdroth@linux.vnet.ibm.com>2015-08-04 12:25:11 -0500
commitc8bd74d1d509df5dd1afc6b79413f148f2889692 (patch)
tree25f3ae8538f7a53b5e5061c164ec171f05e8ef1a
parentd1557697fd9efd052ba4289a8da4e35f78431537 (diff)
downloadqemu-c8bd74d1d509df5dd1afc6b79413f148f2889692.tar.gz
Fix release_drive on unplugged devices (pci_piix3_xen_ide_unplug)
pci_piix3_xen_ide_unplug should completely unhook the unplugged IDEDevice from the corresponding BlockBackend, otherwise the next call to release_drive will try to detach the drive again. Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> (cherry picked from commit 6cd387833d05e8ad31829d97e474dc420625aed9) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r--hw/ide/piix.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index adb664957c..5a26c86a8a 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -169,6 +169,7 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
PCIIDEState *pci_ide;
DriveInfo *di;
int i;
+ IDEDevice *idedev;
pci_ide = PCI_IDE(dev);
@@ -181,6 +182,12 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
blk_detach_dev(blk, ds);
}
pci_ide->bus[di->bus].ifs[di->unit].blk = NULL;
+ if (!(i % 2)) {
+ idedev = pci_ide->bus[di->bus].master;
+ } else {
+ idedev = pci_ide->bus[di->bus].slave;
+ }
+ idedev->conf.blk = NULL;
blk_unref(blk);
}
}