[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4fd200bd9df24106a6d19293a495b661@AcuMS.aculab.com>
Date: Mon, 26 Jun 2023 09:16:15 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Linus Torvalds' <torvalds@...ux-foundation.org>,
David Howells <dhowells@...hat.com>
CC: Franck Grosjean <fgrosjea@...hat.com>,
Phil Auld <pauld@...hat.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] pipe: Make a partially-satisfied blocking read wait for
more
From: Linus Torvalds
> Sent: 24 June 2023 00:32
>
> On Fri, 23 Jun 2023 at 16:08, Linus Torvalds
> <torvalds@...ux-foundation.org> wrote:
> >
> > In fact, I'd expect that patch to fail immediately on a perfectly
> > normal program that passes a token around by doing a small write to a
> > pipe, and have the "token reader" do a bigger write.
>
> Bigger _read_, of course.
>
> This might be hidden by such programs typically doing a single byte
> write and a single byte read, but I could easily imagine situations
> where people actually depend on the POSIX atomicity guarantees, ie you
> write a "token packet" that might be variable-sized, and the reader
> then just does a maximally sized read, knowing that it will get a full
> packet or nothing.
There are definitely programs that just do a large read in order
to consume all the single byte 'wakeup' writes.
(The 'must check' on these reads is a right PITA.)
They ought to set the pipe non-blocking, but I suspect many
don't - because it all works anyway.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists