workqueue: grab sw->lock for flag manipulation
authorJens Axboe <axboe@fb.com>
Mon, 7 Dec 2015 17:43:45 +0000 (10:43 -0700)
committerJens Axboe <axboe@fb.com>
Mon, 7 Dec 2015 17:43:45 +0000 (10:43 -0700)
For consistency, should not matter in the shutdown path.

Signed-off-by: Jens Axboe <axboe@fb.com>
workqueue.c

index 7cd83bf..27570b2 100644 (file)
@@ -388,7 +388,9 @@ void workqueue_exit(struct workqueue *wq)
                        sw = &wq->workers[i];
                        if (sw->flags & SW_F_ACCOUNTED)
                                continue;
+                       pthread_mutex_lock(&sw->lock);
                        sw->flags |= SW_F_ACCOUNTED;
+                       pthread_mutex_unlock(&sw->lock);
                        shutdown_worker(sw, &sum_cnt);
                        shutdown++;
                }