]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commite9eb25c4de9df797d69a8b392953619fafb3dcd1
tree6a35b79ba4b054d09f127dd7dba8e2053fb9195f
parentb66bd1dd8115f328062255addb1fa0dc993716e9
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