Re: [tabled patch 1/1] Fix spinning if EOF from client
Jeff Garzik <[email protected]> Fri, 14 May 2010 22:02:51 -0400
| Newsgroups | org.kernel.vger.hail-devel |
|---|---|
| Message-ID | <[email protected]> |
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<[email protected]> applied