summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/hard-interface.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2016-06-13 01:41:31 -0400
committerSimon Wunderlich <sw@simonwunderlich.de>2016-08-09 01:54:27 -0400
commit569c98504b2004dba207127bcceb8f3aeb9b8e7d (patch)
tree8d51cda7b5e931668dbe15e9d45305da5c564bdd /net/batman-adv/hard-interface.c
parent77d69d8ce17ce0d2a29d042e27943b0a8cea302d (diff)
batman-adv: Revert "postpone sysfs removal when unregistering"
Postponing the removal of the interface breaks the expected behavior of NETDEV_UNREGISTER and NETDEV_PRE_TYPE_CHANGE. This is especially problematic when an interface is removed and added in quick succession. This reverts commit 5bc44dc8458c ("batman-adv: postpone sysfs removal when unregistering"). Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Diffstat (limited to 'net/batman-adv/hard-interface.c')
-rw-r--r--net/batman-adv/hard-interface.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 1f9080840566..714af8e7bfa5 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -35,7 +35,6 @@
35#include <linux/rtnetlink.h> 35#include <linux/rtnetlink.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/workqueue.h>
39 38
40#include "bat_v.h" 39#include "bat_v.h"
41#include "bridge_loop_avoidance.h" 40#include "bridge_loop_avoidance.h"
@@ -625,25 +624,6 @@ out:
625 batadv_hardif_put(primary_if); 624 batadv_hardif_put(primary_if);
626} 625}
627 626
628/**
629 * batadv_hardif_remove_interface_finish - cleans up the remains of a hardif
630 * @work: work queue item
631 *
632 * Free the parts of the hard interface which can not be removed under
633 * rtnl lock (to prevent deadlock situations).
634 */
635static void batadv_hardif_remove_interface_finish(struct work_struct *work)
636{
637 struct batadv_hard_iface *hard_iface;
638
639 hard_iface = container_of(work, struct batadv_hard_iface,
640 cleanup_work);
641
642 batadv_debugfs_del_hardif(hard_iface);
643 batadv_sysfs_del_hardif(&hard_iface->hardif_obj);
644 batadv_hardif_put(hard_iface);
645}
646
647static struct batadv_hard_iface * 627static struct batadv_hard_iface *
648batadv_hardif_add_interface(struct net_device *net_dev) 628batadv_hardif_add_interface(struct net_device *net_dev)
649{ 629{
@@ -676,8 +656,6 @@ batadv_hardif_add_interface(struct net_device *net_dev)
676 656
677 INIT_LIST_HEAD(&hard_iface->list); 657 INIT_LIST_HEAD(&hard_iface->list);
678 INIT_HLIST_HEAD(&hard_iface->neigh_list); 658 INIT_HLIST_HEAD(&hard_iface->neigh_list);
679 INIT_WORK(&hard_iface->cleanup_work,
680 batadv_hardif_remove_interface_finish);
681 659
682 spin_lock_init(&hard_iface->neigh_list_lock); 660 spin_lock_init(&hard_iface->neigh_list_lock);
683 661
@@ -719,7 +697,9 @@ static void batadv_hardif_remove_interface(struct batadv_hard_iface *hard_iface)
719 return; 697 return;
720 698
721 hard_iface->if_status = BATADV_IF_TO_BE_REMOVED; 699 hard_iface->if_status = BATADV_IF_TO_BE_REMOVED;
722 queue_work(batadv_event_workqueue, &hard_iface->cleanup_work); 700 batadv_debugfs_del_hardif(hard_iface);
701 batadv_sysfs_del_hardif(&hard_iface->hardif_obj);
702 batadv_hardif_put(hard_iface);
723} 703}
724 704
725void batadv_hardif_remove_interfaces(void) 705void batadv_hardif_remove_interfaces(void)