From: Stephen Hemminger <shemminger@vyatta.com>
To: Jeba Anandhan <jeba.anandhan@vaioni.com>
Cc: netdev@vger.kernel.org, matthew.hattersley@vaioni.com
Subject: Re: unregister_netdev() deadlock
Date: Wed, 27 Feb 2008 08:46:24 -0800 [thread overview]
Message-ID: <20080227084624.163c762b@extreme> (raw)
In-Reply-To: <1204127094.11318.0.camel@vglwks010.vgl2.office.vaioni.com>
On Wed, 27 Feb 2008 15:44:54 +0000
Jeba Anandhan <jeba.anandhan@vaioni.com> wrote:
> Hi all,
> I have doubts about unregister the netdevice.
>
> Scenario
> I have two netdevice entities. I wish to unregister one entity.
>
> struct net_device *dev1;
> struct net_device *dev2;
>
> dev1->timer = XXX;
> dev2->timer = YYY;
>
> dev1->ioctl() {
>
> ...
> case delete_other:
> unregister_netdev(dev2);
> free_netdev(dev2);
> return 0;
> ...
> }
>
> The dev2->refcnt is not zero in this case. unregister_netdev(dev2) cause
> deadlock. Could you tell me why it happens?.
>
>
> It works smoothly when we call the unregister_netdev(dev2) from
> cleanup_module(). dev2->refcnt is not zero in this case. Still it is
> able to unregister.
>
>
> Thanks
> Jeba
>
You need to properly manage device refcounts (or delete both).
Also since dev1->ioctl is called with RTNL you can't:
use unregister_netdev() recursive locking (use unregister_netdevice)
or call free_netdev because of netdevice could still be in use (use dev->destructor instead).
next prev parent reply other threads:[~2008-02-27 16:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-27 15:44 unregister_netdev() deadlock Jeba Anandhan
2008-02-27 16:46 ` Stephen Hemminger [this message]
2008-02-27 17:05 ` Jeba Anandhan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080227084624.163c762b@extreme \
--to=shemminger@vyatta.com \
--cc=jeba.anandhan@vaioni.com \
--cc=matthew.hattersley@vaioni.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).