On 9/8/20 6:31 AM, Greg KH wrote: > On Fri, Sep 04, 2020 at 03:06:28PM -0600, Jens Axboe wrote: >> Hi, >> >> Linus just pulled 3 fixes from me - 1+2 should apply directly, here's >> the 3rd one which will need some love for 5.8-stable. I'm including it >> below to preempt the failed to apply message :-) >> >> >> commit fb8d4046d50f77a26570101e5b8a7a026320a610 >> Author: Jens Axboe <axboe@xxxxxxxxx> >> Date: Wed Sep 2 10:19:04 2020 -0600 >> >> io_uring: no read/write-retry on -EAGAIN error and O_NONBLOCK marked file >> >> Actually two things that need fixing up here: >> >> - The io_rw_reissue() -EAGAIN retry is explicit to block devices and >> regular files, so don't ever attempt to do that on other types of >> files. >> >> - If we hit -EAGAIN on a nonblock marked file, don't arm poll handler for >> it. It should just complete with -EAGAIN. >> >> Cc: stable@xxxxxxxxxxxxxxx >> Reported-by: Norman Maurer <norman.maurer@xxxxxxxxxxxxxx> >> Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> >> >> diff --git a/fs/io_uring.c b/fs/io_uring.c >> index 82e15020d9a8..96be21ace79a 100644 >> --- a/fs/io_uring.c >> +++ b/fs/io_uring.c >> @@ -2726,6 +2726,12 @@ static int io_read(struct io_kiocb *req, bool force_nonblock) >> ret = ret2; >> goto done; >> } >> + /* no retry on NONBLOCK marked file */ >> + if (req->file->f_flags & O_NONBLOCK) { >> + ret = ret2; >> + goto done; >> + } >> + >> /* some cases will consume bytes even on error returns */ >> iov_iter_revert(iter, iov_count - iov_iter_count(iter)); >> ret2 = 0; >> @@ -2869,9 +2875,15 @@ static int io_write(struct io_kiocb *req, bool force_nonblock) >> */ >> if (ret2 == -EOPNOTSUPP && (kiocb->ki_flags & IOCB_NOWAIT)) >> ret2 = -EAGAIN; >> + /* no retry on NONBLOCK marked file */ >> + if (ret2 == -EAGAIN && (req->file->f_flags & O_NONBLOCK)) { >> + ret = 0; >> + goto done; >> + } >> if (!force_nonblock || ret2 != -EAGAIN) { >> if ((req->ctx->flags & IORING_SETUP_IOPOLL) && ret2 == -EAGAIN) >> goto copy_iov; >> +done: >> kiocb_done(kiocb, ret2); >> } else { >> copy_iov: >> >> -- >> Jens Axboe > > > Thanks for the backport, but this didn't apply at all to the 5.8.y tree. > What one did you make it against? Oh, might have been because I have a pile of pending 5.8 stable patches... Let me apply to pristine stable, test, and then I'll send it to you. -- Jens Axboe