From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from he.sipsolutions.net ([78.46.109.217]:53604 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755922Ab2LMSf5 (ORCPT ); Thu, 13 Dec 2012 13:35:57 -0500 Message-ID: <1355423779.9463.13.camel@jlt4.sipsolutions.net> (sfid-20121213_193601_246727_BCBB9EC4) Subject: Re: Add a new work-queue for destructing stations? From: Johannes Berg To: Ben Greear Cc: "linux-wireless@vger.kernel.org" , Eliad Peller Date: Thu, 13 Dec 2012 19:36:19 +0100 In-Reply-To: <1355423271.9463.11.camel@jlt4.sipsolutions.net> (sfid-20121213_192745_389892_F9637F1C) References: <50CA1470.4030107@candelatech.com> (sfid-20121213_184629_945929_240FAE82) <1355421541.9463.8.camel@jlt4.sipsolutions.net> <50CA1C44.5030300@candelatech.com> <1355423047.9463.9.camel@jlt4.sipsolutions.net> (sfid-20121213_192352_293430_50F585FD) <1355423271.9463.11.camel@jlt4.sipsolutions.net> (sfid-20121213_192745_389892_F9637F1C) Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org List-ID: On Thu, 2012-12-13 at 19:27 +0100, Johannes Berg wrote: > On Thu, 2012-12-13 at 19:24 +0100, Johannes Berg wrote: > > On Thu, 2012-12-13 at 10:19 -0800, Ben Greear wrote: > > > > > > I don't think that's easy, but you're welcome to try. The > > > > free_sta_work() function references the sdata so it absolutely must run > > > > at this point. > > > > > So, cancel_work_sync(&sdata->work) would appear to remove > > > all pending sdata->work items from the work-queue. As long as > > > there are no other different work items that reference > > > sdata (and maybe there are..I haven't looked at all of them), > > > then we should be safe to execute the free_sta_work() > > > on a different work-queue safely, I think.... > > > > Sorry, I don't get it. free_sta_work() *itself* has to be executed > > before the sdata is destroyed. cancel_work_sync(&sdata->work) has > > nothing to do with free_sta_work. > > In fact, this is already buggy now, and I should probably revert > b22cfcfca, because the work item might run after the AP is stopped and > then we call into the driver anyway, and on teardown things are probably > messed up. I'll poke at it tomorrow. Oh I know an easy way to fix this: we just add the stations to a (per-sdata?) "cleanup" list in the rcu callback and run a single work item that cleans up this list. Then we can clean this list in the right places (stop_ap, etc.) johannes