From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by dpdk.org (Postfix) with ESMTP id 3A21829D9 for ; Fri, 14 Jul 2017 04:44:01 +0200 (CEST) Received: by mail-pf0-f194.google.com with SMTP id z6so9240239pfk.3 for ; Thu, 13 Jul 2017 19:44:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hNuV4B0RUrmv2gddGFKFCQe7FTCxHYrSL3i76dSvczM=; b=N2Qavj8THh+kU7nk6O4WwHM0S4wJSLwtVOWo+Lj5+knr0nYGob+86kTSNhmKXOsPB6 7LUwnGF82+tG57hEHq5+s7sBgDyaZLeLaXVZkVBJQ74HWjTI/ET2LLUH/cQalVuA00Be u3kjB0DANiENvjYQiA2XlQV+J2WK3C2F6bGRQDSznB3PG28raGM/S2sFoE7Yq8yfj9/I 2kuRBe51sCEoTRAuo4tB0wo7OYN/VYL2e10s7GGMGmzMViR2lCKljMh0lx9aqU5K2xQ4 v40whYfBw6hRRiSF2F5YpMG4Sm5QrMb2MsytHprqqQOyiDSH6DuJjYOWbe9vm3lCCuEk mSNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hNuV4B0RUrmv2gddGFKFCQe7FTCxHYrSL3i76dSvczM=; b=leFDeEaOeMVDzKdTy1Z9Qm9p59PAlUVIWKwMPj9TxiHBrN3i+eF+vOfs84rt2OlPXu zAv/22uygWvWNY830Fb9fsfGkq9WowoDQfMNG0JydgBqPi4u+y1W5puMZOxyS9RSzvxK a/bfkqSORxJEy0AZC5o1Y7H7dCiGfGMzf/gIkFVV/DzGK3nVoWwjrGkX/R6GZVTIblN1 5Zb5GDGmbgNLYW+N1GkhneWDNgLmFfjF5wLKLML2dZr7oWmHTmwpbPhIvIp99E+g12k5 ruLlPYdt79iVhqUD1QcVatdsrY3mpxy0TyY+9PyunVy/uxQNCnDWtUt9OKS75C3AKNRg dYpw== X-Gm-Message-State: AIVw111gGFUKI1+2dHvWXbYUkylgMbr3rRBPphXoIDV20M6UzDBRRE3f b1uWCS96KSAxr3P0 X-Received: by 10.84.172.1 with SMTP id m1mr13261578plb.174.1500000240791; Thu, 13 Jul 2017 19:44:00 -0700 (PDT) Received: from yliu-home ([45.63.61.64]) by smtp.gmail.com with ESMTPSA id s62sm15410345pfi.36.2017.07.13.19.43.58 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Jul 2017 19:43:59 -0700 (PDT) Date: Fri, 14 Jul 2017 10:43:52 +0800 From: Yuanhan Liu To: Jens Freimann Cc: Zhiyong Yang , dev@dpdk.org, maxime.coquelin@redhat.com, lei.a.yao@intel.com Message-ID: <20170714024351.GG11626@yliu-home> References: <20170710080648.63443-1-zhiyong.yang@intel.com> <20170710094827.zdykowebtm3m3w2k@dhcp-192-218.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170710094827.zdykowebtm3m3w2k@dhcp-192-218.str.redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-dev] [PATCH] vhost: fix vhost-user init failed 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: Fri, 14 Jul 2017 02:44:02 -0000 On Mon, Jul 10, 2017 at 11:48:27AM +0200, Jens Freimann wrote: > >@@ -668,7 +668,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags) > > } > > > > vhost_user.vsockets[vhost_user.vsocket_cnt++] = vsocket; > >- > >+ goto out; > >out_mutex: > > if (pthread_mutex_destroy(&vsocket->conn_mutex)) { > > RTE_LOG(ERR, VHOST_CONFIG, > > Thanks for fixing this! > > Sorry for introducing this bug, I was about to send this before I saw > your fix: > > diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c > index 57b86c0..b2158a7 100644 > --- a/lib/librte_vhost/socket.c > +++ b/lib/librte_vhost/socket.c > @@ -668,6 +668,9 @@ rte_vhost_driver_register(const char *path, uint64_t flags) > } > > vhost_user.vsockets[vhost_user.vsocket_cnt++] = vsocket; > +out: > + pthread_mutex_unlock(&vhost_user.mutex); > + return ret; > > out_mutex: > if (pthread_mutex_destroy(&vsocket->conn_mutex)) { > @@ -677,9 +680,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags) > out_free: > free(vsocket->path); > free(vsocket); > -out: > pthread_mutex_unlock(&vhost_user.mutex); > - > return ret; > } > > Both works fine, so I leave it up to the maintainers how to fix. > > Reviewed-by: Jens Freimann I actually prefers below: I don't want a simple "out" on top of "out_mutex" and "out_free", and an unconditional "goto" looks weird to me. --- @@ -669,6 +669,9 @@ rte_vhost_driver_register(const char *path, uint64_t flags) vhost_user.vsockets[vhost_user.vsocket_cnt++] = vsocket; + pthread_mutex_unlock(&vhost_user.mutex); + return ret; + out_mutex: if (pthread_mutex_destroy(&vsocket->conn_mutex)) { RTE_LOG(ERR, VHOST_CONFIG, Applied to dpdk-next-virtio, with above changes. Thanks! --yliu