From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 73DAF1B32D for ; Fri, 19 Jan 2018 15:37:34 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id F27E6209E6; Fri, 19 Jan 2018 09:37:33 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Fri, 19 Jan 2018 09:37:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=BBdtVTShsH4tb3fIk5XEPPFbiRUaQ7dpyhPUyK7IAEs=; b=Uv5fAKC6 RG9ga11XE2ob2kefJ+zny+rjth6JPqY2WIEaA7lfmScdxwHxLMUJ4LDHp2epta+B j42uogo9vFOygz4CA+tj0vjJoSWOo61Z+ZdNDwe7fPutPC8G0KYtUfjidtxLMuNJ 3asmtLuRKovwc3L0Ww39TO8uXD3I29lg+Fre3RQEHOgOC8xx4Sh57rsaFy9GYlJ0 9H5dyqm6+xtIVNqbYhxkY2Tl3wVvnO8umk+/wxaaAbQ5YbeOjYXxEpbGxekRwdYz hS4ZhYGFgXjvHQSMw9NKzn1a7xDHRfgjk1AGjLtQ2PCB3l+6KcYPPJfDjW0zVTIJ THK0rLjsCwJBRw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=BBdtVTShsH4tb3fIk5XEPPFbiRUaQ 7dpyhPUyK7IAEs=; b=W750Yo7APjBJNUuyc797ksaF70YPDZOS/WBX1jZ50A93L 2aGYdUA2kSsHBtRYbfnDrXFwgdsyfggTAhl4bIScrYK5PlYUsBLPPCfhSRMpK7L/ upRtQEOy8hQ2o/WuqS+WdZx694pIOoKiIJIAJS0zm5nATcKOU6bKW7KPZTxli9/s gKji9JzeOkp+UdhDcRZmg688EfiyeYNbe0HpzXuxwnLdsvdHH4tbWnCR/ZtGqd85 Swi8jKcOgPxHyesVIcah0AnIRCyedsr0NQJQdWOhRgNNpG5z6gVYOs5hezq7oSHI XnBLuSmhhUYuZSfcRPUm+0FWd8ko2kI1+SKbnXuiw== X-ME-Sender: Received: from yliu-mob (unknown [115.148.90.22]) by mail.messagingengine.com (Postfix) with ESMTPA id A6AA27E5CA; Fri, 19 Jan 2018 09:37:32 -0500 (EST) Date: Fri, 19 Jan 2018 22:37:29 +0800 From: Yuanhan Liu To: Bing Zhao Cc: dev@dpdk.org, bing.zhao@hxt-semitech.com Message-ID: <20180119143729.GP29540@yliu-mob> References: <20171221091540.8624-1-ilovethull@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171221091540.8624-1-ilovethull@163.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-dev] [PATCH] reset src fd field to -1 in fdset_move of vhost 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, 19 Jan 2018 14:37:34 -0000 On Thu, Dec 21, 2017 at 05:15:40PM +0800, Bing Zhao wrote: > In the fdset_move, after copying the fd&rwfds from the src to the dst, the fd should be set to -1. Or else in some cases, there will be a fault missing. E.g: > Before: 1 -1 3 4 -1 6 7 -1 9 10 > After: 1 10 3 4 9 6 7 -1 9 10 > Then the index7 will be returned correctly for the first time, but if another fd is to be added, it will fail. Hi, Have you met a real issue? I'm a bit doubt about that, since the fd array is also guarded by "pfdset->num", which makes sure we will not access those invalid entries (i.e. the last 2 entries in above example). --yliu > Signed-off-by: Bing Zhao > --- > lib/librte_vhost/fd_man.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/librte_vhost/fd_man.c b/lib/librte_vhost/fd_man.c > index 4c6fed418..48594dd7f 100644 > --- a/lib/librte_vhost/fd_man.c > +++ b/lib/librte_vhost/fd_man.c > @@ -63,6 +63,7 @@ fdset_move(struct fdset *pfdset, int dst, int src) > { > pfdset->fd[dst] = pfdset->fd[src]; > pfdset->rwfds[dst] = pfdset->rwfds[src]; > + pfdset->fd[src].fd = -1; > } > > static void > -- > 2.11.0.windows.1 >