On Thu, Nov 19, 2015 at 06:07:00PM +0900, Tetsuya Mukawa wrote: > The patch fixes reset_owner message handling not to clear callfd, > because callfd will be valid while connection is establihed. > > Signed-off-by: Tetsuya Mukawa <mukawa at igel.co.jp> .... > > /* > @@ -467,6 +486,7 @@ static int > reset_owner(struct vhost_device_ctx ctx) > { > struct virtio_net *dev; > + uint32_t i; > > dev = get_device(ctx); > if (dev == NULL) > @@ -475,7 +495,19 @@ reset_owner(struct vhost_device_ctx ctx) > if (dev->flags & VIRTIO_DEV_RUNNING) > notify_destroy_device(dev); > > - cleanup_device(dev);
I would suggest to introduce the destory flag to cleanup_device() as well, so that we don't have to unfold the cleanup_device code here. (BTW, I should've reviewed this patch this morning, but I was busy). --yliu > + /* Unmap QEMU memory file if mapped. */ > + if (dev->mem) { > + munmap((void *)(uintptr_t)dev->mem->mapped_address, > + (size_t)dev->mem->mapped_size); > + free(dev->mem); > + dev->mem = NULL; > + } > + > + for (i = 0; i < dev->virt_qp_nb; i++) { > + cleanup_vq(dev->virtqueue[i * VIRTIO_QNUM + VIRTIO_RXQ], 0); > + cleanup_vq(dev->virtqueue[i * VIRTIO_QNUM + VIRTIO_TXQ], 0); > + } > + > reset_device(dev); > return 0; > } > -- > 2.1.4