Skip to contentSkip to conversation

io_uring: fix io_drain_req()

PATCH In review Pavel Begunkov 2 participants 2 messages Jul 11, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: fix io_drain_req()

io_drain_req() return whether the request has been consumed or not, not an error code. Fix a stupid mistake slipped from optimisation patches.

Reported-by [email protected]
Fixes 76cc33d79175a ("io_uring: refactor io_req_defer()")
---
 fs/io_uring.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/io_uring.c +4 -2
index 118215211bb2..0cac361bf6b8 100644
@@ -6019,11 +6019,13 @@ static bool io_drain_req(struct io_kiocb *req)
 
 	ret = io_req_prep_async(req);
 	if (ret)
-		return ret;
+		goto fail;
 	io_prep_async_link(req);
 	de = kmalloc(sizeof(*de), GFP_KERNEL);
 	if (!de) {
-		io_req_complete_failed(req, -ENOMEM);
+		ret = -ENOMEM;
+fail:
+		io_req_complete_failed(req, ret);
 		return true;
 	}
 
Signature · 1 line
2.32.0
maintainer
#1 lore raw
Quoted 2 lines · Pavel Begunkov

io_drain_req() return whether the request has been consumed or not, not an error code. Fix a stupid mistake slipped from optimisation patches.

Good catch, thanks for fixing this up. Applied.

Signature · 1 line
Jens Axboe