summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--io_uring/rw.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/io_uring/rw.c b/io_uring/rw.c
index 9d6e17a244ae..d54f26db0135 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -691,7 +691,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode)
return 0;
}
-int io_read(struct io_kiocb *req, unsigned int issue_flags)
+static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
{
struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
struct io_rw_state __s, *s = &__s;
@@ -836,7 +836,18 @@ done:
/* it's faster to check here then delegate to kfree */
if (iovec)
kfree(iovec);
- return kiocb_done(req, ret, issue_flags);
+ return ret;
+}
+
+int io_read(struct io_kiocb *req, unsigned int issue_flags)
+{
+ int ret;
+
+ ret = __io_read(req, issue_flags);
+ if (ret >= 0)
+ return kiocb_done(req, ret, issue_flags);
+
+ return ret;
}
static bool io_kiocb_start_write(struct io_kiocb *req, struct kiocb *kiocb)