public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH v2] io_uring: fix skipping disabling sqo on exec
@ 2021-01-17  2:29 Pavel Begunkov
  2021-01-17  4:04 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2021-01-17  2:29 UTC (permalink / raw)
  To: Jens Axboe, io-uring

If there are no requests at the time __io_uring_task_cancel() is called,
tctx_inflight() returns zero and and it terminates not getting a chance
to go through __io_uring_files_cancel() and do
io_disable_sqo_submit(). And we absolutely want them disabled by the
time cancellation ends.

Reported-by: Jens Axboe <[email protected]>
Signed-off-by: Pavel Begunkov <[email protected]>
---

v2: drop sq_data stuff, can't happen

 fs/io_uring.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index d494c4269fc5..383ff6ed3734 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -9085,6 +9085,10 @@ void __io_uring_task_cancel(void)
 	/* make sure overflow events are dropped */
 	atomic_inc(&tctx->in_idle);
 
+	/* trigger io_disable_sqo_submit() */
+	if (tctx->sqpoll)
+		__io_uring_files_cancel(NULL);
+
 	do {
 		/* read completions before cancelations */
 		inflight = tctx_inflight(tctx);
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] io_uring: fix skipping disabling sqo on exec
  2021-01-17  2:29 [PATCH v2] io_uring: fix skipping disabling sqo on exec Pavel Begunkov
@ 2021-01-17  4:04 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-01-17  4:04 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On 1/16/21 7:29 PM, Pavel Begunkov wrote:
> If there are no requests at the time __io_uring_task_cancel() is called,
> tctx_inflight() returns zero and and it terminates not getting a chance
> to go through __io_uring_files_cancel() and do
> io_disable_sqo_submit(). And we absolutely want them disabled by the
> time cancellation ends.

Thanks, that looks much better! Applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-17  4:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-17  2:29 [PATCH v2] io_uring: fix skipping disabling sqo on exec Pavel Begunkov
2021-01-17  4:04 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox