* [PATCH] io_uring: fix stuck problem caused by potential memory alloc failure
@ 2019-07-10 8:35 Jackie Liu
2019-07-10 13:57 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: Jackie Liu @ 2019-07-10 8:35 UTC (permalink / raw)
To: axboe; +Cc: Jackie Liu, linux-block
when io_req_defer alloc memory failed, it will be return -EAGAIN.
But io_submit_sqe cannot be returned immediately because the reference
count for req is still hold. we should be clean it.
Fixes: de0617e46717 ("io_uring: add support for marking commands as draining")
Cc: linux-block@vger.kernel.org
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
---
fs/io_uring.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 4ef62a45045d..1c388533cdc8 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1843,8 +1843,8 @@ static int io_submit_sqe(struct io_ring_ctx *ctx, struct sqe_submit *s,
ret = io_req_defer(ctx, req, s->sqe);
if (ret) {
if (ret == -EIOCBQUEUED)
- ret = 0;
- return ret;
+ return 0;
+ goto out;
}
ret = __io_submit_sqe(ctx, req, s, true);
--
2.22.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] io_uring: fix stuck problem caused by potential memory alloc failure
2019-07-10 8:35 [PATCH] io_uring: fix stuck problem caused by potential memory alloc failure Jackie Liu
@ 2019-07-10 13:57 ` Jens Axboe
2019-07-10 15:33 ` JackieLiu
0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2019-07-10 13:57 UTC (permalink / raw)
To: Jackie Liu; +Cc: linux-block
On 7/10/19 2:35 AM, Jackie Liu wrote:
> when io_req_defer alloc memory failed, it will be return -EAGAIN.
> But io_submit_sqe cannot be returned immediately because the reference
> count for req is still hold. we should be clean it.
Looks like this actually got fixed in my for-5.3/io_uring branch which
I haven't pushed out yet. Once that's in, I'd suggest we send yours to
stable separately. Probably change the wording to:
When io_req_defer alloc memory fails, it will be -EAGAIN. But
io_submit_sqe cannot return immediately because the reference count for
req is still held. Ensure that we free it.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] io_uring: fix stuck problem caused by potential memory alloc failure
2019-07-10 13:57 ` Jens Axboe
@ 2019-07-10 15:33 ` JackieLiu
0 siblings, 0 replies; 3+ messages in thread
From: JackieLiu @ 2019-07-10 15:33 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
Thank you for pointing out. I haven't had time to pay attention to the new
features of sqe links. When I was debugging another stuck problem, I found
that there was no free the reference count, so I sent the patch about this.
Anyway, if necessary, I will resend the patch again, with your rewritten
comments.
> 在 2019年7月10日,21:57,Jens Axboe <axboe@kernel.dk> 写道:
>
> On 7/10/19 2:35 AM, Jackie Liu wrote:
>> when io_req_defer alloc memory failed, it will be return -EAGAIN.
>> But io_submit_sqe cannot be returned immediately because the reference
>> count for req is still hold. we should be clean it.
>
> Looks like this actually got fixed in my for-5.3/io_uring branch which
> I haven't pushed out yet. Once that's in, I'd suggest we send yours to
> stable separately. Probably change the wording to:
>
> When io_req_defer alloc memory fails, it will be -EAGAIN. But
> io_submit_sqe cannot return immediately because the reference count for
> req is still held. Ensure that we free it.
>
> --
> Jens Axboe
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-10 15:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10 8:35 [PATCH] io_uring: fix stuck problem caused by potential memory alloc failure Jackie Liu
2019-07-10 13:57 ` Jens Axboe
2019-07-10 15:33 ` JackieLiu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).