Skip to contentSkip to conversation

two small fixes

PATCH In review Pavel Begunkov 2 participants 4 messages Oct 17, 2021 – Oct 18, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover two small fixes

The first correctly attributes failed iopoll requests. 2/2 fixes a for-next bug.

Pavel Begunkov (2):
io_uring: fail iopoll links if can't retry
io_uring: fix async_data checks for msg setup

 fs/io_uring.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.33.1
#1 lore raw

PATCH 1/2 io_uring: fail iopoll links if can't retry

If io_rw_should_reissue() fails in iopoll path and we can't reissue we fail the request. Don't forget to also mark it as failed, so links are broken.

---
 fs/io_uring.c | 1 +
 1 file changed, 1 insertion(+)
fs/io_uring.c +1 -0
index 0d7613c7355c..40b1697e7354 100644
@@ -2687,6 +2687,7 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2)
 			req->flags |= REQ_F_REISSUE;
 			return;
 		}
+		req_set_fail(req);
 		req->result = res;
 	}
 
Signature · 1 line
2.33.1
maintainer
#2 lore raw

Re: [PATCH 1/2] io_uring: fail iopoll links if can't retry

Quoted 25 lines · Pavel Begunkov

If io_rw_should_reissue() fails in iopoll path and we can't reissue we fail the request. Don't forget to also mark it as failed, so links are broken.

---
 fs/io_uring.c | 1 +
 1 file changed, 1 insertion(+)
fs/io_uring.c +1 -0
index 0d7613c7355c..40b1697e7354 100644
@@ -2687,6 +2687,7 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2)
 			req->flags |= REQ_F_REISSUE;
 			return;
 		}
+		req_set_fail(req);
 		req->result = res;
 	}
 
Signature · 1 line
2.33.1

<formletter>

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

#3 lore raw

PATCH 2/2 io_uring: fix async_data checks for msg setup

In reply to Pavel Begunkov

We should use req_has_async_data() instead of directly testing ->async_data to see if async_data has been allocated, there is one spot slipped that doesn't follow the rule.

Fixes 016e0451e9ed0 ("io_uring: control ->async_data with a REQ_F flag")
---
 fs/io_uring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/io_uring.c +2 -2
index 40b1697e7354..7ead1507be9b 100644
@@ -4683,9 +4683,9 @@ static int io_sync_file_range(struct io_kiocb *req, unsigned int issue_flags)
 static int io_setup_async_msg(struct io_kiocb *req,
 			      struct io_async_msghdr *kmsg)
 {
-	struct io_async_msghdr *async_msg = req->async_data;
+	struct io_async_msghdr *async_msg;
 
-	if (async_msg)
+	if (req_has_async_data(req))
 		return -EAGAIN;
 	if (io_alloc_async_data(req)) {
 		kfree(kmsg->free_iov);
Signature · 1 line
2.33.1