]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
workqueues: lockdep annotations for flush_work()
authorOleg Nesterov <oleg@tv-sign.ru>
Fri, 25 Jul 2008 08:47:52 +0000 (01:47 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 25 Jul 2008 17:53:40 +0000 (10:53 -0700)
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

index 828e58230cbcd2e591d9f32e61d00a8881fc9216..4fcb75b98443f6d2b3680d1e3bd200fc232f39b5 100644 (file)
@@ -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)) {