DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Jianfeng Tan <jianfeng.tan@intel.com>
Cc: dev@dpdk.org, ciwillia@brocade.com, stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] net/vhost: fix unix socket not removed as closing
Date: Mon, 30 Jan 2017 21:21:52 +0800	[thread overview]
Message-ID: <20170130132152.GH20916@yliu-dev.sh.intel.com> (raw)
In-Reply-To: <1485247058-85862-1-git-send-email-jianfeng.tan@intel.com>

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

      reply	other threads:[~2017-01-30 13:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-24  8:37 Jianfeng Tan
2017-01-30 13:21 ` Yuanhan Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170130132152.GH20916@yliu-dev.sh.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=ciwillia@brocade.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).