[PATCH 2/2] io_uring: punt to workers if file doesn't support async

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 fs/io_uring.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 52e435a72b6f..1be7fdb65c3f 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -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;
-- 
2.20.1




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux