summaryrefslogtreecommitdiffstats
path: root/block/blk-merge.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-08-30 07:45:47 -0600
committerJens Axboe <axboe@kernel.dk>2021-08-30 07:45:47 -0600
commit87df7fb922d18e96992aa5e824aa34b2065fef59 (patch)
treeabb09fea0e8f9af2e14c127bb4f9b1018072e7d5 /block/blk-merge.c
parenta9a4aa9fbfc5b87f315c63d9a317648774a46879 (diff)
downloadlinux-stable-87df7fb922d18e96992aa5e824aa34b2065fef59.tar.gz
linux-stable-87df7fb922d18e96992aa5e824aa34b2065fef59.tar.bz2
linux-stable-87df7fb922d18e96992aa5e824aa34b2065fef59.zip
io-wq: fix wakeup race when adding new work
When new work is added, io_wqe_enqueue() checks if we need to wake or create a new worker. But that check is done outside the lock that otherwise synchronizes us with a worker going to sleep, so we can end up in the following situation: CPU0 CPU1 lock insert work unlock atomic_read(nr_running) != 0 lock atomic_dec(nr_running) no wakeup needed Hold the wqe lock around the "need to wakeup" check. Then we can also get rid of the temporary work_flags variable, as we know the work will remain valid as long as we hold the lock. Cc: stable@vger.kernel.org Reported-by: Andres Freund <andres@anarazel.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-merge.c')
0 files changed, 0 insertions, 0 deletions