aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-01-28 14:07:16 -0800
committerDavid S. Miller <davem@davemloft.net>2011-01-28 14:07:16 -0800
commitb8dad61cc74b9ec71052e2a0e1c5119c65d166da (patch)
tree4291d51fd921d54e3c7d52bcb6a106704d60d061 /net
parentipv4: Attach FIB info to dst_default_metrics when possible (diff)
downloadlinux-dev-b8dad61cc74b9ec71052e2a0e1c5119c65d166da.tar.xz
linux-dev-b8dad61cc74b9ec71052e2a0e1c5119c65d166da.zip
ipv4: If fib metrics are default, no need to grab ref to FIB info.
The fib metric memory in this case is static in the kernel image, so we don't need to reference count it since it's never going to go away on us. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/route.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index dd57f4896736..b1e5d3ac3460 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1861,8 +1861,10 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
{
if (!(rt->fl.flags & FLOWI_FLAG_PRECOW_METRICS)) {
no_cow:
- rt->fi = fi;
- atomic_inc(&fi->fib_clntref);
+ if (fi->fib_metrics != (u32 *) dst_default_metrics) {
+ rt->fi = fi;
+ atomic_inc(&fi->fib_clntref);
+ }
dst_init_metrics(&rt->dst, fi->fib_metrics, true);
} else {
struct inet_peer *peer;