From owner-cvs-src@FreeBSD.ORG Wed Aug 2 17:18:18 2006 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9165116A4E2; Wed, 2 Aug 2006 17:18:18 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F53943D46; Wed, 2 Aug 2006 17:18:18 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id BB37A46CDA; Wed, 2 Aug 2006 13:18:17 -0400 (EDT) Date: Wed, 2 Aug 2006 18:18:17 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Steve Kargl In-Reply-To: <20060802170712.GB970@troutmask.apl.washington.edu> Message-ID: <20060802181553.V56791@fledge.watson.org> References: <200608021618.k72GI5Bc069006@repoman.freebsd.org> <20060802170712.GB970@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/netinet tcp_subr.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2006 17:18:18 -0000 On Wed, 2 Aug 2006, Steve Kargl wrote: > On Wed, Aug 02, 2006 at 04:18:05PM +0000, Robert Watson wrote: >> >> Modified files: >> sys/netinet tcp_subr.c >> Log: >> Move soisdisconnected() in tcp_discardcb() to one of its calling contexts, >> tcp_twstart(), but not to the other, tcp_detach(), as the socket is >> already being torn down and therefore there are no listeners. This avoids >> a panic if kqueue state is registered on the socket at close(), and >> eliminates to XXX comments. There is one case remaining in which >> tcp_discardcb() reaches up to the socket layer as part of the TCP host >> cache, which would be good to avoid. > > Thanks! You beat me to my bug report. I find myself a bit unsure about the entirely right solution here, though -- protocols inconsistently use soisdisconnected(), and at sometimes odd times. It's clear that, by the time the socket is being freed, the call to soisdisconnected() is too late to be useful. Some protocols, especially datagram protocols, don't use soisdisconnected(), they just remove the connected flag from the socket. It's not clear to me whether protocols should always invoke soisdisconnected() on every socket that's been at least partially connected, and when they should do that. By pru_detach it's too late, but perhaps at pru_close and pru_abort? Or perhaps the socket layer should auto-notify at that point, or just prior to pru_detach... Robert N M Watson Computer Laboratory University of Cambridge