[Devel] [PATCH RHEL7 COMMIT] net/dst: drop leftovers from diff-ve-net-devleak-debug-dump-dst in 2.6.32-x

Konstantin Khorenko khorenko at virtuozzo.com
Mon Dec 18 13:30:36 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-693.11.1.vz7.39.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.11.1.vz7.39.7
------>
commit 6c665ae0fe9151b20d0ecf773afe9b9240618eb2
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Mon Dec 18 12:22:19 2017 +0300

    net/dst: drop leftovers from diff-ve-net-devleak-debug-dump-dst in 2.6.32-x
    
    There was a debug patch in
    https://jira.sw.ru/browse/PCLIN-29838
    
    intended to find out which dst entry holds a ref to netdevice forcing it
    to leak.
    
    Don't see this problem in 3.10.0-x and the code is not used anyway now.
    
    Original comment in diff-ve-net-devleak-debug-dump-dst:
    
      date: 2011/08/31 14:04:43;  author: xemul;  state: Exp;
      Author: Pavel Emelyanov
      Email: xemul at parallels.com
      Subject: net: Dump dst cache contents when netdev leaks
    
      The experience shows that when netdev is leaked the holder is one
      of dst entries. Add some debug for this.
    
      https://jira.sw.ru/browse/PCLIN-29838
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 include/net/dst.h |  6 ------
 net/core/dev.c    |  1 -
 net/core/dst.c    | 16 ----------------
 net/ipv4/route.c  | 25 -------------------------
 net/ipv6/route.c  | 24 ------------------------
 5 files changed, 72 deletions(-)

diff --git a/include/net/dst.h b/include/net/dst.h
index d2ea0fdcc656..3af149ec68b6 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -61,7 +61,6 @@ struct dst_entry {
 #define DST_XFRM_TUNNEL		0x0080
 #define DST_XFRM_QUEUE		0x0100
 #define DST_METADATA		0x0200
-#define DST_FREE		0x0400
 
 	RH_KABI_DEPRECATE(unsigned short, pending_confirm)
 	short			error;
@@ -194,11 +193,6 @@ dst_metric_raw(const struct dst_entry *dst, const int metric)
 	return p[metric-1];
 }
 
-void dst_dump_one(struct dst_entry *d);
-void ip_rt_dump_dsts(void);
-void dst_cache_dump(void);
-extern void (*ip6_rt_dump_dsts)(void);
-
 static inline u32
 dst_metric(const struct dst_entry *dst, const int metric)
 {
diff --git a/net/core/dev.c b/net/core/dev.c
index 2b5c32dca58c..8f93bafe0f62 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7372,7 +7372,6 @@ static void ve_netdev_leak(struct net_device *dev)
 	pr_emerg("Device (%s:%d:%s:%p) marked as leaked\n",
 			dev->name, netdev_refcnt_read(dev) - 1,
 			ve_name(dev_net(dev)->owner_ve), dev);
-	dst_cache_dump();
 }
 
 /**
diff --git a/net/core/dst.c b/net/core/dst.c
index f5299a4901cd..8f3026cc6eed 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -265,7 +265,6 @@ struct dst_entry *dst_destroy(struct dst_entry * dst)
 
 	lwtstate_put(dst->lwtstate);
 
-	dst->flags |= DST_FREE;
 	if (dst->flags & DST_METADATA)
 		metadata_dst_free((struct metadata_dst *)dst);
 	else
@@ -299,21 +298,6 @@ static void dst_destroy_rcu(struct rcu_head *head)
 		__dst_free(dst);
 }
 
-void dst_dump_one(struct dst_entry *d)
-{
-	printk("\tdev %p err %d obs %d flags %x i/o %p/%p ref %d use %d\n",
-			d->dev, (int)d->error, (int)d->obsolete, d->flags,
-			d->input, d->output, atomic_read(&d->__refcnt), d->__use);
-}
-EXPORT_SYMBOL(dst_dump_one);
-
-void dst_cache_dump(void)
-{
-	ip_rt_dump_dsts();
-	if (ip6_rt_dump_dsts)
-		ip6_rt_dump_dsts();
-}
-
 void dst_release(struct dst_entry *dst)
 {
 	if (dst) {
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 137367ad7d75..b4d60db06013 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2934,28 +2934,3 @@ void __init ip_static_sysctl_init(void)
 	register_net_sysctl(&init_net, "net/ipv4/route", ipv4_route_table);
 }
 #endif
-
-#if 0
-static void ip_rt_dump_dst(void *o)
-{
-	struct rtable *rt = (struct rtable *)o;
-
-	if (rt->dst.flags & DST_FREE)
-		return;
-
-	printk("=== %p\n", o);
-	dst_dump_one(&rt->dst);
-	printk("\tgen %x flags %x type %d\n",
-			rt->rt_genid, rt->rt_flags, (int)rt->rt_type);
-}
-#endif
-
-void ip_rt_dump_dsts(void)
-{
-	printk("IPv4 dst cache:\n");
-	//FIXME
-	//slab_obj_walk(ipv4_dst_ops.kmem_cachep, ip_rt_dump_dst);
-}
-
-void (*ip6_rt_dump_dsts)(void);
-EXPORT_SYMBOL_GPL(ip6_rt_dump_dsts);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 4a2a853a1859..d0c303ea9e59 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3735,29 +3735,6 @@ void __init ip6_route_init_special_entries(void)
   #endif
 }
 
-#if 0
-static void ip6_rt_dump_dst(void *o)
-{
-	struct rt6_info *r = (struct rt6_info *)o;
-
-	if (r->dst.flags & DST_FREE)
-		return;
-
-	printk("=== %p\n", o);
-	dst_dump_one(&r->dst);
-	printk("\tflags %x ref %d prot %d\n",
-			r->rt6i_flags, atomic_read(&r->rt6i_ref),
-			(int)r->rt6i_protocol);
-}
-#endif
-
-static void _ip6_rt_dump_dsts(void)
-{
-	printk("IPv6 dst cache:\n");
-	//FIXME
-	//slab_obj_walk(ip6_dst_ops_template.kmem_cachep, ip6_rt_dump_dst);
-}
-
 int __init ip6_route_init(void)
 {
 	int ret;
@@ -3817,7 +3794,6 @@ int __init ip6_route_init(void)
 		spin_lock_init(&ul->lock);
 	}
 
-	ip6_rt_dump_dsts = _ip6_rt_dump_dsts;
 out:
 	return ret;
 


More information about the Devel mailing list