From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Marek Lindner Date: Sun, 3 Mar 2013 13:06:41 +0800 References: <1361959096-30522-1-git-send-email-linus.luessing@web.de> In-Reply-To: <1361959096-30522-1-git-send-email-linus.luessing@web.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201303031306.41769.lindner_marek@yahoo.de> Subject: Re: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix broadcast+ogm queue purging race condition Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: b.a.t.m.a.n@lists.open-mesh.org On Wednesday, February 27, 2013 17:58:15 Linus L=C3=BCssing 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=20 deactivated and not the mesh as a whole. batadv_purge_outstanding_packets()= =20 also is called from batadv_hardif_disable_interface() in which case the=20 broadcast packets re-arm themselves by appending the work item to their=20 respective queues. That is why we have the magic "pending" check in the=20 cleanup functions. Cheers, Marek