Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jun 2006 09:34:46 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        arch@FreeBSD.org
Subject:   Re: Proposal: add pru_close protosw method, refactor abort/detach
Message-ID:  <20060618093149.W99683@fledge.watson.org>
In-Reply-To: <20060618014337.V67789@fledge.watson.org>
References:  <20060618014337.V67789@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sun, 18 Jun 2006, Robert Watson wrote:

> Attached is a patch that attempts to further rationalize tear-down. 
> Specifically, it refactors pru_detach (disconnect and conditionally free) 
> and pru_abort (disconnect abruptly and free) into three protocol switch 
> functions:
>
> pru_close: socket has been closed and a sensible shutdown without data loss 
> is desired.
>
> pru_abort: socket is being aborted, generally due to insufficient queue 
> space in a listen socket, or close of a listen socket while connections are 
> waiting to be accepted: close abruptly and potentially with data loss.
>
> pru_detach: teardown is now unconditional -- both the protocol and socket 
> are done.

I realized, of course, that I omitted to specifically describe the specific 
chicken-and-egg problem that kicked this off: if the protocol lends a lock to 
the socket layer for use over the reference count, then the protocol detach 
must occur after any last possible use of that lock, and in the current world 
order, the lock was used several times after the call to detach -- possibly 
before a second call to detach, for example.  The new arrangement basically 
guarantees that the socket is done calling into the protocol and using the 
potentially lent lock before calling a now unconditional detach.

Robert N M Watson
Computer Laboratory
University of Cambridge



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