On Wednesday, February 27, 2013 17:58:15 Linus Lüssing wrote:
+/**
- batadv_canceled_packets_free - Frees canceled forward packets
- @head: A list of to be freed forw_packets
- This function canceles the scheduling of any packet in the provided
list, + * waits for any possibly running packet forwarding thread to finish and + * finally, safely frees this forward packet.
- This function might sleep.
- */
+static void batadv_canceled_packets_free(struct hlist_head *head) +{
struct batadv_forw_packet *forw_packet;
struct hlist_node *tmp_node, *safe_tmp_node;
hlist_for_each_entry_safe(forw_packet, tmp_node, safe_tmp_node,
head, + canceled_list) {
cancel_delayed_work_sync(&forw_packet->delayed_work);
hlist_del(&forw_packet->canceled_list);
batadv_forw_packet_free(forw_packet);
}
+}
I don't quite see how your patch can work when only one interface is deactivated and not the mesh as a whole. batadv_purge_outstanding_packets() also is called from batadv_hardif_disable_interface() in which case the broadcast packets re-arm themselves by appending the work item to their respective queues. That is why we have the magic "pending" check in the cleanup functions.
Cheers, Marek