[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20081007.155039.199136099.davem@davemloft.net>
Date: Tue, 07 Oct 2008 15:50:39 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: herbert@...dor.apana.org.au
Cc: benjamin.thery@...l.net, netdev@...r.kernel.org,
dlezcano@...ibm.com
Subject: Re: [PATCH] net: deadlock during net device unregistration
From: Herbert Xu <herbert@...dor.apana.org.au>
Date: Sun, 05 Oct 2008 12:26:21 +0800
> net: Fix netdev_run_todo dead-lock
>
> Benjamin Thery tracked down a bug that explains many instances
> of the error
>
> unregister_netdevice: waiting for %s to become free. Usage count = %d
>
> It turns out that netdev_run_todo can dead-lock with itself if
> a second instance of it is run in a thread that will then free
> a reference to the device waited on by the first instance.
>
> The problem is really quite silly. We were trying to create
> parallelism where none was required. As netdev_run_todo always
> follows a RTNL section, and that todo tasks can only be added
> with the RTNL held, by definition you should only need to wait
> for the very ones that you've added and be done with it.
>
> There is no need for a second mutex or spinlock.
>
> This is exactly what the following patch does.
>
> Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>
Ok, this looks safe. I've applied this to net-2.6, thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists