aboutsummaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-08-20 11:33:35 +0300
committerJens Axboe <axboe@kernel.dk>2020-08-20 05:36:15 -0600
commitbb175342aa64e6c6f1d04f5235502121d6ff0247 (patch)
treefeec87c0c6a78c18d703d457f4f8e9406939fbb6 /fs/super.c
parentfc666777da9da387354b1a142a6ffc5d43bc4f7e (diff)
downloadlinux-bb175342aa64e6c6f1d04f5235502121d6ff0247.tar.gz
io_uring: fix racy req->flags modification
Setting and clearing REQ_F_OVERFLOW in io_uring_cancel_files() and io_cqring_overflow_flush() are racy, because they might be called asynchronously. REQ_F_OVERFLOW flag in only needed for files cancellation, so if it can be guaranteed that requests _currently_ marked inflight can't be overflown, the problem will be solved with removing the flag altogether. That's how the patch works, it removes inflight status of a request in io_cqring_fill_event() whenever it should be thrown into CQ-overflow list. That's Ok to do, because no opcode specific handling can be done after io_cqring_fill_event(), the same assumption as with "struct io_completion" patches. And it already have a good place for such cleanups, which is io_clean_op(). A nice side effect of this is removing this inflight check from the hot path. note on synchronisation: now __io_cqring_fill_event() may be taking two spinlocks simultaneously, completion_lock and inflight_lock. It's fine, because we never do that in reverse order, and CQ-overflow of inflight requests shouldn't happen often. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/super.c')
0 files changed, 0 insertions, 0 deletions