cvs commit: src/sys/netinet ip_fw2.c

Alfred Perlstein alfred at freebsd.org
Fri Dec 10 23:10:00 PST 2004


* Christian S.J. Peron <csjp at FreeBSD.org> [041209 18:17] wrote:
> csjp        2004-12-10 02:17:18 UTC
>   
>   It should be noted that this locking mechanism does not guarantee
>   fairness between read and write locks, and that it will favor
>   firewall chain readers over writers. This seemed acceptable since
>   write operations to firewall chains protected by this lock tend to
>   be less frequent than reads.
>   
>   Reviewed by:    andre, rwatson
>   Tested by:      myself, seanc
>   Silence on:     ipfw@
>   MFC after:      1 month
>   
>   Revision  Changes    Path
>   1.85      +69 -29    src/sys/netinet/ip_fw2.c

The code I see doesn't appear to work right.

Can you switch it using sx lock? see the sx_xlock(9) API.

Specifically:

static __inline void
IPFW_RLOCK(struct ip_fw_chain *chain)
{
	mtx_lock(&chain->mtx);
	chain->busy_count++;
	mtx_unlock(&chain->mtx);
}

What if there already is an WLOCK?  It doesn't block the
reader.


-- 
- Alfred Perlstein
- Research Engineering Development Inc.
- email: bright at mu.org cell: 408-480-4684


More information about the cvs-all mailing list