mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Linus Torvalds' <torvalds@linux-foundation.org>,
	David Howells <dhowells@redhat.com>
Cc: Franck Grosjean <fgrosjea@redhat.com>,
	Phil Auld <pauld@redhat.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] pipe: Make a partially-satisfied blocking read wait for more
Date: Mon, 26 Jun 2023 09:16:15 +0000	[thread overview]
Message-ID: <4fd200bd9df24106a6d19293a495b661@AcuMS.aculab.com> (raw)
In-Reply-To: <CAHk-=wjrsPMko==NyQ1Y=Cta-ATshCwzSn9OwCq6KAx8Gh8RLA@mail.gmail.com>

From: Linus Torvalds
> Sent: 24 June 2023 00:32
> 
> On Fri, 23 Jun 2023 at 16:08, Linus Torvalds
> <torvalds@linux-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)

  reply	other threads:[~2023-06-26  9:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23 22:34 David Howells
2023-06-23 22:41 ` Linus Torvalds
2023-06-23 23:08   ` Linus Torvalds
2023-06-23 23:32     ` Linus Torvalds
2023-06-26  9:16       ` David Laight [this message]
2023-06-26  9:31   ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4fd200bd9df24106a6d19293a495b661@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=brauner@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=fgrosjea@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pauld@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®