vhost: call destroy_device always in vhost_destroy_device_notify
Checks
Commit Message
Vhost-user client must send the mem table, kick fd, call fd on all vas,
then the device will be VIRTIO_DEV_RUNNING.
If the vhost-user communication is initialized partly, e.g.
- When initializing the vhost-user, try to restart the vhost-user
backend;
- Seabios only initialized the vhost-scsi req vq.
The device is not with flags VIRTIO_DEV_RUNNING..
Root Cause:
The vhost session has been created, and added the scsi/blk requestq
poller into reactor, but when destroying the device, the requestq is not
unregistered.
Reproduce the crash on spdk vhost-user backend:
1. Create a VM;
2. Mount a ISO to a VM, start the VM, don't install the OS;
3. Restart the spdk_tgt;
Another discusstion is in seabiso:
https://patchew.org/Seabios/20210831122339.2591585-1-fengli@smartx.com/
Signed-off-by: Li Feng <fengli@smartx.com>
---
lib/vhost/vhost.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -710,8 +710,8 @@ vhost_destroy_device_notify(struct virtio_net *dev)
if (vdpa_dev)
vdpa_dev->ops->dev_close(dev->vid);
dev->flags &= ~VIRTIO_DEV_RUNNING;
- dev->notify_ops->destroy_device(dev->vid);
}
+ dev->notify_ops->destroy_device(dev->vid);
}
/*