From owner-freebsd-current@FreeBSD.ORG Mon Jul 5 18:11:19 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9E68416A4CF; Mon, 5 Jul 2004 18:11:19 +0000 (GMT) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id CA25443D48; Mon, 5 Jul 2004 18:11:18 +0000 (GMT) (envelope-from glebius@cell.sick.ru) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.12.9/8.12.8) with ESMTP id i65IB7MO060441 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Jul 2004 22:11:07 +0400 (MSD) (envelope-from glebius@cell.sick.ru) Received: (from glebius@localhost) by cell.sick.ru (8.12.9/8.12.6/Submit) id i65IB6wb060440; Mon, 5 Jul 2004 22:11:06 +0400 (MSD) Date: Mon, 5 Jul 2004 22:11:06 +0400 From: Gleb Smirnoff To: Robert Watson Message-ID: <20040705181106.GA60338@cell.sick.ru> References: Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i cc: Julian Elischer cc: current@freebsd.org Subject: Re: ng_ksocket on CURRENT X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2004 18:11:19 -0000 Julian, Robert, it's good that you have already payed attention to my mail. On my way home I have tested the following patch: --- ng_ksocket.c 25 Jun 2004 19:22:03 -0000 1.46 +++ ng_ksocket.c 5 Jul 2004 17:46:24 -0000 @@ -914,7 +914,9 @@ /* Send packet */ priv->flags |= KSF_SENDING; + NET_LOCK_GIANT(); error = (*so->so_proto->pr_usrreqs->pru_sosend)(so, sa, 0, m, 0, 0, td); + NET_UNLOCK_GIANT(); priv->flags &= ~KSF_SENDING; return (error); Seems like it just works. On Mon, Jul 05, 2004 at 12:23:36PM -0400, Robert Watson wrote: R> > It looks like ksocket needs to ensure that it has giant before calling R> > the network stack. R> R> In the debug.mpsafenet=0 scenario, Giant should be held for all of this. R> The bit of missing information below appears to be how we got onto a call R> stack without Giant held -- and it looks like that information isn't in R> the stack trace (?). Normally this would suggest a callout -- I've found R> a couple that may not be holding Giant properly, but neither looks like R> it's a match for this trace. Do you know of a way the stack trace below R> can occur? It looks like the Netgraph netisr holds Giant, and with R> debug.mpsafenet=0, the inbound network path and system calls should as R> well. Robert, yes, this thread is originating from a callout. Actually, it is impossible to reproduce this as I described in previous letter. Sorry. So you suggest to lock Giant in a callout handle? Or should we somewhat tweak ng_ksocket? -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE