Commit bd99c71
io_uring: fix race between poll completion and cancel_hash insertion
If poll arming and poll completion runs in parallel, there maybe races.
For instance, run io_poll_add in iowq and io_poll_task_func in original
context, then:
iowq original context
io_poll_add
vfs_poll
(interruption happens
tw queued to original
context) io_poll_task_func
generate cqe
del from cancel_hash[]
if !poll.done
insert to cancel_hash[]
The entry left in cancel_hash[], similar case for fast poll.
Fix it by set poll.done = true when del from cancel_hash[].
Fixes: 5082620 ("io_uring: terminate multishot poll for CQ ring overflow")
Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
Link: https://lore.kernel.org/r/20210922101238.7177-2-haoxu@linux.alibaba.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 87c1696 commit bd99c71
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5337 | 5337 | | |
5338 | 5338 | | |
5339 | 5339 | | |
5340 | | - | |
5341 | | - | |
| 5340 | + | |
5342 | 5341 | | |
5343 | | - | |
5344 | 5342 | | |
5345 | 5343 | | |
5346 | 5344 | | |
| |||
5371 | 5369 | | |
5372 | 5370 | | |
5373 | 5371 | | |
| 5372 | + | |
5374 | 5373 | | |
5375 | 5374 | | |
5376 | 5375 | | |
| |||
5508 | 5507 | | |
5509 | 5508 | | |
5510 | 5509 | | |
| 5510 | + | |
5511 | 5511 | | |
5512 | 5512 | | |
5513 | 5513 | | |
| |||
0 commit comments