Commit 900fad4
io_uring: fix racy REQ_F_LINK_TIMEOUT clearing
io_link_timeout_fn() removes REQ_F_LINK_TIMEOUT from the link head's
flags, it's not atomic and may race with what the head is doing.
If io_link_timeout_fn() doesn't clear the flag, as forced by this patch,
then it may happen that for "req -> link_timeout1 -> link_timeout2",
__io_kill_linked_timeout() would find link_timeout2 and try to cancel
it, so miscounting references. Teach it to ignore such double timeouts
by marking the active one with a new flag in io_prep_linked_timeout().
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 4d52f33 commit 900fad4
1 file changed
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
| 588 | + | |
588 | 589 | | |
589 | 590 | | |
590 | 591 | | |
| |||
614 | 615 | | |
615 | 616 | | |
616 | 617 | | |
617 | | - | |
| 618 | + | |
618 | 619 | | |
619 | 620 | | |
620 | 621 | | |
| |||
628 | 629 | | |
629 | 630 | | |
630 | 631 | | |
| 632 | + | |
| 633 | + | |
631 | 634 | | |
632 | 635 | | |
633 | 636 | | |
| |||
1871 | 1874 | | |
1872 | 1875 | | |
1873 | 1876 | | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
1874 | 1883 | | |
1875 | 1884 | | |
1876 | 1885 | | |
| |||
6106 | 6115 | | |
6107 | 6116 | | |
6108 | 6117 | | |
6109 | | - | |
| 6118 | + | |
6110 | 6119 | | |
6111 | | - | |
6112 | | - | |
| 6120 | + | |
6113 | 6121 | | |
6114 | 6122 | | |
6115 | 6123 | | |
| |||
6166 | 6174 | | |
6167 | 6175 | | |
6168 | 6176 | | |
| 6177 | + | |
6169 | 6178 | | |
6170 | 6179 | | |
6171 | 6180 | | |
| |||
0 commit comments