[From nobody Sun Jul  5 16:40:50 2009
Return-Path: &lt;torvalds@osdl.org&gt;
X-Original-To: andrea@wotan.suse.de
Received: from hermes.suse.de (hermes.suse.de [149.44.160.1])
	by wotan.suse.de (Postfix) with ESMTP id 8347D224B33
	for &lt;andrea@wotan.suse.de&gt;; Mon, 28 Feb 2005 17:24:01 +0100 (CET)
Received: by hermes.suse.de (Postfix)
	id 7BAE0151676; Mon, 28 Feb 2005 17:24:01 +0100 (CET)
Received: from scanhost.suse.de (scanhost.suse.de [149.44.160.36])
	by hermes.suse.de (Postfix) with ESMTP id 752791519E3
	for &lt;andrea@suse.de&gt;; Mon, 28 Feb 2005 17:24:01 +0100 (CET)
Received: from hermes.suse.de ([149.44.160.1])
	by scanhost.suse.de (scanhost [149.44.160.36]) (amavisd-new, port 10025)
	with ESMTP id 06256-11 for &lt;andrea@suse.de&gt;;
	Mon, 28 Feb 2005 17:23:59 +0100 (CET)
Received: from Cantor.suse.de (mail-ex.suse.de [195.135.220.2])
	(using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits))
	(No client certificate requested)
	by hermes.suse.de (Postfix) with ESMTP id EF1F2151676
	for &lt;andrea@suse.de&gt;; Mon, 28 Feb 2005 17:23:58 +0100 (CET)
Received: from smtp.osdl.org (fire.osdl.org [65.172.181.4])
	(using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits))
	(No client certificate requested)
	by Cantor.suse.de (Postfix) with ESMTP id 6B463152BF80
	for &lt;andrea@suse.de&gt;; Mon, 28 Feb 2005 17:23:58 +0100 (CET)
Received: from shell0.pdx.osdl.net (fw.osdl.org [65.172.181.6])
	by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j1SGNsqi025667
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO);
	Mon, 28 Feb 2005 08:23:56 -0800
Received: from localhost (shell0.pdx.osdl.net [10.9.0.31])
	by shell0.pdx.osdl.net (8.13.1/8.11.6) with ESMTP id j1SGNreE025663;
	Mon, 28 Feb 2005 08:23:54 -0800
Date: Mon, 28 Feb 2005 08:25:07 -0800 (PST)
From: Linus Torvalds &lt;torvalds@osdl.org&gt;
To: Andrea Arcangeli &lt;andrea@suse.de&gt;
Cc: Andrew Morton &lt;akpm@osdl.org&gt;, linux-kernel@vger.kernel.org
Subject: Re: two pipe bugfixes
In-Reply-To: &lt;20050228042544.GA8742@opteron.random&gt;
Message-ID: &lt;Pine.LNX.4.58.0502272143500.25732@ppc970.osdl.org&gt;
References: &lt;20050228042544.GA8742@opteron.random&gt;
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Received-SPF: pass (domain of torvalds@osdl.org designates 65.172.181.6 as
	permitted sender)
X-MIMEDefang-Filter: osdl$Revision: 1.103 $
X-Virus-Scanned: by amavisd-new at scanhost.suse.de
X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on opteron.random
X-Spam-Level: 
X-Spam-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham 
	version=3.0.0



On Mon, 28 Feb 2005, Andrea Arcangeli wrote:
&gt; 
&gt; and it started to return this since 2.6.11-rc:
&gt; 
&gt; pipe([3, 4])                            = 0
&gt; write(4, &quot;qqqqq&quot;, 5)                    = 5
&gt; select(5, [4], [4], [4], {0, 0})        = 2 (in [4], out [4], left {0,
&gt; 0})
&gt; close(3)                                = 0
&gt; write(4, &quot;qqqqq&quot;, 5)                    = 5

Ahh, yes. The write merging code doesn't check for no readers. 

&gt; IMHO the really wrong thing is that we always set POLLIN (even for
&gt; output filedescriptors that will never allow any data to be read).

However, that has always been true. Look at the old code: it would set
POLLIN for a non-empty pipe for both readers and writers (and do POLLOUT
for empty pipes both for readers and writers). In fact, your very own
original strace shows that - it shows &quot;in [4]&quot; even though fd 4 is a
write-only fd.

The new code does nothing really different. POLLIN is still there for a
non-empty pipe, just like it was before. It's just that when you have
multiple buffers, POLLOUT can _also_ be true, since even if you have
_some_ data in the pipe, you can still do a write of a full PIPE_BUF.

So the difference is not at all the one you're talking about, and the 
&quot;bug&quot; you claim to fix was there before too.

The fact is that if this broke python-twisted, then it just happened to
work before by mistake. And python-twisted is just plain bogus.

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

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

			Linus
]