Skip to content

Commit 644636e

Browse files
isilencegregkh
authored andcommitted
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 <[email protected]> Reported-by: Bing-Jhong Billy Jheng <[email protected]> Reported-by: Jacob Soo <[email protected]> Fixes: c7fb194 ("io_uring: add support for ring mapped supplied buffers") Signed-off-by: Pavel Begunkov <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a94592e commit 644636e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

io_uring/rw.c

+10
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,8 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
793793
goto done;
794794
ret = 0;
795795
} else if (ret == -EIOCBQUEUED) {
796+
req->flags |= REQ_F_PARTIAL_IO;
797+
io_kbuf_recycle(req, issue_flags);
796798
if (iovec)
797799
kfree(iovec);
798800
return IOU_ISSUE_SKIP_COMPLETE;
@@ -816,6 +818,9 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
816818
goto done;
817819
}
818820

821+
req->flags |= REQ_F_PARTIAL_IO;
822+
io_kbuf_recycle(req, issue_flags);
823+
819824
io = req->async_data;
820825
s = &io->s;
821826
/*
@@ -956,6 +961,11 @@ int io_write(struct io_kiocb *req, unsigned int issue_flags)
956961
else
957962
ret2 = -EINVAL;
958963

964+
if (ret2 == -EIOCBQUEUED) {
965+
req->flags |= REQ_F_PARTIAL_IO;
966+
io_kbuf_recycle(req, issue_flags);
967+
}
968+
959969
if (req->flags & REQ_F_REISSUE) {
960970
req->flags &= ~REQ_F_REISSUE;
961971
ret2 = -EAGAIN;

0 commit comments

Comments
 (0)