LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 3/6] workqueue: make cancel_rearming_delayed_workqueue() work on idle dwork
@ 2007-02-06 23:30 Oleg Nesterov
  2007-02-07 14:33 ` Daniel Drake
  0 siblings, 1 reply; 8+ messages in thread
From: Oleg Nesterov @ 2007-02-06 23:30 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Ingo Molnar, linux-kernel, David Howells

cancel_rearming_delayed_workqueue(dwork) will hang forever if dwork was not
scheduled, because in that case cancel_delayed_work()->del_timer_sync() never
returns true.

I don't know if there are any callers which may have problems, but this is
not so convenient, and the fix is very simple.

Q: looks like we don't need "struct workqueue_struct *wq" parameter. If the
timer was aborted successfully, get_wq_data() == wq. Is it worth to add the
new function?

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- 6.20-rc6-mm3/kernel/workqueue.c~3_cdw	2007-02-06 23:09:34.000000000 +0300
+++ 6.20-rc6-mm3/kernel/workqueue.c	2007-02-06 23:42:43.000000000 +0300
@@ -565,6 +565,10 @@ EXPORT_SYMBOL(flush_work_keventd);
 void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq,
 				       struct delayed_work *dwork)
 {
+	/* Was it ever queued ? */
+	if (!get_wq_data(&dwork->work))
+		return;
+
 	while (!cancel_delayed_work(dwork))
 		flush_workqueue(wq);
 }


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

end of thread, other threads:[~2007-02-08  9:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-06 23:30 [PATCH 3/6] workqueue: make cancel_rearming_delayed_workqueue() work on idle dwork Oleg Nesterov
2007-02-07 14:33 ` Daniel Drake
2007-02-07 15:16   ` Oleg Nesterov
2007-02-07 17:43     ` Oleg Nesterov
2007-02-08  2:20       ` Horms
2007-02-08  8:35         ` Oleg Nesterov
2007-02-08  8:39           ` Andrew Morton
2007-02-08  9:46             ` Oleg Nesterov

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).