From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 5D379A0096 for ; Fri, 12 Apr 2019 06:40:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1C6EE4C93; Fri, 12 Apr 2019 06:40:18 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 2B8DE2B95; Fri, 12 Apr 2019 06:40:11 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Apr 2019 21:40:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,340,1549958400"; d="scan'208";a="135124702" Received: from dpdk-tbie.sh.intel.com ([10.67.104.173]) by orsmga006.jf.intel.com with ESMTP; 11 Apr 2019 21:40:05 -0700 Date: Fri, 12 Apr 2019 12:39:38 +0800 From: Tiwei Bie To: Ilya Maximets Cc: dev@dpdk.org, Maxime Coquelin , Jens Freimann , Dariusz Stojaczyk , David Marchand , stable@dpdk.org Message-ID: <20190412043938.GB15935@dpdk-tbie.sh.intel.com> References: <20190409133622.14729-1-i.maximets@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190409133622.14729-1-i.maximets@samsung.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-stable] [PATCH] vhost: fix passing destroyed device to destroy callback X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Tue, Apr 09, 2019 at 04:36:22PM +0300, Ilya Maximets wrote: > Application should be able to obtain information like 'ifname' from > the 'vid' passed to 'destroy_connection' callback. Currently, all the > API calls with passed 'vid' fails with 'device not found'. > > Fixes: efba12a78ddf ("vhost: add user callbacks for socket open/close") > Cc: stable@dpdk.org > > Signed-off-by: Ilya Maximets > --- > lib/librte_vhost/socket.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c > index 3da9de62c..43f091d10 100644 > --- a/lib/librte_vhost/socket.c > +++ b/lib/librte_vhost/socket.c > @@ -297,11 +297,12 @@ vhost_user_read_cb(int connfd, void *dat, int *remove) > if (ret < 0) { > close(connfd); > *remove = 1; > - vhost_destroy_device(conn->vid); > > if (vsocket->notify_ops->destroy_connection) > vsocket->notify_ops->destroy_connection(conn->vid); > > + vhost_destroy_device(conn->vid); By design, notify_ops->destroy_device() should be called before notify_ops->destroy_connection(). I.e. something like: vhost_destroy_device_notify(...); // device stop if (vsocket->notify_ops->destroy_connection) // socket close vsocket->notify_ops->destroy_connection(conn->vid); vhost_destroy_device(conn->vid); // free As destroy_device() callback means device stop (which also happens in e.g. GET_VRING_BASE). > + > pthread_mutex_lock(&vsocket->conn_mutex); > TAILQ_REMOVE(&vsocket->conn_list, conn, next); > pthread_mutex_unlock(&vsocket->conn_mutex); > -- > 2.17.1 >