diff mbox series

[1/2] io_uring: check tctx->in_idle when decrementing inflight_tracked

Message ID 20211209155956.383317-2-axboe@kernel.dk
State New
Headers show
Series [1/2] io_uring: check tctx->in_idle when decrementing inflight_tracked | expand

Commit Message

Jens Axboe Dec. 9, 2021, 3:59 p.m. UTC
If we have someone potentially waiting for tracked requests to finish,
ensure that we check in_idle and wake them up appropriately.

Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 fs/io_uring.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/fs/io_uring.c b/fs/io_uring.c
index c4f217613f56..b4d5b8d168bf 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6640,6 +6640,8 @@  static void io_clean_op(struct io_kiocb *req)
 		struct io_uring_task *tctx = req->task->io_uring;
 
 		atomic_dec(&tctx->inflight_tracked);
+		if (unlikely(atomic_read(&tctx->in_idle)))
+			wake_up(&tctx->wait);
 	}
 	if (req->flags & REQ_F_CREDS)
 		put_cred(req->creds);