io-wq: add intermediate work step between pending list and active work
authorJens Axboe <axboe@kernel.dk>
Wed, 19 Jan 2022 02:23:51 +0000 (19:23 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 19 Jan 2022 02:28:12 +0000 (19:28 -0700)
commit361aee450c6e36c8dbab712c94a8a7835bd92e25
treeed619890204291ca1dab66fe74cade4b2e616e67
parentefdf518459b17e18a93c7c9cb622fd3051dabd0c
io-wq: add intermediate work step between pending list and active work

We have a gap where a worker removes an item from the work list and to
when it gets added as the workers active work. In this state, the work
item cannot be found by cancelations. This is a small window, but it does
exist.

Add a temporary pointer to a work item that isn't on the pending work
list anymore, but also not the active work. This is needed as we need
to drop the wqe lock in between grabbing the work item and marking it
as active, to ensure that signal based cancelations are properly
ordered.

Reported-by: Florian Fischer <florian.fl.fischer@fau.de>
Link: https://lore.kernel.org/io-uring/20220118151337.fac6cthvbnu7icoc@pasture/
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io-wq.c