summaryrefslogtreecommitdiffstats
path: root/net/core/secure_seq.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2013-09-23 21:19:49 -0700
committerDavid S. Miller <davem@davemloft.net>2013-09-28 15:09:15 -0700
commit50624c934db18ab90aaea4908f60dd39aab4e6e5 (patch)
tree039af57854883e192f5977dc4504ba4849cbb2dd /net/core/secure_seq.c
parent7df37ff33dc122f7bd0614d707939fe84322d264 (diff)
downloadblackbird-op-linux-50624c934db18ab90aaea4908f60dd39aab4e6e5.tar.gz
blackbird-op-linux-50624c934db18ab90aaea4908f60dd39aab4e6e5.zip
net: Delay default_device_exit_batch until no devices are unregistering v2
There is currently serialization network namespaces exiting and network devices exiting as the final part of netdev_run_todo does not happen under the rtnl_lock. This is compounded by the fact that the only list of devices unregistering in netdev_run_todo is local to the netdev_run_todo. This lack of serialization in extreme cases results in network devices unregistering in netdev_run_todo after the loopback device of their network namespace has been freed (making dst_ifdown unsafe), and after the their network namespace has exited (making the NETDEV_UNREGISTER, and NETDEV_UNREGISTER_FINAL callbacks unsafe). Add the missing serialization by a per network namespace count of how many network devices are unregistering and having a wait queue that is woken up whenever the count is decreased. The count and wait queue allow default_device_exit_batch to wait until all of the unregistration activity for a network namespace has finished before proceeding to unregister the loopback device and then allowing the network namespace to exit. Only a single global wait queue is used because there is a single global lock, and there is a single waiter, per network namespace wait queues would be a waste of resources. The per network namespace count of unregistering devices gives a progress guarantee because the number of network devices unregistering in an exiting network namespace must ultimately drop to zero (assuming network device unregistration completes). The basic logic remains the same as in v1. This patch is now half comment and half rtnl_lock_unregistering an expanded version of wait_event performs no extra work in the common case where no network devices are unregistering when we get to default_device_exit_batch. Reported-by: Francesco Ruggeri <fruggeri@aristanetworks.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/secure_seq.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud