From owner-svn-src-head@FreeBSD.ORG Tue Dec 16 17:21:40 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1A381065672 for ; Tue, 16 Dec 2008 17:21:40 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by mx1.freebsd.org (Postfix) with ESMTP id 32C518FC2C for ; Tue, 16 Dec 2008 17:21:39 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-067-224-053.pools.arcor-ip.net [88.67.224.53]) by mrelayeu.kundenserver.de (node=mrelayeu4) with ESMTP (Nemesis) id 0ML21M-1LCdc21geO-0003sE; Tue, 16 Dec 2008 18:21:38 +0100 Received: (qmail 49845 invoked from network); 16 Dec 2008 17:21:38 -0000 Received: from unknown (HELO fbsd8.laiers.local) (192.168.4.151) by router.laiers.local with SMTP; 16 Dec 2008 17:21:38 -0000 From: Max Laier Organization: FreeBSD To: Robert Watson Date: Tue, 16 Dec 2008 18:21:37 +0100 User-Agent: KMail/1.10.1 (FreeBSD/8.0-CURRENT; KDE/4.1.1; i386; ; ) References: <200812161703.mBGH3M7m042955@svn.freebsd.org> In-Reply-To: <200812161703.mBGH3M7m042955@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812161821.37686.max@love2party.net> X-Provags-ID: V01U2FsdGVkX1+74ADfWmBL1XOEKtRaeXzFYIyneYRin4bjRQv sjyspjzDQmIMCFTbzeeE59vMd7I6zWzSZ0IFmJhR75KuWpOKC7 QcBF5y57Ay/eKwO9VQ5tg== Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r186187 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2008 17:21:40 -0000 On Tuesday 16 December 2008 18:03:22 Robert Watson wrote: > Author: rwatson > Date: Tue Dec 16 17:03:22 2008 > New Revision: 186187 > URL: http://svn.freebsd.org/changeset/base/186187 > > Log: > A few locking fixes and cleanups to pfil hook registration, > unregistration, and execution: > > - Add some brackets for clarity and trim a bit of vertical whitespace. > - Remove comments that may not contribute to clarity, such as "Lock" > before acquiring a lock and "Get memory" before allocating memory. These were meant as sectioning comments as pfil_add_hook grew larger and larger in order to allow WAITOK allocations. Should probably have been "/* 1. get memory */" etc. > - During hook registration, don't drop pfil_list_lock between checking > for a duplicate and registering the hook, as this leaves a race > condition by failing to enforce the "no duplicate hooks" invariant. > - Don't lock the hook during registration, since it's not yet in use. Shouldn't the WLOCK be obtained regardless in order to obtain a memory barrier for the reading threads? pfil_run_hooks doesn't interact with the LIST_LOCK so it's unclear in what state the hook head will be when the hook head is first read. > - Document assumption that hooks will be quiesced before being > unregistered. This should probably go to pfil(9), too. > - Don't write-lock hooks during removal because they are assumed > quiesced. Again, this lock also ensures that we see all the changes done in other threads to the pfil head recently - otherwise we might leak a hook function pointer or even fault due to list inconsistencies. Again, add/del_hook don't interact with the LIST_LOCK. > - Rename "done" label to "locked_error" to be clear that it's an error > path on the way out of hook execution. > > MFC after: pretty soon -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News