public inbox for [email protected]
 help / color / mirror / Atom feed
From: Xiaoguang Wang <[email protected]>
To: [email protected]
Cc: [email protected], [email protected],
	Xiaoguang Wang <[email protected]>
Subject: [PATCH] io_uring: set error code to be ENOMEM when io_alloc_async_ctx() fails
Date: Thu,  9 Apr 2020 10:48:20 +0800	[thread overview]
Message-ID: <[email protected]> (raw)

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


             reply	other threads:[~2020-04-09  2:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09  2:48 Xiaoguang Wang [this message]
2020-04-09 15:46 ` [PATCH] io_uring: set error code to be ENOMEM when io_alloc_async_ctx() fails Jens Axboe
2020-04-09 16:01   ` Xiaoguang Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200409024820.2135-1-xiaoguang.wang@linux.alibaba.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox