On 30/06/2020 17:04, Jens Axboe wrote: > On 6/30/20 6:20 AM, Pavel Begunkov wrote: >> Don't call io_commit_cqring() without holding the completion spinlock >> in io_iopoll_complete(), it can race, e.g. with async request failing. > > Can you be more specific? io_iopoll_complete() -> io_req_free_batch() -> io_queue_next() -> io_req_task_queue() -> task_work_add() if this task_work_add() fails, it will be redirected to io-wq manager task to do io_req_task_cancel() -> commit_cqring(). And probably something similar will happen if a request currently in io-wq is retried with io_rw_should_retry() -> io_async_buf_func() -> task_work_add() I'll resend patch/series later with a better description. -- Pavel Begunkov