patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Tiwei Bie <tiwei.bie@intel.com>
To: Ilya Maximets <i.maximets@samsung.com>
Cc: dev@dpdk.org, Maxime Coquelin <maxime.coquelin@redhat.com>,
	Jens Freimann <jfreimann@redhat.com>,
	Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>,
	David Marchand <david.marchand@redhat.com>,
	stable@dpdk.org
Subject: Re: [dpdk-stable] [PATCH] vhost: fix passing destroyed device to destroy callback
Date: Fri, 12 Apr 2019 12:39:38 +0800	[thread overview]
Message-ID: <20190412043938.GB15935@dpdk-tbie.sh.intel.com> (raw)
In-Reply-To: <20190409133622.14729-1-i.maximets@samsung.com>

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 <i.maximets@samsung.com>
> ---
>  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
> 

  parent reply	other threads:[~2019-04-12  4:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190409133629eucas1p2ecfe7c4771bb6add694596cf75cf3e70@eucas1p2.samsung.com>
2019-04-09 13:36 ` Ilya Maximets
2019-04-09 14:25   ` Jens Freimann
2019-04-10  7:24   ` David Marchand
2019-04-10  7:53     ` Ilya Maximets
2019-04-10  8:07       ` David Marchand
2019-04-11  8:53         ` Ilya Maximets
2019-04-12  4:39   ` Tiwei Bie [this message]
2019-04-12  8:11     ` Ilya Maximets
     [not found]   ` <CGME20190412083233eucas1p181a34d6544869582defba814e4caeb52@eucas1p1.samsung.com>
2019-04-12  8:32     ` [dpdk-stable] [PATCH v2] " Ilya Maximets
2019-04-15  6:21       ` Tiwei Bie
2019-04-17  7:54       ` Maxime Coquelin

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=20190412043938.GB15935@dpdk-tbie.sh.intel.com \
    --to=tiwei.bie@intel.com \
    --cc=dariuszx.stojaczyk@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=i.maximets@samsung.com \
    --cc=jfreimann@redhat.com \
    --cc=maxime.coquelin@redhat.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).