From: Stephen Hemminger <shemminger@vyatta.com>
To: "홍신 shin hong" <hongshin@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: a question on net_device struct
Date: Tue, 11 Aug 2009 09:12:13 -0700 [thread overview]
Message-ID: <20090811091213.0f9068c3@nehalam> (raw)
In-Reply-To: <2014bcab0908110757q5b255dcdm497414d04810c281@mail.gmail.com>
On Tue, 11 Aug 2009 23:57:31 +0900
홍신 shin hong <hongshin@gmail.com> wrote:
> Hi. I have a question while I read the codes in net/core of Linux 2.6.30.4.
>
> 'net_device' struct defined in include/linux/netdevice.h has a field
> 'operstate'.
> Is a 'operstate' field is protected by 'dev_base_lock'?
>
> At set_operstate() in net/core/rtnetlink.c, it seems that dev->operstate
> is protected by write_lock_bh(&dev_base_lock).
> But, in other codes, the read operations to dev->operstate are not
> consistently protected by read_lock_bh(&dev_base_lock).
>
Should be protected by RTNL mutex being held (see rtnl_lock() ).
The dev_base_lock is intended for the list of devices. Operations
that add and delete devices end up holding both.
prev parent reply other threads:[~2009-08-11 16:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-11 14:57 a question on net_device struct 홍신 shin hong
2009-08-11 16:12 ` Stephen Hemminger [this message]
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=20090811091213.0f9068c3@nehalam \
--to=shemminger@vyatta.com \
--cc=hongshin@gmail.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).