Thread (6 messages) 6 messages, 3 authors, 2011-08-31

Re: [patch net-next-2.6] net: allow notifier subscribers to forbid device from closing

From: Ben Hutchings <hidden>
Date: 2011-08-31 15:26:38

On Wed, 2011-08-31 at 17:15 +0200, Jiri Pirko wrote:
In some situations, like when the device is used as slave device in
bond/br/etc it is not nice if someone closes the device. This allows
it's masters to forbid this closure.
No it doesn't.

[...]
quoted hunk ↗ jump to hunk
@@ -1269,9 +1282,12 @@ static int dev_close_many(struct list_head *head)
 	struct net_device *dev, *tmp;
 	LIST_HEAD(tmp_list);
 
-	list_for_each_entry_safe(dev, tmp, head, unreg_list)
+	list_for_each_entry_safe(dev, tmp, head, unreg_list) {
 		if (!(dev->flags & IFF_UP))
 			list_move(&dev->unreg_list, &tmp_list);
+		else
+			__dev_pre_close(dev);
+	}
 
 	__dev_close_many(head);
The return value is ignored here.

And this is called from dev_close(), where you are adding the
notification as well.  So the notifier will usually be called twice.

[...]
quoted hunk ↗ jump to hunk
@@ -1397,6 +1418,7 @@ rollback:
 				break;
 
 			if (dev->flags & IFF_UP) {
+				nb->notifier_call(nb, NETDEV_PRE_DOWN, dev);
 				nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
 				nb->notifier_call(nb, NETDEV_DOWN, dev);
 			}
[...]

The return value has to be ignored here.  Not sure it makes any sense to
call the notifier at all.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help