tuntap: RCUify dereferencing between tun_struct and tun_file
commit6e914fc70793f540015bd99744cd456b8d7fdfbd
authorJason Wang <jasowang@redhat.com>
Wed, 31 Oct 2012 19:45:58 +0000 (31 19:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Nov 2012 15:14:07 +0000 (1 11:14 -0400)
tree4f140c57638a42b7969b158e4fd0b6e4df8ecc11
parent54f968d6efdbf7dec36faa44fc11f01b0e4d1990
tuntap: RCUify dereferencing between tun_struct and tun_file

RCU were introduced in this patch to synchronize the dereferences between
tun_struct and tun_file. All tun_{get|put} were replaced with RCU, the
dereference from one to other must be done under rtnl lock or rcu read critical
region.

This is needed for the following patches since the one of the goal of multiqueue
tuntap is to allow adding or removing queues during workload. Without RCU,
control path would hold tx locks when adding or removing queues (which may cause
sme delay) and it's hard to change the number of queues without stopping the net
device. With the help of rcu, there's also no need for tun_file hold an refcnt
to tun_struct.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c