From: Greg Kroah-Hartman Date: Tue, 8 Sep 2020 14:25:36 +0000 (+0200) Subject: 5.8-stable patches X-Git-Tag: v4.14.197~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=258a735d18f15f246e484b5e9020bb802ae97797;p=thirdparty%2Fkernel%2Fstable-queue.git 5.8-stable patches added patches: io_uring-no-read-write-retry-on-eagain-error-and-o_nonblock-marked-file.patch --- diff --git a/queue-5.8/io_uring-no-read-write-retry-on-eagain-error-and-o_nonblock-marked-file.patch b/queue-5.8/io_uring-no-read-write-retry-on-eagain-error-and-o_nonblock-marked-file.patch new file mode 100644 index 00000000000..f7f7dfa9631 --- /dev/null +++ b/queue-5.8/io_uring-no-read-write-retry-on-eagain-error-and-o_nonblock-marked-file.patch @@ -0,0 +1,59 @@ +From 355afaeb578abac907217c256a844cfafb0337b2 Mon Sep 17 00:00:00 2001 +From: Jens Axboe +Date: Wed, 2 Sep 2020 09:30:31 -0600 +Subject: io_uring: no read/write-retry on -EAGAIN error and O_NONBLOCK marked file + +From: Jens Axboe + +commit 355afaeb578abac907217c256a844cfafb0337b2 upstream. + +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@vger.kernel.org +Reported-by: Norman Maurer +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman + +--- + fs/io_uring.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -2697,8 +2697,15 @@ static int io_read(struct io_kiocb *req, + else + ret2 = -EINVAL; + ++ /* no retry on NONBLOCK marked file */ ++ if (ret2 == -EAGAIN && (req->file->f_flags & O_NONBLOCK)) { ++ ret = 0; ++ goto done; ++ } ++ + /* Catch -EAGAIN return for forced non-blocking submission */ + if (!force_nonblock || ret2 != -EAGAIN) { ++ done: + kiocb_done(kiocb, ret2); + } else { + copy_iov: +@@ -2823,7 +2830,13 @@ static int io_write(struct io_kiocb *req + */ + 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) { ++done: + kiocb_done(kiocb, ret2); + } else { + copy_iov: diff --git a/queue-5.8/series b/queue-5.8/series index a3c67d9e3dd..855127a5dd9 100644 --- a/queue-5.8/series +++ b/queue-5.8/series @@ -173,3 +173,4 @@ mm-slub-fix-conversion-of-freelist_corrupted.patch mm-track-page-table-modifications-in-__apply_to_page_range.patch mm-madvise-fix-vma-user-after-free.patch mm-rmap-fixup-copying-of-soft-dirty-and-uffd-ptes.patch +io_uring-no-read-write-retry-on-eagain-error-and-o_nonblock-marked-file.patch