patches for DPDK stable branches
 help / color / mirror / Atom feed
* Re: [dpdk-stable] [PATCH] net/vhost: fix unix socket not removed as closing
       [not found] <1485247058-85862-1-git-send-email-jianfeng.tan@intel.com>
@ 2017-01-30 13:21 ` Yuanhan Liu
  0 siblings, 0 replies; only message in thread
From: Yuanhan Liu @ 2017-01-30 13:21 UTC (permalink / raw)
  To: Jianfeng Tan; +Cc: dev, ciwillia, stable

On Tue, Jan 24, 2017 at 08:37:38AM +0000, Jianfeng Tan wrote:
> The commit aed0b12930b ("net/vhost: fix socket file deleted on stop")
> moves rte_vhost_driver_register and rte_vhost_driver_unregister from
> dev_start() and dev_stop() into driver's probe() and remove().
> 
> Apps, like testpmd, using vhost pmd in server mode, usually calls
> dev_stop() and dev_close() as quitting, instead of driver-specific
> remove(). Then those unix socket files have no chance to get removed.
> 
> Semantically, device-specific things should be put into device-specific
> APIs. Fix this issue by moving rte_vhost_driver_unregister, plus other
> structure free into dev_close().
> 
> Fixes: aed0b12930b3 ("net/vhost: fix socket file deleted on stop")

The original commit will be cherry-picked to v16.11 stable release,
as a fix commit of it, this commit should also be picked. So,

Cc: stable@dpdk.org

> 
> Reported-by: Lei Yao <lei.a.yao@intel.com>
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 48 +++++++++++++++++++++++----------------
>  1 file changed, 28 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index 848a3da..93b8a52 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -801,6 +801,32 @@ eth_dev_stop(struct rte_eth_dev *dev)
>  	update_queuing_status(dev);
>  }
>  
> +static void
> +eth_dev_close(struct rte_eth_dev *dev)
> +{
> +	struct pmd_internal *internal;
> +	struct internal_list *list;
> +
> +	internal = dev->data->dev_private;
> +	if (!internal)
> +		return;
> +
> +	list = find_internal_resource(internal->iface_name);
> +	if (!list)
> +		return;
> +
> +	pthread_mutex_lock(&internal_list_lock);
> +	TAILQ_REMOVE(&internal_list, list, next);
> +	pthread_mutex_unlock(&internal_list_lock);
> +	rte_free(list);
> +
> +	rte_vhost_driver_unregister(internal->iface_name);

Note that you should invoke rte_vhost_driver_unregister() before
removing "internal" from the list, otherwise you might get an error
like following from destory_device() callback (which will try to
find the "internal" again).

    PMD: Invalid interface name: /tmp/vhost-net

Fixed and applied to dpdk-next-virtio.

	--yliu

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-30 13:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1485247058-85862-1-git-send-email-jianfeng.tan@intel.com>
2017-01-30 13:21 ` [dpdk-stable] [PATCH] net/vhost: fix unix socket not removed as closing Yuanhan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).