Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dfb4b82e1c631b1a6057e77212996a890aa515b7
Commit:     dfb4b82e1c631b1a6057e77212996a890aa515b7
Parent:     f293ea92007419e4f9c52db0cf57af17f45b9f94
Author:     Oleg Nesterov <[EMAIL PROTECTED]>
AuthorDate: Wed May 9 02:34:11 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed May 9 12:30:52 2007 -0700

    workqueue: make cancel_rearming_delayed_workqueue() work on idle dwork
    
    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 <[EMAIL PROTECTED]>
    Cc: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/workqueue.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 74f3f78..ce72d45 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -569,6 +569,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);
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to