From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-f68.google.com (mail-vs1-f68.google.com [209.85.217.68]) by dpdk.org (Postfix) with ESMTP id 77A0C58C6 for ; Wed, 10 Apr 2019 09:24:55 +0200 (CEST) Received: by mail-vs1-f68.google.com with SMTP id g127so770103vsd.6 for ; Wed, 10 Apr 2019 00:24:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=h5BmA4zjHK5PlJg/obCYJjNy4HoPlFKyZm16/5aG2xw=; b=sdx7OioleTzWTHW2I7jXuaBuJBQmZyFl0sL0tp2b+wGRto9G3/FtBeV+x8OrbWKwNh cWANOTjwlxQxGrDdSfEzjzKExHaW90zDsF1yfItClnLlr1VV0G1wpXEe61nbpo6cXcDM FJXq+UvnGQVtUweIrnuSUTOH++xJmS3jtfjAbGuPeG/D64ubX/S5faE/61HPMYeNjdto 6hRJ4yESBYZlXmT63XoWGKnMd7S8rETuTLo/FmEbXZlTYxJnhH5/4KkIBCzhvVM5Rq19 M2ztgRH5up3xQjwW/zc8jynt5P1Uwe6QKExptb0/2yiade2y1VhMYbsFW9DDpQPoju+n IBhA== X-Gm-Message-State: APjAAAV4QFqA8YywAMYEMRKVjErGuTgddXDwO/JCjviLR5ATUUVooCTa 4gxeWGxInprW2fZdi3oEkE8fcHaox/ZJJfkyi8WGsA== X-Google-Smtp-Source: APXvYqz7Pns6yNxou+ji4+lHvfmIa5Es2PEZvxk/8zkPgiusGNOBLVPnLaM4J8+4A7pb4vQ7zRIlXwNYt50H88l7/Dg= X-Received: by 2002:a67:f607:: with SMTP id k7mr20461902vso.137.1554881094793; Wed, 10 Apr 2019 00:24:54 -0700 (PDT) MIME-Version: 1.0 References: <20190409133622.14729-1-i.maximets@samsung.com> In-Reply-To: <20190409133622.14729-1-i.maximets@samsung.com> From: David Marchand Date: Wed, 10 Apr 2019 09:24:43 +0200 Message-ID: To: Ilya Maximets , Maxime Coquelin , Tiwei Bie Cc: dev , Jens Freimann , Dariusz Stojaczyk , dpdk stable Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] vhost: fix passing destroyed device to destroy callback 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: Wed, 10 Apr 2019 07:24:55 -0000 On Tue, Apr 9, 2019 at 3:36 PM 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); > + > pthread_mutex_lock(&vsocket->conn_mutex); > TAILQ_REMOVE(&vsocket->conn_list, conn, next); > pthread_mutex_unlock(&vsocket->conn_mutex); > -- > 2.17.1 > > Reviewed-by: David Marchand For vhost maintainers, looking at vhost_user_add_connection, aren't we leaking a vid on errors ? either when new_connection notifier returns an error, or after calling destroy_connection. -- David Marchand 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 406B0A0096 for ; Wed, 10 Apr 2019 09:25:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 90CC95B36; Wed, 10 Apr 2019 09:24:57 +0200 (CEST) Received: from mail-vs1-f68.google.com (mail-vs1-f68.google.com [209.85.217.68]) by dpdk.org (Postfix) with ESMTP id 77A0C58C6 for ; Wed, 10 Apr 2019 09:24:55 +0200 (CEST) Received: by mail-vs1-f68.google.com with SMTP id g127so770103vsd.6 for ; Wed, 10 Apr 2019 00:24:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=h5BmA4zjHK5PlJg/obCYJjNy4HoPlFKyZm16/5aG2xw=; b=sdx7OioleTzWTHW2I7jXuaBuJBQmZyFl0sL0tp2b+wGRto9G3/FtBeV+x8OrbWKwNh cWANOTjwlxQxGrDdSfEzjzKExHaW90zDsF1yfItClnLlr1VV0G1wpXEe61nbpo6cXcDM FJXq+UvnGQVtUweIrnuSUTOH++xJmS3jtfjAbGuPeG/D64ubX/S5faE/61HPMYeNjdto 6hRJ4yESBYZlXmT63XoWGKnMd7S8rETuTLo/FmEbXZlTYxJnhH5/4KkIBCzhvVM5Rq19 M2ztgRH5up3xQjwW/zc8jynt5P1Uwe6QKExptb0/2yiade2y1VhMYbsFW9DDpQPoju+n IBhA== X-Gm-Message-State: APjAAAV4QFqA8YywAMYEMRKVjErGuTgddXDwO/JCjviLR5ATUUVooCTa 4gxeWGxInprW2fZdi3oEkE8fcHaox/ZJJfkyi8WGsA== X-Google-Smtp-Source: APXvYqz7Pns6yNxou+ji4+lHvfmIa5Es2PEZvxk/8zkPgiusGNOBLVPnLaM4J8+4A7pb4vQ7zRIlXwNYt50H88l7/Dg= X-Received: by 2002:a67:f607:: with SMTP id k7mr20461902vso.137.1554881094793; Wed, 10 Apr 2019 00:24:54 -0700 (PDT) MIME-Version: 1.0 References: <20190409133622.14729-1-i.maximets@samsung.com> In-Reply-To: <20190409133622.14729-1-i.maximets@samsung.com> From: David Marchand Date: Wed, 10 Apr 2019 09:24:43 +0200 Message-ID: To: Ilya Maximets , Maxime Coquelin , Tiwei Bie Cc: dev , Jens Freimann , Dariusz Stojaczyk , dpdk stable Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] vhost: fix passing destroyed device to destroy callback 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190410072443.wPg3iYfEMh1Dmso4OWcexy5Cbpy2c6qoFB8Eb0384oA@z> On Tue, Apr 9, 2019 at 3:36 PM 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); > + > pthread_mutex_lock(&vsocket->conn_mutex); > TAILQ_REMOVE(&vsocket->conn_list, conn, next); > pthread_mutex_unlock(&vsocket->conn_mutex); > -- > 2.17.1 > > Reviewed-by: David Marchand For vhost maintainers, looking at vhost_user_add_connection, aren't we leaking a vid on errors ? either when new_connection notifier returns an error, or after calling destroy_connection. -- David Marchand