Skip to contentSkip to conversation

Force IPv6 FIB gc on device shutdown

PATCH In review Andi Kleen 2 participants 2 messages Apr 9, 2004

Subsystems (3)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Force IPv6 FIB gc on device shutdown

A few people reported problems with shutdown complaining about lost reference counts in network devices. The problem was that the IPv6 FIB kept some device references around and only dropped it on the next GC timer run, which happens only every 10s.

This patch forces a garbage collection on device shutdown.

-Andi

net/ipv6/ndisc.c renamed from net/ipv6/ndisc.c-o +3 -0
diff -u linux/net/ipv6/ndisc.c-o linux/net/ipv6/ndisc.c
@@ -1564,6 +1564,9 @@
 		neigh_changeaddr(&nd_tbl, dev);
 		fib6_run_gc(0);
 		break;
+	case NETDEV_UNREGISTER:
+		fib6_run_gc(0);
+		break;
 	default:
 		break;
 	}
#1 lore raw

Thanks Andi.

A week ago Thomas Spatzier posted a similar patch, and I had asked Stephen Hemminger (in private email) for his take on this.

So here is the final patch I applied, based upon your and Thomas's patches, plus Stephen's commentary. (hint: NETDEV_DOWN is sufficient, because unregister causes a NETDEV_DOWN event if necessary).

Thanks everyone.

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/04/09 15:29:23-07:00 [email protected]
# [IPV6]: In ndisc_netdev_event, handle NETDEV_DOWN.
#
# Based upon patches and commentary from Thomas Spatzier,
# Stephen Hemminger, and Andi Kleen.
#

# net/ipv6/ndisc.c
#   2004/04/09 15:29:00-07:00 [email protected] +4 -0
#   [IPV6]: In ndisc_netdev_event, handle NETDEV_DOWN.
#   
#   Based upon patches and commentary from Thomas Spatzier,
#   Stephen Hemminger, and Andi Kleen.
# 
diff -Nru a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
--- a/net/ipv6/ndisc.c	Fri Apr  9 15:30:59 2004
+++ b/net/ipv6/ndisc.c	Fri Apr  9 15:30:59 2004
@@ -1403,6 +1403,10 @@
 		neigh_changeaddr(&nd_tbl, dev);
 		fib6_run_gc(0);
 		break;
+	case NETDEV_DOWN:
+		neigh_ifdown(&nd_tbl, dev);
+		fib6_run_gc(0);
+		break;
 	default:
 		break;
 	}