[From nobody Sun Jul  5 16:40:50 2009
Date: Mon, 28 Feb 2005 20:04:37 +0100
From: Andrea Arcangeli &lt;andrea@suse.de&gt;
To: Linus Torvalds &lt;torvalds@osdl.org&gt;
Cc: Andrew Morton &lt;akpm@osdl.org&gt;, linux-kernel@vger.kernel.org
Subject: Re: two pipe bugfixes
Message-ID: &lt;20050228190437.GI8880@opteron.random&gt;
References: &lt;20050228042544.GA8742@opteron.random&gt;
	&lt;Pine.LNX.4.58.0502272143500.25732@ppc970.osdl.org&gt;
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: &lt;Pine.LNX.4.58.0502272143500.25732@ppc970.osdl.org&gt;
X-GPG-Key: 1024D/68B9CB43 13D9 8355 295F 4823 7C49  C012 DFA1 686E 68B9 CB43
User-Agent: Mutt/1.5.6i

&gt; &gt; IMHO the really wrong thing is that we always set POLLIN (even for
&gt; &gt; output filedescriptors that will never allow any data to be read).
&gt; 
On Mon, Feb 28, 2005 at 08:25:07AM -0800, Linus Torvalds wrote:
&gt; However, that has always been true. Look at the old code: it would set
&gt; POLLIN for a non-empty pipe for both readers and writers (and do POLLOUT
&gt; for empty pipes both for readers and writers). In fact, your very own
&gt; original strace shows that - it shows &quot;in [4]&quot; even though fd 4 is a
&gt; write-only fd.

Sure, that has always been true, I also wanted to say it wasn't a
mistake of the new code, but just a mistake of the old code that has
seen the light thanks to the recent optimizations.

&gt; The new code does nothing really different. POLLIN is still there for a
&gt; non-empty pipe, just like it was before. It's just that when you have
&gt; multiple buffers, POLLOUT can _also_ be true, since even if you have
&gt; _some_ data in the pipe, you can still do a write of a full PIPE_BUF.
&gt; 
&gt; So the difference is not at all the one you're talking about, and the 
&gt; &quot;bug&quot; you claim to fix was there before too.
&gt; 
&gt; The fact is that if this broke python-twisted, then it just happened to
&gt; work before by mistake. [..]

Yes of course.

&gt; [..] And python-twisted is just plain bogus.

What do you mean with this, could you elaborate? You mean it shouldn't
check for in/out set at the same time? I've no idea why it got confused
by out/in set at the same time, but I guess it could be some
compatibility thing with some other os.

Still my point is that such code should never trigger since pollin
should never be set for an output-pipe-fd.

&gt; That said, I agree with the fact that it's probably not the right thing to
&gt; do, and never was. And if fixing it makes a difference to python-twisted,
&gt; then hey, that's a benefit, but not a reason for the patch.

Sure, I had no idea myself if it was going to work with python-twisted,
because I changed the behaviour compared to the 2.6.9 codebase, but I
tested it and it worked fine as well as the &quot;old 2.6.9&quot; behaviour.

I didn't write the patch to make python-twisted work but only to do
something that would remotely resemble the sus specs and it happened to
fix twisted as well in my testing.

&gt; I don't agree with your patch, though - I don't like your lack of
&gt; parenthesis ;)

;)
]