From 2bacdf3bc4c8848606dbf9bf25956c9a0cd582f2 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Fri, 25 Jul 2008 01:47:52 -0700 Subject: [PATCH] --- yaml --- r: 105951 b: refs/heads/master c: a67da70dc0955580665f5444f318b92e69a3c272 h: refs/heads/master i: 105949: b24b6a86419db19d9c7e9d6e56ede776035073f2 105947: 98e7a69e679f83ad71dd38c2727434e7d56440b8 105943: f7deec40e119e20f0cef49d5d15337505554c4ec 105935: 35f0841ea03a885e4673376d05367e24b4a731aa 105919: 5a10c770edc8bd3a0b23a0877eaf46ac2478853e v: v3 --- [refs] | 2 +- trunk/kernel/workqueue.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 1a58d7170da1..2efdff66db0b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 69b895fd13d73aebf62b75502eb6513d43057ba3 +refs/heads/master: a67da70dc0955580665f5444f318b92e69a3c272 diff --git a/trunk/kernel/workqueue.c b/trunk/kernel/workqueue.c index 828e58230cbc..4fcb75b98443 100644 --- a/trunk/kernel/workqueue.c +++ b/trunk/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)) {