소스 검색

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>
David S. Miller 14 년 전
부모
커밋
b8dad61cc7
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      net/ipv4/route.c

+ 4 - 2
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;