Re: Locking for dev_set_promiscuity()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 8 Oct 2005, Aritz Bastida wrote:

As I have read in net/core/dev.c there are two "locks" related to
devices: rtnl semaphore and dev_base_lock reader/writer spinlock.

This comment relates to dev_base only.

The rtnl semaphore serializes any updates in the networking, making sure there is only one caller updating network parameters at a time.

the dev_base lock makes sure nobody is pulling your feets while reading the dev_base linked list of devices (i.e. guarantees that the device won't disappear under your feets).

The actual flags as such is indeed not protected by a lock and there is a slight chance of inconsistent results (part new, part old) if the flags is being read while updated by another call.

In dev_ifsioc() there is no new locking. It gets or changes the flags,
depending the case. Now, why there is no call to write_lock()? The
comments in net/core/dev.c suggest that you should take the spinlock
for writing, but they dont do that.

There is no write lock because the dev_base list is not modified.

Regards
Henrik
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux