duplicate read/write locks in net/pfil.c and netinet/ip_fw2.c

Luigi Rizzo rizzo at icir.org
Wed Aug 17 00:05:20 GMT 2005


[apologies for the cross post but it belongs both to arch and net.]

I notice that net/pfil.c and netinet/ip_fw2.c have two copies of
aisimilar but slightly different implementation of
multiple-reader/single-writer locks, which brings up the question(s):

1. should we rather put this code in the generic kernel code so that other
   subsystems could make use of it ? E.g. the routing table is certainly
   a candidate, 

and especially

2. should we implement it right ?

   Both implementations are subject to starvation for the writers
   (which is indeed a problem here, because we might want to modify
   a ruleset and be prevented from doing it because of incoming traffic
   that keeps readers active).
   Also the PFIL_TRY_WLOCK will in fact be blocking if a writer
   is already in - i have no idea how problematic is this in the
   way it is actually used.


	cheers
	luigi


More information about the freebsd-net mailing list