[RFC PATCH 11/10] pipe: Add fsync() support [ver #2]

Linus Torvalds torvalds at linux-foundation.org
Sat Nov 2 18:53:38 UTC 2019


On Thu, Oct 31, 2019 at 8:16 AM David Howells <dhowells at redhat.com> wrote:
>
> Konstantin Khlebnikov <khlebnikov at yandex-team.ru> wrote:
>
> > Similar synchronization is required for reusing memory after vmsplice()?
> > I don't see other way how sender could safely change these pages.
>
> Sounds like a point - if you have multiple parallel contributors to the pipe
> via vmsplice(), then FIONREAD is of no use.  To use use FIONREAD, you have to
> let the pipe become empty before you can be sure.

Well, the rules for vmsplice is simply to not change the source pages.
It's zero-copy, after all.

If you want to change the source pages, you need to just use write() instead.

That said, even then the right model isn't fsync(). If you really want
to have something like "notify me when this buffer has been used", it
should be some kind of sequence count thing, not a "wait for empty".

Which might be useful in theory, but would be something quite
different (and honestly, I wouldn't expect it to find all that
widespread use)

             Linus



More information about the Linux-security-module-archive mailing list