From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 5132C2BD8; Sat, 1 Apr 2017 07:17:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491023865; x=1522559865; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=+MvDHpfnxdNEsF22Ae1trfjRjkMxux6jXQ7nhoPRtdU=; b=u+UFsNLyY00sWy06g63OtZ7hUgU9JbESFTftzAMrLUmb4+T2J/QiKCHu zV1oH6wpL4Y5THopcLvOgQMEaWnIGg==; Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Mar 2017 22:17:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,255,1486454400"; d="scan'208";a="72448684" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by orsmga004.jf.intel.com with ESMTP; 31 Mar 2017 22:17:43 -0700 Date: Sat, 1 Apr 2017 13:15:20 +0800 From: Yuanhan Liu To: dev@dpdk.org Cc: Maxime Coquelin , Ilya Maximets , stable@dpdk.org Message-ID: <20170401051520.GP18844@yliu-dev.sh.intel.com> References: <1490604735-1704-1-git-send-email-yuanhan.liu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1490604735-1704-1-git-send-email-yuanhan.liu@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-stable] [PATCH] vhost: fix fd leaks for vhost-user server mode 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: , X-List-Received-Date: Sat, 01 Apr 2017 05:17:45 -0000 On Mon, Mar 27, 2017 at 04:52:15PM +0800, Yuanhan Liu wrote: > A vhost-user server socket could have many connections, thus many connfd. > However, we currently just use one single int var to store it. Meaning, > it will get overwritten every time a new connection is created. > > While this will not create fatal issue as it sounds (since the correct > connfd is closured to the event loop thread by fdset_add), it may cause > fd leaks if a user invokes rte_vhost_driver_unregister before shutting > down all connections: it just closes the recent connfd. > > A simple example that should be able to reproduce this leaks issues is, > del the ovs vhost-user port while the connected VMs are still alive. (Note > that it's suggested to use one socket for one VM, which makes the issue > not that fatal as it sounds again). > > Since we already use a struct "vhost_user_connection" to track all info > about one connection, it's obvious that we should put the connfd there. > Then we could build a connection list inside the vhost_user_socket struct, > to represent all connections belong that socket file. > > Fixes: 164fd396788d ("vhost: fix unregistering in client mode") Applied to dpdk-next-virtio. --yliu > > Cc: Ilya Maximets > Cc: stable@dpdk.org > Signed-off-by: Yuanhan Liu