Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Dec 2004 23:10:00 -0800
From:      Alfred Perlstein <alfred@freebsd.org>
To:        "Christian S.J. Peron" <csjp@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/netinet ip_fw2.c
Message-ID:  <20041211070959.GT20783@elvis.mu.org>
In-Reply-To: <200412100217.iBA2HI2L008474@repoman.freebsd.org>
References:  <200412100217.iBA2HI2L008474@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
* Christian S.J. Peron <csjp@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@mu.org cell: 408-480-4684



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