@@ -1064,6 +1064,11 @@ static int io_read(struct io_kiocb *req, const struct sqe_submit *s,
return ret;
iov_count = iov_iter_count(&iter);
+ /* async punt if file doesn't support non-blocking */
+ ret = -EAGAIN;
+ if (force_nonblock && !(kiocb->ki_flags & IOCB_NOWAIT))
+ goto out_free;
+
ret = rw_verify_area(READ, file, &kiocb->ki_pos, iov_count);
if (ret)
goto out_free;
@@ -1109,6 +1114,11 @@ static int io_write(struct io_kiocb *req, const struct sqe_submit *s,
return ret;
iov_count = iov_iter_count(&iter);
+ /* async punt if file doesn't support non-blocking */
+ ret = -EAGAIN;
+ if (force_nonblock && !(kiocb->ki_flags & IOCB_NOWAIT))
+ goto out_free;
+
ret = -EAGAIN;
if (force_nonblock && !(kiocb->ki_flags & IOCB_DIRECT))
goto out_free;
If force_nonblock is set we must not try io operations that don't support async (i.e. are missing the IOCB_NOWAIT flag). Signed-off-by: Stefan Bühler <source@stbuehler.de> --- fs/io_uring.c | 10 ++++++++++ 1 file changed, 10 insertions(+)