Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
io_uring: hold uring_lock while completing failed polled io in io_wq_…
…submit_work() io_iopoll_complete() does not hold completion_lock to complete polled io, so in io_wq_submit_work(), we can not call io_req_complete() directly, to complete polled io, otherwise there maybe concurrent access to cqring, defer_list, etc, which is not safe. Commit dad1b12 ("io_uring: always let io_iopoll_complete() complete polled io") has fixed this issue, but Pavel reported that IOPOLL apart from rw can do buf reg/unreg requests( IORING_OP_PROVIDE_BUFFERS or IORING_OP_REMOVE_BUFFERS), so the fix is not good. Given that io_iopoll_complete() is always called under uring_lock, so here for polled io, we can also get uring_lock to fix this issue. Fixes: dad1b12 ("io_uring: always let io_iopoll_complete() complete polled io") Cc: <[email protected]> # 5.5+ Signed-off-by: Xiaoguang Wang <[email protected]> Reviewed-by: Pavel Begunkov <[email protected]> [axboe: don't deref 'req' after completing it'] Signed-off-by: Jens Axboe <[email protected]>
- Loading branch information