Il 18/02/2014 13:45, Stefano Stabellini ha scritto:
Disk unplug: hw/ide/piix.c:pci_piix3_xen_ide_unplug (see the beginning
of the email :-P).
It is called by hw/xen/xen_platform.c:platform_fixed_ioport_writew, in
response to the guest writing to a magic ioport specifically to unplug
the emulated disk.
With this patch after the guest boots I can still access both xvda and
sda for the same disk, leading to fs corruptions.
Ok, the last paragraph is what I was missing.
So this is dc->unplug for the PIIX3 IDE device. Because PCI declares a
hotplug handler, dc->unplug is not called anymore.
But unlike other dc->unplug callbacks, pci_piix3_xen_ide_unplug doesn't
free the device, it just drops the disks underneath. I think the
simplest solution is to _not_ make it a dc->unplug callback at all, and
call pci_piix3_xen_ide_unplug from unplug_disks instead of qdev_unplug.
qdev_unplug means "ask guest to start unplug", which is not what Xen
wants to do here.
Paolo