vhost: fix the coredump when perform live migration

QEMU will send SET_VRING_ADDR when perform live migration,
it's not correct to update the memory table while the device
is running.

Change-Id: I899d3a996355ab6aa69835d90da14a86f93240fa
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/420944
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Changpeng Liu 2018-08-01 10:52:18 +08:00 committed by Ben Walker
parent 1f0bff73df
commit 376be52bb0

View File

@ -364,21 +364,20 @@ vhost_user_set_vring_addr(struct virtio_net *dev, VhostUserMsg *msg)
struct vhost_virtqueue *vq;
uint64_t len;
if (dev->has_new_mem_table) {
vhost_setup_mem_table(dev);
dev->has_new_mem_table = 0;
}
if (dev->mem == NULL)
return -1;
/* Remove from the data plane. */
if (dev->flags & VIRTIO_DEV_RUNNING) {
dev->flags &= ~VIRTIO_DEV_RUNNING;
dev->notify_ops->destroy_device(dev->vid);
}
if (dev->has_new_mem_table) {
vhost_setup_mem_table(dev);
dev->has_new_mem_table = 0;
}
if (dev->mem == NULL)
return -1;
/* addr->index refers to the queue index. The txq 1, rxq is 0. */
vq = dev->virtqueue[msg->payload.addr.index];