Skip to content

Commit bee1d5b

Browse files
committed
io_uring: disable io-wq execution of multishot NOWAIT requests
Do the same check for direct io-wq execution for multishot requests that commit 2a975d4 did for the inline execution, and disable multishot mode (and revert to single shot) if the file type doesn't support NOWAIT, and isn't opened in O_NONBLOCK mode. For multishot to work properly, it's a requirement that nonblocking read attempts can be done. Cc: [email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 2a975d4 commit bee1d5b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

io_uring/io_uring.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,10 +1982,15 @@ void io_wq_submit_work(struct io_wq_work *work)
19821982
err = -EBADFD;
19831983
if (!io_file_can_poll(req))
19841984
goto fail;
1985-
err = -ECANCELED;
1986-
if (io_arm_poll_handler(req, issue_flags) != IO_APOLL_OK)
1987-
goto fail;
1988-
return;
1985+
if (req->file->f_flags & O_NONBLOCK ||
1986+
req->file->f_mode & FMODE_NOWAIT) {
1987+
err = -ECANCELED;
1988+
if (io_arm_poll_handler(req, issue_flags) != IO_APOLL_OK)
1989+
goto fail;
1990+
return;
1991+
} else {
1992+
req->flags &= ~REQ_F_APOLL_MULTISHOT;
1993+
}
19891994
}
19901995

19911996
if (req->flags & REQ_F_FORCE_ASYNC) {

0 commit comments

Comments
 (0)