[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090811091213.0f9068c3@nehalam>
Date: Tue, 11 Aug 2009 09:12:13 -0700
From: Stephen Hemminger <shemminger@...tta.com>
To: 홍신 shin hong <hongshin@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: a question on net_device struct
On Tue, 11 Aug 2009 23:57:31 +0900
홍신 shin hong <hongshin@...il.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.
--
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