From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Garzik Subject: Re: [tabled patch 1/1] Fix spinning if EOF from client Date: Fri, 14 May 2010 22:02:51 -0400 Message-ID: <4BEE00CB.6070900@garzik.org> References: <20100511220954.3bb154a0@redhat.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=cLrC6mGz0YesyN7sKYu0yrWQJR0S7Irjn4DXXYf/wBM=; b=xiT+NkpQiO+62wd/fD1IL15FNSb+I1nUlBp8+AY4cJpXCCOQGfmwUKAoqbhLbCgk/h CY8kLUruSE/1JqzbBlBFcqrMPfjTdaRAfItEZCLIOOO+tOszMcVbzYB4Ww7rJ5JMWL1n IM5qUOGaRoPHwj2Om8JwoazquHz5yFjdeBELc= In-Reply-To: <20100511220954.3bb154a0@redhat.com> Sender: hail-devel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii"; format="flowed" To: Pete Zaitcev Cc: Project Hail List On 05/12/2010 12:09 AM, Pete Zaitcev wrote: > I observed that Tabled sometimes starts spinning on CPU. It happens when > it manages to receive a EOF from client (reads zero bytes from the socket). > > The fix is to treat EOF as an error and simply dispose of the cli. > > However, we need to know when there are no bytes to be read from > a socket that is still open. To that end we modify the API of cli_read: > now it only returns zero in case of EOF, and passes -EAGAIN up. > > In order to prevent busy spinning for slow clients, callers of cli_read > return false to the dispatch loop in case of -EAGAIN. > > Note that this patch assumes that zero bytes is always EOF, and that > we receive -EAGAIN if there is nothing to read in the first place. > > Signed-off-by: Pete Zaitcev applied