From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id CEF3D1B4DA; Thu, 27 Sep 2018 17:54:12 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 293773086266; Thu, 27 Sep 2018 15:54:12 +0000 (UTC) Received: from [10.36.112.65] (ovpn-112-65.ams2.redhat.com [10.36.112.65]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D248C67645; Thu, 27 Sep 2018 15:54:10 +0000 (UTC) To: Qiang Zhou , dev@dpdk.org Cc: stable@dpdk.org References: <20180907005307.98363-1-zhouqiang2633@gmail.com> From: Maxime Coquelin Message-ID: <434b53c7-539e-026d-8c0c-9560b0465787@redhat.com> Date: Thu, 27 Sep 2018 17:54:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180907005307.98363-1-zhouqiang2633@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 27 Sep 2018 15:54:12 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH] vhost: fix crash on unregistering in client mode 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: Thu, 27 Sep 2018 15:54:13 -0000 Hi Qiang, On 09/07/2018 02:53 AM, Qiang Zhou wrote: > when rte_vhost_driver_unregister delete the connection fd, > the fd lock will prevent the vsocket to be freed. But when > vhost_user_msg_handler return error, it will delete vsocket > conn_list. And then the fd lock will become invalid. So the > vsocket will be freed in rte_vhost_drivere_unregister and > the vhost_user_read_cb will reconnect. I am not sure to understand the problem, could you please elaborate? > > To fix this: > move delete vsocket conn after reconnect > > Cc: stable@dpdk.org > > Signed-off-by: Qiang Zhou > --- > lib/librte_vhost/socket.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c > index d63031747..43da1c51b 100644 > --- a/lib/librte_vhost/socket.c > +++ b/lib/librte_vhost/socket.c > @@ -293,16 +293,16 @@ vhost_user_read_cb(int connfd, void *dat, int *remove) > if (vsocket->notify_ops->destroy_connection) > vsocket->notify_ops->destroy_connection(conn->vid); > > + if (vsocket->reconnect) { > + create_unix_socket(vsocket); > + vhost_user_start_client(vsocket); > + } > + > pthread_mutex_lock(&vsocket->conn_mutex); > TAILQ_REMOVE(&vsocket->conn_list, conn, next); > pthread_mutex_unlock(&vsocket->conn_mutex); > > free(conn); > - > - if (vsocket->reconnect) { > - create_unix_socket(vsocket); > - vhost_user_start_client(vsocket); > - } > } > } > >