Since we always pass flush responsibility to next, we will not deprive it,
now the ->first_flusher can only be changed by the first_flusher, no one
can change it, no race as 4ce48b37 said.

Remove the check introduced by 4ce48b37, use BUG_ON() instead.

Also move "wq->first_flusher = NULL;" later.

This patch doesn't make any functional difference.

Signed-off-by: Lai Jiangshan <la...@cn.fujitsu.com>
---
 kernel/workqueue.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 360b7e2..acd9e2f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2682,12 +2682,7 @@ void flush_workqueue(struct workqueue_struct *wq)
 
        mutex_lock(&wq->flush_mutex);
 
-       /* we might have raced, check again with mutex held */
-       if (wq->first_flusher != &this_flusher)
-               goto out_unlock;
-
-       wq->first_flusher = NULL;
-
+       BUG_ON(wq->first_flusher != &this_flusher);
        BUG_ON(!list_empty(&this_flusher.list));
        BUG_ON(wq->flush_color != this_flusher.flush_color);
 
@@ -2728,6 +2723,7 @@ void flush_workqueue(struct workqueue_struct *wq)
 
                if (list_empty(&wq->flusher_queue)) {
                        BUG_ON(wq->flush_color != wq->work_color);
+                       wq->first_flusher = NULL;
                        break;
                }
 
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to