mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 07:10:27 +00:00
io_uring: fix __io_uring_files_cancel() with TASK_UNINTERRUPTIBLE
If the tctx inflight number haven't changed because of cancellation, __io_uring_task_cancel() will continue leaving the task in TASK_UNINTERRUPTIBLE state, that's not expected by __io_uring_files_cancel(). Ensure we always call finish_wait() before retrying. Cc: stable@vger.kernel.org # 5.9+ Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
b18032bb0a
commit
a1bb3cd589
@ -9124,16 +9124,15 @@ void __io_uring_task_cancel(void)
|
|||||||
prepare_to_wait(&tctx->wait, &wait, TASK_UNINTERRUPTIBLE);
|
prepare_to_wait(&tctx->wait, &wait, TASK_UNINTERRUPTIBLE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we've seen completions, retry. This avoids a race where
|
* If we've seen completions, retry without waiting. This
|
||||||
* a completion comes in before we did prepare_to_wait().
|
* avoids a race where a completion comes in before we did
|
||||||
|
* prepare_to_wait().
|
||||||
*/
|
*/
|
||||||
if (inflight != tctx_inflight(tctx))
|
if (inflight == tctx_inflight(tctx))
|
||||||
continue;
|
schedule();
|
||||||
schedule();
|
|
||||||
finish_wait(&tctx->wait, &wait);
|
finish_wait(&tctx->wait, &wait);
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
finish_wait(&tctx->wait, &wait);
|
|
||||||
atomic_dec(&tctx->in_idle);
|
atomic_dec(&tctx->in_idle);
|
||||||
|
|
||||||
io_uring_remove_task_files(tctx);
|
io_uring_remove_task_files(tctx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user