cvs commit: src/sys/netinet ip_fw2.c
Andre Oppermann
andre at freebsd.org
Sat Dec 11 02:52:37 PST 2004
Alfred Perlstein wrote:
>
> * 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.
Have a look at IPFW_WLOCK(). It doesn't release the mutex and thus
the busy_count++ will never be reached unless IPFW_WUNLOCK is called
by the writer.
--
Andre
More information about the cvs-all
mailing list