ng_bridge and locks

Gleb Smirnoff glebius at FreeBSD.org
Tue Jan 24 14:53:12 UTC 2012


On Tue, Jan 24, 2012 at 06:09:30AM +0900, rozhuk.im at 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.


More information about the freebsd-net mailing list