workqueues: lockdep annotations for flush_work()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, July 25, 2008 - 12:08 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a67da7...
Commit:     a67da70dc0955580665f5444f318b92e69a3c272
Parent:     69b895fd13d73aebf62b75502eb6513d43057ba3
Author:     Oleg Nesterov <oleg@tv-sign.ru>
AuthorDate: Fri Jul 25 01:47:52 2008 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Fri Jul 25 10:53:40 2008 -0700

    workqueues: lockdep annotations for flush_work()
    
    Add lockdep annotations to flush_work() and update the comment.
    
    Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
    Cc: Jarek Poplawski <jarkao2@o2.pl>
    Acked-by: Johannes Berg <johannes@sipsolutions.net>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 kernel/workqueue.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 828e582..4fcb75b 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -427,6 +427,8 @@ EXPORT_SYMBOL_GPL(flush_workqueue);
  * flush_work - block until a work_struct's callback has terminated
  * @work: the work which is to be flushed
  *
+ * Returns false if @work has already terminated.
+ *
  * It is expected that, prior to calling flush_work(), the caller has
  * arranged for the work to not be requeued, otherwise it doesn't make
  * sense to use this function.
@@ -442,6 +444,9 @@ int flush_work(struct work_struct *work)
 	if (!cwq)
 		return 0;
 
+	lock_acquire(&cwq->wq->lockdep_map, 0, 0, 0, 2, _THIS_IP_);
+	lock_release(&cwq->wq->lockdep_map, 1, _THIS_IP_);
+
 	prev = NULL;
 	spin_lock_irq(&cwq->lock);
 	if (!list_empty(&work->entry)) {
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
workqueues: lockdep annotations for flush_work(), Linux Kernel Mailing ..., (Fri Jul 25, 12:08 pm)