Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Oct 2014 04:52:45 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Konstantin Belousov <kib@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r273130 - head/sys/fs/deadfs
Message-ID:  <20141028042928.J3114@besplex.bde.org>
In-Reply-To: <201410151308.s9FD8rY4032849@svn.freebsd.org>
References:  <201410151308.s9FD8rY4032849@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 15 Oct 2014, Konstantin Belousov wrote:

> Log:
>  Change the deadfs poll VOP to return POLLIN|POLLRDNORM if the caller
>  is interested in i/o state.  Return POLLNVAL for invalid bits, similar
>  to poll_no_poll().  Note that POLLOUT must not be returned, since
>  POLLHUP is set.
>
>  Noted and reviewed by:	bde
>  Sponsored by:	The FreeBSD Foundation
>  MFC after:	1 week

Thanks.

This is not a complete fix, but is just bug for bug compatible with
poll_no_poll() and less buggy that the previous version.

POLLNVAL means that the fd is valid, so it should not be returned for
dead fd's (the whole point of deadfs is to keep the fd's alive enough
to be valid).  POLLIN should only be returned in there is (non-null)
data.

For some fd's, there may be both hangup and data, but for dead fd's
there can only be hangup, so POLLIN is especially useless for deadfs.
ttys are one of the few file types that usually set POLLIN correctly
for EOF (that is, POLLIN is not set for EOF).  2 unusual broken cases
remain for ttys:
- when the tty goes away but the fd is still connected to the tty driver,
   POLLIN is set if it is checked for
- but the fd is connected to deadfs (typically after it is revoked), the
   behaviour is now the same as when the tty goes away, except POLLNVAL
   is also set.
For other file types, the new behaviour matches bugs in the handling for
undead fd's better, while fixing some of the bugs in the old behaviour.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141028042928.J3114>