Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172033
b: refs/heads/master
c: a5ee155
h: refs/heads/master
i:
  172031: 34ad129
v: v3
  • Loading branch information
Eric W. Biederman authored and David S. Miller committed Dec 2, 2009
1 parent d64ef6e commit 0f63def
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5a5b6f6f62ac684a5856121d8cffd3c3253dc890
refs/heads/master: a5ee155136b4a8f4ab0e4c9c064b661da475e298
2 changes: 1 addition & 1 deletion trunk/include/linux/notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static inline int notifier_to_errno(int ret)
#define NETDEV_BONDING_OLDTYPE 0x000E
#define NETDEV_BONDING_NEWTYPE 0x000F
#define NETDEV_POST_INIT 0x0010
#define NETDEV_UNREGISTER_PERNET 0x0011
#define NETDEV_UNREGISTER_BATCH 0x0011

#define SYS_DOWN 0x0001 /* Notify of system down */
#define SYS_RESTART SYS_DOWN
Expand Down
1 change: 1 addition & 0 deletions trunk/include/net/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ extern int ip_rt_init(void);
extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
__be32 src, struct net_device *dev);
extern void rt_cache_flush(struct net *net, int how);
extern void rt_cache_flush_batch(void);
extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
Expand Down
36 changes: 9 additions & 27 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ int register_netdevice_notifier(struct notifier_block *nb)
nb->notifier_call(nb, NETDEV_DOWN, dev);
}
nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
nb->notifier_call(nb, NETDEV_UNREGISTER_PERNET, dev);
nb->notifier_call(nb, NETDEV_UNREGISTER_BATCH, dev);
}
}

Expand Down Expand Up @@ -4771,8 +4771,7 @@ static void net_set_todo(struct net_device *dev)

static void rollback_registered_many(struct list_head *head)
{
struct net_device *dev, *aux, *fdev;
LIST_HEAD(pernet_list);
struct net_device *dev;

BUG_ON(dev_boot_phase);
ASSERT_RTNL();
Expand Down Expand Up @@ -4828,26 +4827,14 @@ static void rollback_registered_many(struct list_head *head)
netdev_unregister_kobject(dev);
}

synchronize_net();
/* Process any work delayed until the end of the batch */
dev = list_entry(head->next, struct net_device, unreg_list);
call_netdevice_notifiers(NETDEV_UNREGISTER_BATCH, dev);

list_for_each_entry_safe(dev, aux, head, unreg_list) {
int new_net = 1;
list_for_each_entry(fdev, &pernet_list, unreg_list) {
if (net_eq(dev_net(dev), dev_net(fdev))) {
new_net = 0;
dev_put(dev);
break;
}
}
if (new_net)
list_move(&dev->unreg_list, &pernet_list);
}
synchronize_net();

list_for_each_entry_safe(dev, aux, &pernet_list, unreg_list) {
call_netdevice_notifiers(NETDEV_UNREGISTER_PERNET, dev);
list_move(&dev->unreg_list, head);
list_for_each_entry(dev, head, unreg_list)
dev_put(dev);
}
}

static void rollback_registered(struct net_device *dev)
Expand Down Expand Up @@ -5129,7 +5116,7 @@ static void netdev_wait_allrefs(struct net_device *dev)

/* Rebroadcast unregister notification */
call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
/* don't resend NETDEV_UNREGISTER_PERNET, _PERNET users
/* don't resend NETDEV_UNREGISTER_BATCH, _BATCH users
* should have already handle it the first time */

if (test_bit(__LINK_STATE_LINKWATCH_PENDING,
Expand Down Expand Up @@ -5442,11 +5429,6 @@ EXPORT_SYMBOL(unregister_netdevice_queue);
/**
* unregister_netdevice_many - unregister many devices
* @head: list of devices
*
* WARNING: Calling this modifies the given list
* (in rollback_registered_many). It may change the order of the elements
* in the list. However, you can assume it does not add or delete elements
* to/from the list.
*/
void unregister_netdevice_many(struct list_head *head)
{
Expand Down Expand Up @@ -5555,7 +5537,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
this device. They should clean all the things.
*/
call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
call_netdevice_notifiers(NETDEV_UNREGISTER_PERNET, dev);
call_netdevice_notifiers(NETDEV_UNREGISTER_BATCH, dev);

/*
* Flush the unicast and multicast chains
Expand Down
4 changes: 3 additions & 1 deletion trunk/net/ipv4/fib_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,9 +959,11 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
break;
case NETDEV_CHANGEMTU:
case NETDEV_CHANGE:
case NETDEV_UNREGISTER_PERNET:
rt_cache_flush(dev_net(dev), 0);
break;
case NETDEV_UNREGISTER_BATCH:
rt_cache_flush_batch();
break;
}
return NOTIFY_DONE;
}
Expand Down
6 changes: 6 additions & 0 deletions trunk/net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,12 @@ void rt_cache_flush(struct net *net, int delay)
rt_do_flush(!in_softirq());
}

/* Flush previous cache invalidated entries from the cache */
void rt_cache_flush_batch(void)
{
rt_do_flush(!in_softirq());
}

/*
* We change rt_genid and let gc do the cleanup
*/
Expand Down

0 comments on commit 0f63def

Please sign in to comment.