From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 457CC2E8A; Mon, 30 Jan 2017 14:19:29 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP; 30 Jan 2017 05:19:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,311,1477983600"; d="scan'208";a="219261966" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by fmsmga004.fm.intel.com with ESMTP; 30 Jan 2017 05:19:27 -0800 Date: Mon, 30 Jan 2017 21:21:52 +0800 From: Yuanhan Liu To: Jianfeng Tan Cc: dev@dpdk.org, ciwillia@brocade.com, stable@dpdk.org Message-ID: <20170130132152.GH20916@yliu-dev.sh.intel.com> References: <1485247058-85862-1-git-send-email-jianfeng.tan@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1485247058-85862-1-git-send-email-jianfeng.tan@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH] net/vhost: fix unix socket not removed as closing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2017 13:19:31 -0000 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 > Signed-off-by: Jianfeng Tan > --- > 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