mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
io_uring/rw: commit provided buffer state on async
When we get -EIOCBQUEUED, we need to ensure that the buffer is consumed
from the provided buffer ring, which can be done with io_kbuf_recycle()
+ REQ_F_PARTIAL_IO.
Reported-by: Muhammad Ramdhan <ramdhan@starlabs.sg>
Reported-by: Bing-Jhong Billy Jheng <billy@starlabs.sg>
Reported-by: Jacob Soo <jacob.soo@starlabs.sg>
Fixes: c7fb19428d ("io_uring: add support for ring mapped supplied buffers")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a94592ec30
commit
644636ee7e
@@ -793,6 +793,8 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
|
|||||||
goto done;
|
goto done;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
} else if (ret == -EIOCBQUEUED) {
|
} else if (ret == -EIOCBQUEUED) {
|
||||||
|
req->flags |= REQ_F_PARTIAL_IO;
|
||||||
|
io_kbuf_recycle(req, issue_flags);
|
||||||
if (iovec)
|
if (iovec)
|
||||||
kfree(iovec);
|
kfree(iovec);
|
||||||
return IOU_ISSUE_SKIP_COMPLETE;
|
return IOU_ISSUE_SKIP_COMPLETE;
|
||||||
@@ -816,6 +818,9 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
req->flags |= REQ_F_PARTIAL_IO;
|
||||||
|
io_kbuf_recycle(req, issue_flags);
|
||||||
|
|
||||||
io = req->async_data;
|
io = req->async_data;
|
||||||
s = &io->s;
|
s = &io->s;
|
||||||
/*
|
/*
|
||||||
@@ -956,6 +961,11 @@ int io_write(struct io_kiocb *req, unsigned int issue_flags)
|
|||||||
else
|
else
|
||||||
ret2 = -EINVAL;
|
ret2 = -EINVAL;
|
||||||
|
|
||||||
|
if (ret2 == -EIOCBQUEUED) {
|
||||||
|
req->flags |= REQ_F_PARTIAL_IO;
|
||||||
|
io_kbuf_recycle(req, issue_flags);
|
||||||
|
}
|
||||||
|
|
||||||
if (req->flags & REQ_F_REISSUE) {
|
if (req->flags & REQ_F_REISSUE) {
|
||||||
req->flags &= ~REQ_F_REISSUE;
|
req->flags &= ~REQ_F_REISSUE;
|
||||||
ret2 = -EAGAIN;
|
ret2 = -EAGAIN;
|
||||||
|
|||||||
Reference in New Issue
Block a user