git: radix: Fix the non-per-cpu radix tree usage.
sephe at crater.dragonflybsd.org
Tue Feb 1 00:37:17 PST 2011
Author: Sepherosa Ziehau <sephe at dragonflybsd.org>
Date: Tue Feb 1 16:09:26 2011 +0800
radix: Fix the non-per-cpu radix tree usage.
- Install a mask radix tree in each radix tree, while, mask radix tree does
not have mask radix tree (of course).
- rn_cpumaskhead() is added to provide the global per-cpu mask radix tree.
- rn_inithead() requires a mask radix tree as paramter. Mask radix tree is
initialized by passing NULL. INET/INET6/ATALK pass the mask radix tree
obtained from rn_cpumaskhead(), i.e. the old sementics.
- pf(4) now creates its own mask radix tree, and all of its internal radix
trees will use that mask radix tree instead of the global per-cpu mask
radix tree. pf(4) radix tree operations are protected by its own token.
- rn_addmask() requires a mask radix tree, instead of using the global
per-cpu mask radix tree. For most cases, the caller has access to the
radix tree that has a mask radix tree installed. For _rtmask_lookup(),
which is always called from route_output(), we could safely assume that
global per-cpu mask radix tree is used.
This is mainly used to fix the following bug concerning global per-cpu
mask radix tree:
Before this commit, pf(4) could create mask on CPU0's mask radix tree,
while the deletion of the mask happens on other CPUs, which results pf(4)'s
radix tree operation to fail (can't locate the mask).
Root-cause-found-by: Jan Lentfer <Jan.Lentfer at web.de>
Summary of changes:
sys/net/pf/pf.c | 3 +++
sys/net/pf/pf_ioctl.c | 21 +++++++++++++++++++++
sys/net/pf/pf_table.c | 5 +++--
sys/net/pf/pfvar.h | 1 +
sys/net/radix.c | 25 ++++++++++++++++++-------
sys/net/radix.h | 8 ++++++--
sys/net/route.c | 2 +-
sys/netinet/in_rmx.c | 2 +-
sys/netinet6/in6_rmx.c | 2 +-
sys/netproto/atalk/at_rmx.c | 2 +-
10 files changed, 56 insertions(+), 15 deletions(-)
DragonFly BSD source repository
More information about the Commits