From owner-cvs-all Tue May 28 11:56:25 2002 Delivered-To: cvs-all@freebsd.org Received: from mail.speakeasy.net (mail12.speakeasy.net [216.254.0.212]) by hub.freebsd.org (Postfix) with ESMTP id 0DD4937B40C for ; Tue, 28 May 2002 11:56:09 -0700 (PDT) Received: (qmail 19609 invoked from network); 28 May 2002 18:56:06 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail12.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 28 May 2002 18:56:07 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g4SIuIF24343; Tue, 28 May 2002 14:56:18 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200205251910.g4PJAFn2088378@khavrinen.lcs.mit.edu> Date: Tue, 28 May 2002 14:55:45 -0400 (EDT) From: John Baldwin To: Garrett Wollman Subject: Re: cvs commit: src/sys/kern uipc_socket.c Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 25-May-2002 Garrett Wollman wrote: > < said: > >> Then put the XXX over the gencount not the bzero so it actually makes sense. > > It's the bzero that causes the race. The comment is in the right > place, and makes perfect sense if you've paid any attention to > non-blocking synchronization. We allocate a new socket, with _NO_ other references to it from anyone else. How in the world do we end up with a race when we do the bzero? Who are we racing with? The only thing I can see in soalloc() that needs locking work is that so_gencnt and numopensockets need a lock. However, for the socket structure we just got back from malloc() that doesn't have any external references yet aside from the one local variable in soalloc(), how can any other thread even get to the socket to wreak havoc? > The purpose is to make it possible to copy out a list of thousands of > sockets reliably (mostly) without blocking the network stack, so that > activity doesn't grind to a halt whenever someone runs `netstat' on a > machine with 10,000 sockets outstanding. I fail to see why doing a bzero() on a private variable can block the network stack. > -GAWollman -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message