]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - net/batman-adv/types.h
batman-adv: Modify mesh_iface outside sysfs context
authorSven Eckelmann <sven@narfation.org>
Mon, 13 Jun 2016 05:41:30 +0000 (07:41 +0200)
committerSimon Wunderlich <sw@simonwunderlich.de>
Tue, 9 Aug 2016 05:54:27 +0000 (07:54 +0200)
commit77d69d8ce17ce0d2a29d042e27943b0a8cea302d
tree6a35b79ba4b054d09f127dd7dba8e2053fb9195f
parentf2c750fedd2e102b95a3b1008703b9f54bbc9b08
batman-adv: Modify mesh_iface outside sysfs context

The legacy sysfs interface to modify interfaces belonging to batman-adv
is run inside a region holding s_lock. And to add a net_device, it has
to also get the rtnl_lock. This is exactly the other way around than in
other virtual net_devices and conflicts with netdevice notifier which
executes inside rtnl_lock.

The inverted lock situation is currently solved by executing the removal
of netdevices via workqueue. The workqueue isn't executed inside
rtnl_lock and thus can independently get the s_lock and the rtnl_lock.

But this workaround fails when the netdevice notifier creates events in
quick succession and the earlier triggered removal of a net_device isn't
processed in the workqueue before the adding of the new netdevice (with
same name) event is issued.

Instead the legacy sysfs interface store events have to be enqueued in
a workqueue to loose the s_lock. The worker is then free to get the
required locks and the deadlock is avoided.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/sysfs.c
net/batman-adv/types.h