[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081001194825.GA2520@ami.dom.local>
Date: Wed, 1 Oct 2008 21:48:25 +0200
From: Jarek Poplawski <jarkao2@...il.com>
To: Benjamin Thery <benjamin.thery@...l.net>
Cc: "David S. Miller" <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Daniel Lezcano <dlezcano@...ibm.com>
Subject: Re: [PATCH] net: deadlock during net device unregistration - V2
On Wed, Oct 01, 2008 at 04:14:35PM +0200, Benjamin Thery wrote:
> This is the second version of a patch aimed at fixing a deadlock that
> can occur when unregistering net devices.
>
> This new version of the patch ensures the garbage collector
> dst_gc_task() is run when waiting in netdev_wait_allrefs(), by calling
> it in the netdevice notifier dst_dev_event() when receiving a
> NETDEV_UNREGISTER event.
>
> Thanks to Jarek Poplawski for proposing this fix.
Not at all! Actually, I'm sorry for this mess... (Read below.)
> (The previous version proposed to replace in linkwatch_event()
> the call to rntl_unlock() by __rtnl_lock())
...
> --- net-next-2.6.orig/net/core/dst.c
> +++ net-next-2.6/net/core/dst.c
> @@ -328,6 +328,10 @@ static int dst_dev_event(struct notifier
> dst_ifdown(dst, dev, event != NETDEV_DOWN);
> }
> mutex_unlock(&dst_gc_mutex);
> +
> + if (event == NETDEV_UNREGISTER &&
> + cancel_delayed_work(&dst_gc_work))
> + dst_gc_task(&dst_gc_work.work);
Hmm... It seems this shouldn't work yet: cancel_delayed_work() can only
kill this while on timer, but not when queued and maybe blocked already.
Probably cancel_delayed_work_sync() should be considered instead, but
since this needs more checking, and David is waiting for this, I think
it's safer to use this previous (__rtnl_unlock) patch for now
(especially for -stable).
Thanks,
Jarek P.
--
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