Re: [PATCH v2] Introduce a version6 of autofs interface, to fix design error.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On Fri, Apr 27, 2012 at 1:29 PM, David Miller <davem@xxxxxxxxxxxxx> wrote:
> From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> Date: Fri, 27 Apr 2012 12:56:20 -0700
>>  - when reading, consider a pipe buffer to be "spent" when any of the
>> data has been read
> So basically any sized read empties the entire pipe, right?
> As long as we never generate multiple messages at the same
> time, I guess this would work.

It would work regardless.

Read the notes (or the small patch) again. Reading a part of a pipe
buffer clears *that* buffer. And since the packetized mode also
disables merging of writes into buffers, that means that multiple
writes result in multiple buffers. By default, pipes have 16 buffers
(you can set the number if you really want to), so you can do multiple
writes of multiple packets, and then as you read them, you'll see each
write individually.

So let's say that you have a writer that does the following writes: 8
bytes, 100 bytes, 32 bytes.  If you have a reader that reads a
fixed-size buffer (let's pick 64 bytes just to make an example), the
reader will then see those exact three writes, except it will only get
the 64 first bytes of the 100-byte write (and the remaining 36 bytes
will be lost forever).

So it really is packetized.

Of course, if you try to write more than PAGE_SIZE in one single
write, the pipe code will split that up into multiple buffers, so then
a reader would see that as multiple "packets". But hey, that's how
pipes work - they have a size limit on write atomicity guarantees,
regardless of the packetized mode. And obviously right now we only
expose the packetized mode for the autofs pipe, which only does writes
of that one fixed size (~300 bytes).

To unsubscribe from this list: send the line "unsubscribe autofs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at

[Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Tools]     [DDR & Rambus]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

Add to Google