Re: [2.5.69] rtnl-deadlock with usermodehelper and keventd

David S. Miller
2003-05-23T09:31:56Z

From: Martin Diehl <lists@mdiehl.de>
Date: Fri, 23 May 2003 11:38:38 +0200 (CEST)

On Thu, 22 May 2003, David S. Miller wrote:

> Asking just because there was another user hitting this deadlock:
>
> It's fixed in current 2.5.x sources, wake up :-)

Oops, sorry for the noise, I hadn't noticed this yet.

But nope, unfortunately it's still hanging! I've just tested with
2.5.69-bk15. Running into the same deadlock due to sleeping with rtnl
hold. This time however it seems it's triggered from sysfs side!

Stephen, you need to do the device class stuff outside of the RTNL
lock please.

At least I didn't add this bug :-)

This should fix it.

--- net/core/dev.c.~1~ Fri May 23 02:42:37 2003
+++ net/core/dev.c Fri May 23 02:43:20 2003
@@ -2754,6 +2754,8 @@

dev->next = NULL;

+ netdev_unregister_sysfs(dev);
+
netdev_wait_allrefs(dev);

BUG_ON(atomic_read(&dev->refcnt));
@@ -2841,8 +2843,6 @@
BUG_TRAP(!dev->master);

free_divert_blk(dev);
-
- netdev_unregister_sysfs(dev);

spin_lock(&unregister_todo_lock);
dev->next = unregister_todo;