From ce4e480c9eedc6c121a5fd252d88ca3e44ecccfe Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 20 Feb 2020 09:59:02 -0700 Subject: [PATCH 1258/2944] io_uring: io_accept() should hold on to submit reference on retry to #28170604 commit e441d1cf20e1b9fc443e6130488d41e1941aae82 upstream Don't drop an early reference, hang on to it and let the caller drop it. This makes it behave more like "regular" requests. Signed-off-by: Jens Axboe Acked-by: Joseph Qi Signed-off-by: Xiaoguang Wang --- fs/io_uring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 0f25b91..20bc03c 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3363,6 +3363,8 @@ static void io_accept_finish(struct io_wq_work **workptr) struct io_kiocb *req = container_of(*workptr, struct io_kiocb, work); struct io_kiocb *nxt = NULL; + io_put_req(req); + if (io_req_cancelled(req)) return; __io_accept(req, &nxt, false); @@ -3380,7 +3382,6 @@ static int io_accept(struct io_kiocb *req, struct io_kiocb **nxt, ret = __io_accept(req, nxt, force_nonblock); if (ret == -EAGAIN && force_nonblock) { req->work.func = io_accept_finish; - io_put_req(req); return -EAGAIN; } return 0; -- 1.8.3.1