linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libertas: clear current command on card removal
@ 2008-09-08 20:34 Dan Williams
  2008-09-08 21:01 ` John W. Linville
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Williams @ 2008-09-08 20:34 UTC (permalink / raw)
  To: John W Linville; +Cc: linux-wireless, cjb, stable

If certain commands were in-flight when the card was pulled or the
driver rmmod-ed, cleanup would block on the work queue stopping, but the
work queue was in turn blocked on the current command being canceled,
which didn't happen.  Fix that.

Signed-off-by: Dan Williams <dcbw@redhat.com>
---
John, this is 2.6.27 material if there's still time.

diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 2436634..73dc8c7 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -1205,7 +1205,13 @@ void lbs_remove_card(struct lbs_private *priv)
 	cancel_delayed_work_sync(&priv->scan_work);
 	cancel_delayed_work_sync(&priv->assoc_work);
 	cancel_work_sync(&priv->mcast_work);
+
+	/* worker thread destruction blocks on the in-flight command which
+	 * should have been cleared already in lbs_stop_card().
+	 */
+	lbs_deb_main("destroying worker thread\n");
 	destroy_workqueue(priv->work_thread);
+	lbs_deb_main("done destroying worker thread\n");
 
 	if (priv->psmode == LBS802_11POWERMODEMAX_PSP) {
 		priv->psmode = LBS802_11POWERMODECAM;
@@ -1323,14 +1329,26 @@ void lbs_stop_card(struct lbs_private *priv)
 		device_remove_file(&dev->dev, &dev_attr_lbs_rtap);
 	}
 
-	/* Flush pending command nodes */
+	/* Delete the timeout of the currently processing command */
 	del_timer_sync(&priv->command_timer);
+
+	/* Flush pending command nodes */
 	spin_lock_irqsave(&priv->driver_lock, flags);
+	lbs_deb_main("clearing pending commands\n");
 	list_for_each_entry(cmdnode, &priv->cmdpendingq, list) {
 		cmdnode->result = -ENOENT;
 		cmdnode->cmdwaitqwoken = 1;
 		wake_up_interruptible(&cmdnode->cmdwait_q);
 	}
+
+	/* Flush the command the card is currently processing */
+	if (priv->cur_cmd) {
+		lbs_deb_main("clearing current command\n");
+		priv->cur_cmd->result = -ENOENT;
+		priv->cur_cmd->cmdwaitqwoken = 1;
+		wake_up_interruptible(&priv->cur_cmd->cmdwait_q);
+	}
+	lbs_deb_main("done clearing commands\n");
 	spin_unlock_irqrestore(&priv->driver_lock, flags);
 
 	unregister_netdev(dev);



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] libertas: clear current command on card removal
  2008-09-08 20:34 [PATCH] libertas: clear current command on card removal Dan Williams
@ 2008-09-08 21:01 ` John W. Linville
  2008-09-08 21:39   ` Dan Williams
  0 siblings, 1 reply; 4+ messages in thread
From: John W. Linville @ 2008-09-08 21:01 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-wireless, cjb, stable

On Mon, Sep 08, 2008 at 04:34:40PM -0400, Dan Williams wrote:
> If certain commands were in-flight when the card was pulled or the
> driver rmmod-ed, cleanup would block on the work queue stopping, but the
> work queue was in turn blocked on the current command being canceled,
> which didn't happen.  Fix that.
> 
> Signed-off-by: Dan Williams <dcbw@redhat.com>
> ---
> John, this is 2.6.27 material if there's still time.

I have to remind you of the new "regressions only" policy.  Is this a
problem that we introduced in old code during the 2.6.27 merge window?

John
-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libertas: clear current command on card removal
  2008-09-08 21:01 ` John W. Linville
@ 2008-09-08 21:39   ` Dan Williams
  2008-09-09  3:51     ` [stable] " Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Williams @ 2008-09-08 21:39 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, cjb, stable

On Mon, 2008-09-08 at 17:01 -0400, John W. Linville wrote:
> On Mon, Sep 08, 2008 at 04:34:40PM -0400, Dan Williams wrote:
> > If certain commands were in-flight when the card was pulled or the
> > driver rmmod-ed, cleanup would block on the work queue stopping, but the
> > work queue was in turn blocked on the current command being canceled,
> > which didn't happen.  Fix that.
> > 
> > Signed-off-by: Dan Williams <dcbw@redhat.com>
> > ---
> > John, this is 2.6.27 material if there's still time.
> 
> I have to remind you of the new "regressions only" policy.  Is this a
> problem that we introduced in old code during the 2.6.27 merge window?

True :)  It is not a regression from 2.6.26, but a fairly serious bug
that has existed for some time.  Thus, treat it as you like to avoid
getting flamed by Linus & Dave.

I'll post to stable after 2.6.27 comes out then.

Dan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [stable] [PATCH] libertas: clear current command on card removal
  2008-09-08 21:39   ` Dan Williams
@ 2008-09-09  3:51     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2008-09-09  3:51 UTC (permalink / raw)
  To: Dan Williams; +Cc: John W. Linville, cjb, linux-wireless, stable

On Mon, Sep 08, 2008 at 05:39:17PM -0400, Dan Williams wrote:
> On Mon, 2008-09-08 at 17:01 -0400, John W. Linville wrote:
> > On Mon, Sep 08, 2008 at 04:34:40PM -0400, Dan Williams wrote:
> > > If certain commands were in-flight when the card was pulled or the
> > > driver rmmod-ed, cleanup would block on the work queue stopping, but the
> > > work queue was in turn blocked on the current command being canceled,
> > > which didn't happen.  Fix that.
> > > 
> > > Signed-off-by: Dan Williams <dcbw@redhat.com>
> > > ---
> > > John, this is 2.6.27 material if there's still time.
> > 
> > I have to remind you of the new "regressions only" policy.  Is this a
> > problem that we introduced in old code during the 2.6.27 merge window?
> 
> True :)  It is not a regression from 2.6.26, but a fairly serious bug
> that has existed for some time.  Thus, treat it as you like to avoid
> getting flamed by Linus & Dave.
> 
> I'll post to stable after 2.6.27 comes out then.

No, post to stable when the patch goes into Linus's tree as that is a
requirement.

To do so automatically, just add:
	CC: stable <stable@kernel.org>
in the signed-off-by: area of the patch and we will be automatically
notified when it goes into Linus's tree and will pick it up then, no
extra work for you at all (and much easier for the stable-team as well.)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-09-09  3:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-08 20:34 [PATCH] libertas: clear current command on card removal Dan Williams
2008-09-08 21:01 ` John W. Linville
2008-09-08 21:39   ` Dan Williams
2008-09-09  3:51     ` [stable] " Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).