mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-19 05:58:35 -07:00
The unrealize functions of the various vhost-user devices are
calling the corresponding vhost_*_set_status() functions with a
status of 0 to shut down the device correctly.
Now these vhost_*_set_status() functions all follow this scheme:
bool should_start = virtio_device_should_start(vdev, status);
if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
return;
}
if (should_start) {
/* ... do the initialization stuff ... */
} else {
/* ... do the cleanup stuff ... */
}
The problem here is virtio_device_should_start(vdev, 0) currently
always returns "true" since it internally only looks at vdev->started
instead of looking at the "status" parameter. Thus once the device
got started once, virtio_device_should_start() always returns true
and thus the vhost_*_set_status() functions return early, without
ever doing any clean-up when being called with status == 0. This
causes e.g. problems when trying to hot-plug and hot-unplug a vhost
user devices multiple times since the de-initialization step is
completely skipped during the unplug operation.
This bug has been introduced in commit
|
||
|---|---|---|
| .. | ||
| vdpa-dev.h | ||
| vhost-backend.h | ||
| vhost-scsi-common.h | ||
| vhost-scsi.h | ||
| vhost-user-base.h | ||
| vhost-user-blk.h | ||
| vhost-user-fs.h | ||
| vhost-user-gpio.h | ||
| vhost-user-i2c.h | ||
| vhost-user-rng.h | ||
| vhost-user-scmi.h | ||
| vhost-user-scsi.h | ||
| vhost-user-snd.h | ||
| vhost-user-vsock.h | ||
| vhost-user.h | ||
| vhost-vdpa.h | ||
| vhost-vsock-common.h | ||
| vhost-vsock.h | ||
| vhost.h | ||
| virtio-access.h | ||
| virtio-acpi.h | ||
| virtio-balloon.h | ||
| virtio-blk-common.h | ||
| virtio-blk.h | ||
| virtio-bus.h | ||
| virtio-crypto.h | ||
| virtio-dmabuf.h | ||
| virtio-gpu-bswap.h | ||
| virtio-gpu-pci.h | ||
| virtio-gpu-pixman.h | ||
| virtio-gpu.h | ||
| virtio-input.h | ||
| virtio-iommu.h | ||
| virtio-md-pci.h | ||
| virtio-mem.h | ||
| virtio-mmio.h | ||
| virtio-net.h | ||
| virtio-pci.h | ||
| virtio-pmem.h | ||
| virtio-rng.h | ||
| virtio-scsi.h | ||
| virtio-serial.h | ||
| virtio.h | ||