On Sun, Jan 16, 2022 at 02:41:46PM +1000, David Gwynne wrote:
> if you're in bpfclose or tun/tap close, you're the last one out. this
> means that there shouldn't be anything else in poll/select/kevent/etc
> because you're the last one out.
> 
> from what i can tell, tun and bpf are the only drivers that do this, and
> i dont think they need to.

The last one out holds when the device closing is triggered by the
releasing of the last file reference. However, bpf/tun/tap close can
also be called when the device is detached through VOP_REVOKE(). In
that case any associated file descriptors remain open.

I think poll/select/kevent should wake up if the device is detached.
kevent(2) and kqueue-based select(2) get notified as a result of
klist_invalidate().

There is also the SIGIO case, but only bpf close raises the signal.

To be on the safer side, I would wait until poll(2) uses kqueue backed.

Reply via email to