Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jan 2012 18:53:10 +0400
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        rozhuk.im@gmail.com
Cc:        freebsd-net@FreeBSD.org
Subject:   Re: ng_bridge and locks
Message-ID:  <20120124145310.GC48157@FreeBSD.org>
In-Reply-To: <4f1dcc8e.45c8cc0a.2935.2254@mx.google.com>
References:  <4f1dcc8e.45c8cc0a.2935.2254@mx.google.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 24, 2012 at 06:09:30AM +0900, rozhuk.im@gmail.com wrote:
r> I found a comment in the code:
r> 	/*
r> 	 * This node has all kinds of stuff that could be screwed by SMP.
r> 	 * Until it gets it's own internal protection, we go through in 
r> 	 * single file. This could hurt a machine bridging beteen two 
r> 	 * GB ethernets so it should be fixed. 
r> 	 * When it's fixed the process SHOULD NOT SLEEP, spinlocks please!
r> 	 * (and atomic ops )
r> 	 */
r> 
r> mtx_init(...., MTX_DEF);
r> How bad to use netgraph node MTX_DEF mutex?

It would be correct to use MTX_DEF mutex to lock the ng_bridge node.

You need smth like a mutex per hash entry, and if all done correctly,
then you can remove NG_NODE_FORCE_WRITER().

-- 
Totus tuus, Glebius.



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