From: Tomasz Kulasek Date: Fri, 9 Feb 2018 17:10:00 +0000 (+0100) Subject: vhost: fix device cleanup at stop X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ace7b6b7859e1dc410589610a8e436c1a3b430f3;p=dpdk.git vhost: fix device cleanup at stop This prevents from destroying & recreating user device in "incomplete" vring state. virtio_is_ready() was returning true for devices with vrings which did not have valid callfd (their VHOST_USER_SET_VRING_CALL hasn't arrived yet) Fixes: 8f972312b8f4 ("vhost: support vhost-user") Cc: stable@dpdk.org Signed-off-by: Dariusz Stojaczyk Signed-off-by: Tomasz Kulasek Reviewed-by: Jianfeng Tan Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index d34fdc8036..b4bd0f4703 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -941,6 +941,11 @@ vhost_user_get_vring_base(struct virtio_net *dev, vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; + if (vq->callfd >= 0) + close(vq->callfd); + + vq->callfd = VIRTIO_UNINITIALIZED_EVENTFD; + if (dev->dequeue_zero_copy) free_zmbufs(vq); rte_free(vq->shadow_used_ring);