Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Aug 2009 00:38:03 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Konstantin Belousov <kib@FreeBSD.org>
Subject:   Re: svn commit: r196460 - head/sys/kern
Message-ID:  <20090826223803.GA33468@stack.nl>
In-Reply-To: <20090826163931.C41472@delplex.bde.org>
References:  <200908231244.n7NCiFgc061095@svn.freebsd.org> <20090823213759.GA55039@stack.nl> <20090825031355.B729@besplex.bde.org> <20090825210815.GA8792@stack.nl> <20090826163931.C41472@delplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 26, 2009 at 05:08:57PM +1000, Bruce Evans wrote:
> On Tue, 25 Aug 2009, Jilles Tjoelker wrote:
> > On Tue, Aug 25, 2009 at 04:07:11AM +1000, Bruce Evans wrote:
> >> On Sun, 23 Aug 2009, Jilles Tjoelker wrote:
> >> % Index: sys/fs/fifofs/fifo_vnops.c
> >> % ===================================================================
> >> % --- sys/fs/fifofs/fifo_vnops.c	(revision 196459)
> >> % +++ sys/fs/fifofs/fifo_vnops.c	(working copy)
> >> % @@ -193,6 +193,10 @@
> >> %  			goto fail2;
> >> %  		fip->fi_writesock = wso;
> >> %  		error = soconnect2(wso, rso);
> >> % +		if (error == 0)
> >> % +			error = soshutdown(rso, SHUT_WR);
> >> % +		if (error == 0)
> >> % +			error = soshutdown(wso, SHUT_RD);
> >> %  		if (error) {
> >> %  			(void)soclose(wso);
> >> %  fail2:

> The second shutdown became harmless for me when I fixed the clobbering of
> sb_state.  Does it have any effect?

It seems not. shutdown(SHUT_RD) basically calls the pru_flush protocol
function (which uipc_usrreq.c does not provide), calls socantrecvmore
(which uipc_usrreq.c had already done synchronously with the first
shutdown) and clears the receive socket buffer (which is already empty).

Regarding the direct access to SBS_CANTRCVMORE and SBS_CANTSENDMORE,
this seems related to the special property of fifos that they can
disconnect and reconnect a stream using the same object. The socket
layer normally does not allow clearing SBS_CANTRCVMORE and
SBS_CANTSENDMORE. The only case where fifo_vnops.c touches these flags
directly where a so* function call could be used is the setting of
SBS_CANTRCVMORE on the read side at initial creation (possibly because a
wakeup is not necessary there).

I suppose the new fifo implementation will avoid abusing sockets this
way.

-- 
Jilles Tjoelker



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