diff options
author | Jens Axboe <axboe@kernel.dk> | 2019-11-20 21:05:32 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-11-26 03:56:10 +0100 |
commit | b76da70fc3759df13e0991706451f1a2e06ba19e (patch) | |
tree | d4524d43a2ed92ccfec694ab2db3807a8985ef88 /fs/io-wq.c | |
parent | io_uring: allow finding next link independent of req reference count (diff) | |
download | linux-b76da70fc3759df13e0991706451f1a2e06ba19e.tar.xz linux-b76da70fc3759df13e0991706451f1a2e06ba19e.zip |
io_uring: close lookup gap for dependent next work
When we find new work to process within the work handler, we queue the
linked timeout before we have issued the new work. This can be
problematic for very short timeouts, as we have a window where the new
work isn't visible.
Allow the work handler to store a callback function for this in the work
item, and flag it with IO_WQ_WORK_CB if the caller has done so. If that
is set, then io-wq will call the callback when it has setup the new work
item.
Reported-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io-wq.c')
-rw-r--r-- | fs/io-wq.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/io-wq.c b/fs/io-wq.c index b4bc377dda61..9b32b3c811f5 100644 --- a/fs/io-wq.c +++ b/fs/io-wq.c @@ -427,6 +427,9 @@ next: worker->cur_work = work; spin_unlock_irq(&worker->lock); + if (work->flags & IO_WQ_WORK_CB) + work->func(&work); + if ((work->flags & IO_WQ_WORK_NEEDS_FILES) && current->files != work->files) { task_lock(current); |