Skip to contentSkip to conversation

5.8 io_uring stable

PATCH Jens Axboe 2 participants 5 messages Sep 4, 2020 – Sep 8, 2020

Subsystems (2)
lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

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 <[email protected]>
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.

fs/io_uring.c +12 -0
index 82e15020d9a8..96be21ace79a 100644
@@ -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:
Signature · 1 line
Jens Axboe
maintainer
#1 lore raw
Quoted 62 lines · Jens Axboe

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 <[email protected]>
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.

fs/io_uring.c +12 -0
index 82e15020d9a8..96be21ace79a 100644
@@ -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:
Signature · 2 lines
-- 
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?

thanks,

greg k-h

author
#2 lore raw
Quoted 61 lines · Greg KH
Quoted 60 lines · Jens Axboe

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 <[email protected]>
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.

fs/io_uring.c +12 -0
index 82e15020d9a8..96be21ace79a 100644
@@ -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:
Quoted 6 lines
Quoted 2 lines
Signature · 1 line
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.

Signature · 1 line
Jens Axboe
author
#3 lore raw
Quoted 69 lines · Jens Axboe
Quoted 61 lines · Greg KH
Quoted 60 lines · Jens Axboe

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 <[email protected]>
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.

fs/io_uring.c +12 -0
index 82e15020d9a8..96be21ace79a 100644
@@ -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:
Quoted 6 lines
Quoted 2 lines
Signature · 1 line
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?

Quoted 2 lines

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.

Here it is:

commit d0ea3f3d17cf891244f17f8ceb43d4988c170471

Author: Jens Axboe <[email protected]>
Date:   Tue Sep 8 07:16:12 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.

fs/io_uring.c +13 -0
index 4115bfedf15d..fe114511d6d6 100644
@@ -2697,8 +2697,15 @@ static int io_read(struct io_kiocb *req, bool force_nonblock)
 		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, 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) {
+done:
 			kiocb_done(kiocb, ret2);
 		} else {
 copy_iov:
Signature · 1 line
Jens Axboe
maintainer
#4 lore raw
Quoted 88 lines · Jens Axboe
Quoted 69 lines · Jens Axboe
Quoted 61 lines · Greg KH
Quoted 60 lines · Jens Axboe

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 <[email protected]>
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.

fs/io_uring.c +12 -0
index 82e15020d9a8..96be21ace79a 100644
@@ -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:
Quoted 6 lines
Quoted 2 lines
Signature · 1 line
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?

Quoted 2 lines

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.

Here it is:

commit d0ea3f3d17cf891244f17f8ceb43d4988c170471

Author: Jens Axboe <[email protected]>
Date:   Tue Sep 8 07:16:12 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.

Quoted 6 lines

- If we hit -EAGAIN on a nonblock marked file, don't arm poll handler for it. It should just complete with -EAGAIN.

Much nicer, that worked, thanks!

greg k-h