* [PATCH net] net: ipv6: Release route when device is unregistering
@ 2017-06-07 18:26 David Ahern
2017-06-07 20:14 ` Roopa Prabhu
2017-06-08 15:13 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: David Ahern @ 2017-06-07 18:26 UTC (permalink / raw)
To: netdev; +Cc: roopa, David Ahern
Roopa reported attempts to delete a bond device that is referenced in a
multipath route is hanging:
$ ifdown bond2 # ifupdown2 command that deletes virtual devices
unregister_netdevice: waiting for bond2 to become free. Usage count = 2
Steps to reproduce:
echo 1 > /proc/sys/net/ipv6/conf/all/ignore_routes_with_linkdown
ip link add dev bond12 type bond
ip link add dev bond13 type bond
ip addr add 2001:db8:2::0/64 dev bond12
ip addr add 2001:db8:3::0/64 dev bond13
ip route add 2001:db8:33::0/64 nexthop via 2001:db8:2::2 nexthop via 2001:db8:3::2
ip link del dev bond12
ip link del dev bond13
The root cause is the recent change to keep routes on a linkdown. Update
the check to detect when the device is unregistering and release the
route for that case.
Fixes: a1a22c12060e4 ("net: ipv6: Keep nexthop of multipath route on admin down")
Reported-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
---
include/linux/netdevice.h | 5 +++++
net/ipv6/route.c | 1 +
2 files changed, 6 insertions(+)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3f39d27decf4..c06d93cfd719 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -4261,6 +4261,11 @@ static inline const char *netdev_name(const struct net_device *dev)
return dev->name;
}
+static inline bool netdev_unregistering(const struct net_device *dev)
+{
+ return dev->reg_state == NETREG_UNREGISTERING;
+}
+
static inline const char *netdev_reg_state(const struct net_device *dev)
{
switch (dev->reg_state) {
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index dc61b0b5e64e..7cebd954d5bb 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2804,6 +2804,7 @@ static int fib6_ifdown(struct rt6_info *rt, void *arg)
if ((rt->dst.dev == dev || !dev) &&
rt != adn->net->ipv6.ip6_null_entry &&
(rt->rt6i_nsiblings == 0 ||
+ (dev && netdev_unregistering(dev)) ||
!rt->rt6i_idev->cnf.ignore_routes_with_linkdown))
return -1;
--
2.11.0 (Apple Git-81)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: ipv6: Release route when device is unregistering
2017-06-07 18:26 [PATCH net] net: ipv6: Release route when device is unregistering David Ahern
@ 2017-06-07 20:14 ` Roopa Prabhu
2017-06-08 15:13 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Roopa Prabhu @ 2017-06-07 20:14 UTC (permalink / raw)
To: David Ahern; +Cc: netdev@vger.kernel.org
On Wed, Jun 7, 2017 at 11:26 AM, David Ahern <dsahern@gmail.com> wrote:
> Roopa reported attempts to delete a bond device that is referenced in a
> multipath route is hanging:
>
> $ ifdown bond2 # ifupdown2 command that deletes virtual devices
> unregister_netdevice: waiting for bond2 to become free. Usage count = 2
>
> Steps to reproduce:
> echo 1 > /proc/sys/net/ipv6/conf/all/ignore_routes_with_linkdown
> ip link add dev bond12 type bond
> ip link add dev bond13 type bond
> ip addr add 2001:db8:2::0/64 dev bond12
> ip addr add 2001:db8:3::0/64 dev bond13
> ip route add 2001:db8:33::0/64 nexthop via 2001:db8:2::2 nexthop via 2001:db8:3::2
> ip link del dev bond12
> ip link del dev bond13
>
> The root cause is the recent change to keep routes on a linkdown. Update
> the check to detect when the device is unregistering and release the
> route for that case.
>
> Fixes: a1a22c12060e4 ("net: ipv6: Keep nexthop of multipath route on admin down")
> Reported-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> ---
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
This patch fixes the issue for me. Thanks David.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: ipv6: Release route when device is unregistering
2017-06-07 18:26 [PATCH net] net: ipv6: Release route when device is unregistering David Ahern
2017-06-07 20:14 ` Roopa Prabhu
@ 2017-06-08 15:13 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-06-08 15:13 UTC (permalink / raw)
To: dsahern; +Cc: netdev, roopa
From: David Ahern <dsahern@gmail.com>
Date: Wed, 7 Jun 2017 12:26:23 -0600
> Roopa reported attempts to delete a bond device that is referenced in a
> multipath route is hanging:
>
> $ ifdown bond2 # ifupdown2 command that deletes virtual devices
> unregister_netdevice: waiting for bond2 to become free. Usage count = 2
>
> Steps to reproduce:
> echo 1 > /proc/sys/net/ipv6/conf/all/ignore_routes_with_linkdown
> ip link add dev bond12 type bond
> ip link add dev bond13 type bond
> ip addr add 2001:db8:2::0/64 dev bond12
> ip addr add 2001:db8:3::0/64 dev bond13
> ip route add 2001:db8:33::0/64 nexthop via 2001:db8:2::2 nexthop via 2001:db8:3::2
> ip link del dev bond12
> ip link del dev bond13
>
> The root cause is the recent change to keep routes on a linkdown. Update
> the check to detect when the device is unregistering and release the
> route for that case.
>
> Fixes: a1a22c12060e4 ("net: ipv6: Keep nexthop of multipath route on admin down")
> Reported-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> Signed-off-by: David Ahern <dsahern@gmail.com>
Applied and queued up for -stable, thanks David.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-08 15:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-07 18:26 [PATCH net] net: ipv6: Release route when device is unregistering David Ahern
2017-06-07 20:14 ` Roopa Prabhu
2017-06-08 15:13 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).