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

From: David Howells
Date: Fri Oct 25 2019 - 04:35:13 EST

Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> > 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.
> Can't you just do
> ioctl(fd, FIONREAD, &count);
> in a loop instead? "No paperwork. Just sprinkle some msleep() crack on
> him, and let's get out of here"

Using FIONREAD like this means that I would have to quiesce the tests in order
to sync up. For the moment that's fine, but at some point I would like to be
able to stress test the system by running tests in parallel against the same
keyring. Each test needs to check with the monitor whether its keys have
generated the appropriate notifications against a backdrop of events being
continuously generated by other tests.

I can hold this patch for now. Let me see if I can come up with a better way
to do it. Maybe it can be done by dead reckoning, holding up until either
we've counted out a complete ring-full of notifications or read() has come up