Re: [PATCH net-next-2.6] net: speedup netdev_set_master()

Previous thread: [PATCH net-2.6] net: Potential null skb->dev dereference by Eric Dumazet on Thursday, March 18, 2010 - 4:19 pm. (2 messages)

Next thread: [PATCH net-next-2.6] atm: Use kasprintf by Eric Dumazet on Thursday, March 18, 2010 - 4:48 pm. (2 messages)
From: Eric Dumazet
Date: Thursday, March 18, 2010 - 4:37 pm

We currently force a synchronize_net() in netdev_set_master()

This seems necessary only when a slave had a master and we dismantle it.

In the other case ("ifenslave bond0 ethO"), we dont need this long
delay.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/net/core/dev.c b/net/core/dev.c
index 17b1686..ff578ff 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3733,11 +3733,10 @@ int netdev_set_master(struct net_device *slave, struct net_device *master)
 
 	slave->master = master;
 
-	synchronize_net();
-
-	if (old)
+	if (old) {
+		synchronize_net();
 		dev_put(old);
-
+	}
 	if (master)
 		slave->flags |= IFF_SLAVE;
 	else


--

From: David Miller
Date: Thursday, March 18, 2010 - 10:22 pm

From: Eric Dumazet <eric.dumazet@gmail.com>

Depends upon the net-2.6 race fix?

Thanks for telling me :-/
--

From: Eric Dumazet
Date: Thursday, March 18, 2010 - 10:28 pm

I believe it's not related. It's net-next-2.6 material, for sure :)

But yes, I discovered the race fix while studying netdev_set_master()

Thanks David


--

From: David Miller
Date: Thursday, March 18, 2010 - 10:36 pm

From: Eric Dumazet <eric.dumazet@gmail.com>

It was not an issue of related, but rather "B won't apply cleanly
without A". Even line offsets can make "git apply" reject.
--

From: Eric Dumazet
Date: Thursday, March 18, 2010 - 10:45 pm

I see, I can resubmit later if you prefer, once net-2.6 fix is pulled in
net-next, there is no hurry :)



--

From: David Miller
Date: Thursday, March 18, 2010 - 11:11 pm

From: Eric Dumazet <eric.dumazet@gmail.com>

No need, just let me know about this stuff in the future, that's
all :-)
--

From: David Miller
Date: Sunday, March 21, 2010 - 6:37 pm

From: Eric Dumazet <eric.dumazet@gmail.com>

Applied.
--

Previous thread: [PATCH net-2.6] net: Potential null skb->dev dereference by Eric Dumazet on Thursday, March 18, 2010 - 4:19 pm. (2 messages)

Next thread: [PATCH net-next-2.6] atm: Use kasprintf by Eric Dumazet on Thursday, March 18, 2010 - 4:48 pm. (2 messages)