netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question on device events and unregister_netdev.
@ 2006-07-11 23:27 Ben Greear
  2006-07-11 23:43 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Greear @ 2006-07-11 23:27 UTC (permalink / raw)
  To: NetDev

Hello!

I'm working on stacking some virtual interfaces, and ran into a problem with
locking.

Basically, I have an ethernet-like device, and on top of that I am putting
802.1Q vlans..and on top of that, some other vlan (macvlan).

In the event notifier for the vlan, I attempt to delete all vlans who's
under-lying device is going away.  I do the same for the macvlan.

Currently, I am setting a deadlock warning because the macvlan code
is calling unregister_netdev, but the 'rmmod' method already has
a lock in there due to having earlier called unregister_netdev on the
.1q vlan.


So, the question is:  Should I be calling unregister_netdev from the notifier
callback?

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


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

* Re: Question on device events and unregister_netdev.
  2006-07-11 23:27 Question on device events and unregister_netdev Ben Greear
@ 2006-07-11 23:43 ` David Miller
  2006-07-11 23:48   ` Ben Greear
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2006-07-11 23:43 UTC (permalink / raw)
  To: greearb; +Cc: netdev

From: Ben Greear <greearb@candelatech.com>
Date: Tue, 11 Jul 2006 16:27:25 -0700

> So, the question is: Should I be calling unregister_netdev from the
> notifier callback?

Not really, as you saw it can be deadlock prone.

One idea is to run the unregister asynchronously via a workqueue.
That should be able to get you out of the deadlock.

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

* Re: Question on device events and unregister_netdev.
  2006-07-11 23:43 ` David Miller
@ 2006-07-11 23:48   ` Ben Greear
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Greear @ 2006-07-11 23:48 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

David Miller wrote:
> From: Ben Greear <greearb@candelatech.com>
> Date: Tue, 11 Jul 2006 16:27:25 -0700
> 
> 
>>So, the question is: Should I be calling unregister_netdev from the
>>notifier callback?
> 
> 
> Not really, as you saw it can be deadlock prone.
> 
> One idea is to run the unregister asynchronously via a workqueue.
> That should be able to get you out of the deadlock.

After more poking, I notice that 802.1q uses unregister_netdevice,
which does not grab rtnl.  It seems that the notifiers are always called
with rtnl asserted.  That would be a recursive call to unregister_netdevice,
however...any reason that won't work?

Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


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

end of thread, other threads:[~2006-07-11 23:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-11 23:27 Question on device events and unregister_netdev Ben Greear
2006-07-11 23:43 ` David Miller
2006-07-11 23:48   ` Ben Greear

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