On Sun, May 31, 2020 at 09:40:47AM +0200, Martin Pieuchot wrote:
> On 30/05/20(Sat) 15:49, Visa Hankala wrote:
> > [...] 
> > Local filesystems can observe changes at the source, which makes polling
> > unnecessary. NFS clients do not have that benefit. The NFSv3 protocol
> > lacks a mechanism to notify clients of changes.
> > 
> > The NFS polling mechanism is in use for example when running tail -f
> > on a remote file. Directory monitoring can be utilized for example
> > by a directory browser application or a distributed batch processing
> > system.
> > 
> > > > It is true that the code is not perfect, but having even basic and
> > > > best-effort functionality with kevent(2) and NFS is better than nothing
> > > > in my opinion. The kqueue subsystem should not dumb down for emulating
> > > > poll(2) and select(2).
> > > 
> > > In that case we've to accept or work-around with the fact that a thread
> > > is allocated, an operation that can fail, in the kqfilter().  Do you have
> > > an opinion on that?  What should we do for other FSs is uniformity wanted?
> > 
> > Can't the emulation of poll(2) and select(2) operate without the poller?
> > These system calls are supposed to return true for regular files for
> > reading and writing. No polling of remote state is needed for that.
> > 
> > The read behaviour of poll(2) and select(2) differs from kevent(2)'s
> > EVFILT_READ. Consequently, there has to be an indicator that makes
> > f_event work in poll(2)/select(2) mode. I guess the same indicator can
> > control nfs_kqfilter().
> 
> So are you saying that poll(2) is broken on NFS and suggest that I extend
> the kqfilter to match this behavior?

I am not saying that. I am saying that poll(2) and kevent(2) have
different semantics with regular files. Except that the write filter
is missing at the moment, the current NFS poll(2) and kevent(2)
behaviour looks about similar to the other filesystems.

poll(2) returns true immediately, whereas kevent(2) EVFILT_READ returns
true once the file pointer is not at the end of file (unless NOTE_EOF
is set).

For the semantics of poll(2), the NFS poller is pointless. However,
the poller is necessary for approximating kevent(2) semantics on NFS.

Reply via email to