projects/linux·commit a67da70d

workqueues: lockdep annotations for flush_work()

a67da70d · Oleg Nesterov <[email protected]> · 2008-07-25 01:47:52 -07:00

Add lockdep annotations to flush_work() and update the comment.

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: Jarek Poplawski <[email protected]>
Acked-by: Johannes Berg <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
a67da70dc0955580665f5444f318b92e69a3c272
Parents
69b895fd

Changes

1 files changed · +5 −0

FileStatusAddDelContent
kernel/workqueue.cmodified+5−0View file

kernel/workqueue.c

View file
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)) {