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

From: Christoph Hellwig
Date: Sun Oct 27 2019 - 11:22:36 EST


On Thu, Oct 24, 2019 at 05:57:32PM +0100, David Howells wrote:
> pipe: Add fsync() support
>
> The keyrings testsuite needs the ability to wait for all the outstanding
> notifications in the queue to have been processed so that it can then go
> through them to find out whether the notifications it expected have been
> emitted.
>
> Implement fsync() support for pipes to provide this. The tailmost buffer
> at the point of calling is marked and fsync adds itself to the list of
> waiters, noting the tail position to be waited for and marking the buffer
> as no longer mergeable. Then when the buffer is consumed, if the flag is
> set, any matching waiters are woken up.

I am _really_ worried about overloading fsync for this behavior. fsync
hasn't done anything for 50 years, and suddenly adding any action
is not helpful. If you can't use FIONREAD please add a new ioctls
instead, and document it properly.