netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtnl_unlock/lock in sch_api.c
@ 2005-03-28 14:25 Catalin(ux aka Dino) BOIE
  2005-03-28 14:47 ` Thomas Graf
  2005-03-28 14:50 ` Patrick McHardy
  0 siblings, 2 replies; 7+ messages in thread
From: Catalin(ux aka Dino) BOIE @ 2005-03-28 14:25 UTC (permalink / raw)
  To: netdev; +Cc: davem

[-- Attachment #1: Type: TEXT/PLAIN, Size: 499 bytes --]

Hello!

Trying to load a custom module (same for teql but I didn't tried it)
whan the qdisc module is not loaded, makes tc hang.
This is because qdisc_create aquires rtnl_sem and then tries to load a 
module that tries to register_netdev (that tries to aquire the same 
rtnl_sem).
Applying this patch makes the problem go away.

Signed-off-by: Catalin(ux aka Dino) BOIE <catab at umbrella.ro>

Please apply.

Thanks!

---
Catalin(ux aka Dino) BOIE
catab at deuroconsult.ro
http://kernel.umbrella.ro/

[-- Attachment #2: Type: TEXT/PLAIN, Size: 885 bytes --]

--- linux/net/sched/sch_api.c.orig	2005-03-28 16:32:57.000000000 +0300
+++ linux/net/sched/sch_api.c	2005-03-28 16:38:17.000000000 +0300
@@ -404,18 +404,28 @@ qdisc_create(struct net_device *dev, u32
 	struct Qdisc_ops *ops;
 	int size;
 
+	err = -EINVAL;
 	ops = qdisc_lookup_ops(kind);
 #ifdef CONFIG_KMOD
-	if (ops==NULL && tca[TCA_KIND-1] != NULL) {
+	if (ops == NULL && kind != NULL) {
 		char name[IFNAMSIZ];
 		if (rtattr_strlcpy(name, kind, IFNAMSIZ) < IFNAMSIZ) {
+			/* Must drop rtnl sem because request_module
+			 * can try to aquire rtnl sem (see teql for
+			 * example)
+			 */
+			rtnl_unlock();
 			request_module("sch_%s", name);
+			rtnl_lock();
 			ops = qdisc_lookup_ops(kind);
+			if (ops != NULL) {
+				module_put(ops->owner);
+				err = -EAGAIN;
+			}
 		}
 	}
 #endif
 
-	err = -EINVAL;
 	if (ops == NULL)
 		goto err_out;
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-03-28 22:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-28 14:25 [PATCH] rtnl_unlock/lock in sch_api.c Catalin(ux aka Dino) BOIE
2005-03-28 14:47 ` Thomas Graf
2005-03-28 22:27   ` Catalin(ux aka Dino) BOIE
2005-03-28 14:50 ` Patrick McHardy
2005-03-28 22:16   ` Catalin(ux aka Dino) BOIE
2005-03-28 22:20     ` Patrick McHardy
2005-03-28 22:21       ` Catalin(ux aka Dino) BOIE

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).