From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 17:52:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C2FF4791; Mon, 27 Oct 2014 17:52:54 +0000 (UTC) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 8558FAD5; Mon, 27 Oct 2014 17:52:54 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 00EA1104403F; Tue, 28 Oct 2014 04:52:45 +1100 (AEDT) Date: Tue, 28 Oct 2014 04:52:45 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov Subject: Re: svn commit: r273130 - head/sys/fs/deadfs In-Reply-To: <201410151308.s9FD8rY4032849@svn.freebsd.org> Message-ID: <20141028042928.J3114@besplex.bde.org> References: <201410151308.s9FD8rY4032849@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=fvDlOjIf c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=mvcpKk_RDYwzxCSpuQ0A:9 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 17:52:54 -0000 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