diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 65475b7aa03a..3fc792dfc6ae 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1964,10 +1964,15 @@ fail: err = -EBADFD; if (!file_can_poll(req->file)) goto fail; - err = -ECANCELED; - if (io_arm_poll_handler(req, issue_flags) != IO_APOLL_OK) - goto fail; - return; + if (req->file->f_flags & O_NONBLOCK || + req->file->f_mode & FMODE_NOWAIT) { + err = -ECANCELED; + if (io_arm_poll_handler(req, issue_flags) != IO_APOLL_OK) + goto fail; + return; + } else { + req->flags &= ~REQ_F_APOLL_MULTISHOT; + } } if (req->flags & REQ_F_FORCE_ASYNC) {