netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* a question on net_device struct
@ 2009-08-11 14:57 홍신 shin hong
  2009-08-11 16:12 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: 홍신 shin hong @ 2009-08-11 14:57 UTC (permalink / raw)
  To: netdev

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

Thank you.

Sincerely
Shin Hong

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

* Re: a question on net_device struct
  2009-08-11 14:57 a question on net_device struct 홍신 shin hong
@ 2009-08-11 16:12 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2009-08-11 16:12 UTC (permalink / raw)
  To: 홍신 shin hong; +Cc: netdev

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.

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

end of thread, other threads:[~2009-08-11 16:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-11 14:57 a question on net_device struct 홍신 shin hong
2009-08-11 16:12 ` Stephen Hemminger

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