public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: set error code to be ENOMEM when io_alloc_async_ctx() fails
@ 2020-04-09  2:48 Xiaoguang Wang
  2020-04-09 15:46 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Xiaoguang Wang @ 2020-04-09  2:48 UTC (permalink / raw)
  To: io-uring; +Cc: axboe, joseph.qi, Xiaoguang Wang

We should return ENOMEM for memory allocation failures, fix this
issue for io_alloc_async_ctx() calls.

Signed-off-by: Xiaoguang Wang <[email protected]>
---
 fs/io_uring.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 6ac830b2b4fb..42a49a7e7792 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4993,7 +4993,7 @@ static int io_req_defer(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 		return 0;
 
 	if (!req->io && io_alloc_async_ctx(req))
-		return -EAGAIN;
+		return -ENOMEM;
 
 	ret = io_req_defer_prep(req, sqe);
 	if (ret < 0)
@@ -5695,7 +5695,7 @@ static bool io_submit_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
 			ctx->drain_next = 1;
 		}
 		if (io_alloc_async_ctx(req)) {
-			ret = -EAGAIN;
+			ret = -ENOMEM;
 			goto err_req;
 		}
 
@@ -5723,7 +5723,7 @@ static bool io_submit_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
 			INIT_LIST_HEAD(&req->link_list);
 
 			if (io_alloc_async_ctx(req)) {
-				ret = -EAGAIN;
+				ret = -ENOMEM;
 				goto err_req;
 			}
 			ret = io_req_defer_prep(req, sqe);
-- 
2.17.2


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

end of thread, other threads:[~2020-04-09 16:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-09  2:48 [PATCH] io_uring: set error code to be ENOMEM when io_alloc_async_ctx() fails Xiaoguang Wang
2020-04-09 15:46 ` Jens Axboe
2020-04-09 16:01   ` Xiaoguang Wang

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