net list protected by rcu
Hi,
Benjamin and I, we are currently looking for using IPV6 for the network namespaces.
There is a special case where we must browse the network namespace list to check the routes ages at a given time for garbage collecting.
fib6_run_gc
=> fib6_clean_all
In this function we browse the network namespace list with the usual macro: for_each_net, which should be protected by rtnl_lock.
The function fib6_run_gc is a timer callback, that means we are called from interrupt handler. But in this case, we can not use rtnl_lock because it locks a mutex and this is forbidden to do that from an interrupt handler.
If we put apart the fact there is perhaps a better solution than browsing the netns list (eg. make a gc timer per namespace), can we consider to simply use the RCU to lock the network namespace list ?
So we can remove the rtnl_lock calls in the network namespaces and just use rcu_read_lock for browsing the netns list in the network code. That will be more flexible, we can use it in interrupt handler, we can nest with another rcu_read_lock and we don't add more locking contention for the network.