[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070419065404.GB1782@ff.dom.local>
Date: Thu, 19 Apr 2007 08:54:04 +0200
From: Jarek Poplawski <jarkao2@...pl>
To: linux-kernel@...r.kernel.org
Cc: Ingo Molnar <mingo@...e.hu>
Subject: [PATCH -mm] workqueue: debug possible endless loop in cancel_rearming_delayed_work
Hi,
IMHO cancel_rearming_delayed_work is dangerous place:
- it assumes a work function always rearms (with no exception),
which probably isn't explained enough now (but anyway should
be checked in such loops);
- probably possible (theoretical) scenario: a few work
functions rearm themselves with very short, equal times;
before flush_workqueue ends, their timers are already
fired, so cancel_delayed_work has nothing to do.
Maybe this patch could check, if I'm not dreaming...
PS: of course the counter value below is a question of taste
Signed-off-by: Jarek Poplawski <jarkao2@...pl>
---
diff -Nurp 2.6.21-rc6-mm1-/kernel/workqueue.c 2.6.21-rc6-mm1/kernel/workqueue.c
--- 2.6.21-rc6-mm1-/kernel/workqueue.c 2007-04-18 20:07:45.000000000 +0200
+++ 2.6.21-rc6-mm1/kernel/workqueue.c 2007-04-18 20:15:44.000000000 +0200
@@ -557,9 +557,12 @@ void cancel_rearming_delayed_work(struct
/* Was it ever queued ? */
if (cwq != NULL) {
struct workqueue_struct *wq = cwq->wq;
+ int i = 1000;
- while (!cancel_delayed_work(dwork))
+ while (!cancel_delayed_work(dwork)) {
flush_workqueue(wq);
+ BUG_ON(!i--);
+ }
}
}
EXPORT_SYMBOL(cancel_rearming_delayed_work);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists