workqueue: correct handling of the pool spin_lock
authorJoonsoo Kim <js1304@gmail.com>
Tue, 30 Apr 2013 15:07:00 +0000 (00:07 +0900)
committerTejun Heo <tj@kernel.org>
Tue, 14 May 2013 18:48:15 +0000 (11:48 -0700)
When we fail to mutex_trylock(), we release the pool spin_lock and do
mutex_lock(). After that, we should regrab the pool spin_lock, but,
regrabbing is missed in current code. So correct it.

Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c

index 1ae602809efb5d4358b4eed3777ae91c427b936c..286847b902252550850ab7ef0b5346d4e88a4605 100644 (file)
@@ -2059,6 +2059,7 @@ static bool manage_workers(struct worker *worker)
        if (unlikely(!mutex_trylock(&pool->manager_mutex))) {
                spin_unlock_irq(&pool->lock);
                mutex_lock(&pool->manager_mutex);
+               spin_lock_irq(&pool->lock);
                ret = true;
        }