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 7cd83bfd6216bdf9cc69c70d59d9760fc31a7b9b..27570b2a0b20e5e7cd4ad0a9ccaacf697f6962c7 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++;
                }