From patchwork Tue Sep 29 22:25:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 524052 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 2BBA814029C for ; Wed, 30 Sep 2015 08:25:59 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 20733106FD; Tue, 29 Sep 2015 15:25:57 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 44C4310235 for ; Tue, 29 Sep 2015 15:25:55 -0700 (PDT) Received: from bar3.cudamail.com (bar1 [192.168.15.1]) by mx3v1.cudamail.com (Postfix) with ESMTP id 8131F618E7C for ; Tue, 29 Sep 2015 16:25:47 -0600 (MDT) X-ASG-Debug-ID: 1443565546-03dd7b4f9f0a0d0001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar3.cudamail.com with ESMTP id 42ortqbkuizfmDFl (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 29 Sep 2015 16:25:46 -0600 (MDT) X-Barracuda-Envelope-From: blp@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO mail-pa0-f47.google.com) (209.85.220.47) by mx3-pf2.cudamail.com with ESMTPS (RC4-SHA encrypted); 29 Sep 2015 22:25:44 -0000 Received-SPF: unknown (mx3-pf2.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.47 Received: by pacfv12 with SMTP id fv12so18513143pac.2 for ; Tue, 29 Sep 2015 15:25:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=tfNF9CcM39p3IW5eiAGErgWVLwH5uHGqK1Siwxn3ycg=; b=iNUvTiAPMs8QI4NJTtH09DLwse38OFh3XVdgVZe18sJokuCpG8d60+WCME73NLXZ/J IuYO+keHA0FItQt91JnqTvHnQ4lr8EIYRVkXO8czD8+Z1Kj3G7D3i0SH4QSzACoBj8Bf 11kke6nTGu/r6AwHjnTRme2VJ9CRBzYTa8TEg6QmCYsBhGx/hCqqfKtWgGgAxgw8TTZb ur54izK/HFmZDFsaSVteWktlL2KzZV+BvJKRLQx1dQTtFFrF/VoNEyROwe1QV8y1MmAQ MsHSoiJvYB3Zr56mQAl2yRUh2VWW33GOZLbGAg7S7p34pkWF/l6VCiT3p6dOHKihjCIN xYbg== X-Gm-Message-State: ALoCoQmzkUSm9wOoRd6mhUvYhyBah3uqJ2Z+H6FMlGwy/G8hKHKKi5Lv+PyrE+JS0xG27zAiaxyp X-Received: by 10.68.193.163 with SMTP id hp3mr500014pbc.136.1443565545310; Tue, 29 Sep 2015 15:25:45 -0700 (PDT) Received: from nicira.com ([208.91.2.4]) by smtp.gmail.com with ESMTPSA id b7sm27499333pbu.20.2015.09.29.15.25.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Sep 2015 15:25:43 -0700 (PDT) Date: Tue, 29 Sep 2015 15:25:41 -0700 X-Barracuda-Apparent-Source-IP: 208.91.2.4 X-CudaMail-Envelope-Sender: blp@nicira.com From: Ben Pfaff To: Gurucharan Shetty X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V2-928078359 X-CudaMail-DTE: 092915 X-CudaMail-Originating-IP: 209.85.220.47 Message-ID: <20150929222541.GB16690@nicira.com> X-ASG-Orig-Subj: [##CM-V2-928078359##]Re: [PATCH] poll-loop: fix assertion in poll_create_node References: <1442914035-7869-1-git-send-email-i.maximets@samsung.com> <20150922154914.GA2174@nicira.com> <56018237.9070100@samsung.com> <20150922163401.GE437@nicira.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1443565546 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Cc: Ilya Maximets , dev , Dyasly Sergey Subject: Re: [ovs-dev] [PATCH] poll-loop: fix assertion in poll_create_node X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" Do we additionally need this? On Tue, Sep 29, 2015 at 02:39:32PM -0700, Gurucharan Shetty wrote: > Windows even handling selector functions is such that it does not like > when fd is -1 (I have not root-caused the exact reason). This commit > causes most of the unit tests on Windows to fail. So the larger > question is, even though fd of zero is valid, do we really pass it to > any of our poll node functions? > > On Tue, Sep 22, 2015 at 9:34 AM, Ben Pfaff wrote: > > Thanks, I understand now. I applied this to master, changing Nikita's > > Signed-off-by: to a Reported-by:. > > > > On Tue, Sep 22, 2015 at 07:30:47PM +0300, Ilya Maximets wrote: > >> Author is me, Nikita found and analyzed the problem. > >> You may change Signed-off-by to something more proper. > >> > >> Best regards, Ilya Maximets. > >> > >> On 22.09.2015 18:49, Ben Pfaff wrote: > >> > On Tue, Sep 22, 2015 at 12:27:15PM +0300, Ilya Maximets wrote: > >> >> Zero is a valid value for a file descriptor. > >> >> > >> >> Signed-off-by: Ilya Maximets > >> >> Signed-off-by: Nikita Kalyazin > >> > > >> > Thanks for the patch! > >> > > >> > The sign-off chain is unclear. Who is the author? What did the other > >> > person do? > >> > > >> > Thanks, > >> > > >> > Ben. > >> > diff --git a/lib/poll-loop.c b/lib/poll-loop.c index 36eb5ac..28e98ad 100644 --- a/lib/poll-loop.c +++ b/lib/poll-loop.c @@ -297,7 +297,7 @@ free_poll_nodes(struct poll_loop *loop) HMAP_FOR_EACH_SAFE (node, next, hmap_node, &loop->poll_nodes) { hmap_remove(&loop->poll_nodes, &node->hmap_node); #ifdef _WIN32 - if (node->wevent && node->pollfd.fd) { + if (node->wevent && node->pollfd.fd >= 0) { WSAEventSelect(node->pollfd.fd, NULL, 0); CloseHandle(node->wevent); } @@ -341,7 +341,7 @@ poll_block(void) pollfds[i] = node->pollfd; #ifdef _WIN32 wevents[i] = node->wevent; - if (node->pollfd.fd && node->wevent) { + if (node->pollfd.fd >= 0 && node->wevent) { short int wsa_events = 0; if (node->pollfd.events & POLLIN) { wsa_events |= FD_READ | FD_ACCEPT | FD_CLOSE;