vhost: make destroy callback on reset owner message

QEMU sends VHOST_RESET_OWNER first when shutting down.
There was previously no way for the dataplane to know that the
virtio_net instance had become unusable and it would segfault
when trying to do RX/TX.

Signed-off-by: Rich Lane <rich.lane@bigswitch.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
This commit is contained in:
Rich Lane 2015-11-09 18:15:13 -08:00 committed by Thomas Monjalon
parent 50687c312a
commit d243ecf0c2

View File

@ -436,6 +436,9 @@ reset_owner(struct vhost_device_ctx ctx)
if (dev == NULL)
return -1;
if (dev->flags & VIRTIO_DEV_RUNNING)
notify_ops->destroy_device(dev);
device_fh = dev->device_fh;
cleanup_device(dev);
init_device(dev);