linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Michael Tokarev <mjt@tls.msk.ru>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>, Ian Kent <raven@themaw.net>,
	Thomas Meyer <thomas@m3y3r.de>,
	autofs@vger.kernel.org
Subject: Re: autofs: make the autofsv5 packet file descriptor use a packetized pipe
Date: Mon, 30 Apr 2012 13:11:46 -0700	[thread overview]
Message-ID: <CA+55aFxXMXmdeHAu3xOBSJEsJ97P_-6qn595FM6s7WXeK0DkjQ@mail.gmail.com> (raw)
In-Reply-To: <4F9EEFF5.4000703@zytor.com>

On Mon, Apr 30, 2012 at 1:03 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>
> Thinking about it some more: for v6, I wouldn't use a packetized pipe at
> all (due to the unnecessary extra buffer consumption.)  Instead just put
> the message size in the header and read a large chunk, which may end up
> being more than one packet and may end up with a partial packet at the
> end.  *This is okay*, because there is only one reader, and any
> additional data needed will be gotten the next time around the loop.

Yes, doing multiple streaming packets is good, but then you really do
need to design the protocol for streaming, which very much includes
having that size early in the header. And then you'd better make the
packets really have different sizes, so that you cannot possibly get
it wrong in an app that "knows" that there's one size.

However, in the case of autofs, I don't actually see multiple packets
being that common. Sure, they can happen, but it really looks like the
normal case will always be the trivial ping-pong scenario ("read one
packet, react to it, rinse and repeat").

But using a big buffer and trying to read lots at one time is valid even then.

The thing I *really* hate about the current autofs situation is how it
really does everything you can possibly do wrong. Not at all the
"let's just read as much as we can, and look at the return value to
determine number of bytes/packets", but literally "I know a-priori how
big the packet is, and I will read exactly that many bytes". That
coupled with the psueod-fixed-size packets just made it a very very
fragile thing.

                  Linus

  reply	other threads:[~2012-04-30 20:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120429205429.63CCD7C0064@ra.kernel.org>
2012-04-30  0:15 ` autofs: make the autofsv5 packet file descriptor use a packetized pipe H. Peter Anvin
2012-04-30  0:25   ` Linus Torvalds
2012-04-30  0:28     ` H. Peter Anvin
2012-04-30  0:33       ` Linus Torvalds
2012-04-30  0:35         ` H. Peter Anvin
2012-04-30  0:43           ` Linus Torvalds
2012-04-30  0:45             ` H. Peter Anvin
2012-04-30  1:29             ` Ian Kent
2012-04-30  1:56               ` Linus Torvalds
2012-04-30  5:57                 ` Ian Kent
2012-04-30  0:30     ` H. Peter Anvin
2012-04-30  0:37       ` Linus Torvalds
2012-04-30 20:03       ` H. Peter Anvin
2012-04-30 20:11         ` Linus Torvalds [this message]
2012-04-30 20:14           ` H. Peter Anvin
2012-04-30  6:27   ` Michael Tokarev
2012-04-30  6:43     ` Michael Tokarev
2012-04-30  6:48       ` H. Peter Anvin
2012-04-30  6:55       ` Ian Kent

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=CA+55aFxXMXmdeHAu3xOBSJEsJ97P_-6qn595FM6s7WXeK0DkjQ@mail.gmail.com \
    --to=torvalds@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=autofs@vger.kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjt@tls.msk.ru \
    --cc=raven@themaw.net \
    --cc=thomas@m3y3r.de \
    /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;
as well as URLs for NNTP newsgroup(s).