From: Dylan Yudaken <[email protected]>
To: <[email protected]>, <[email protected]>
Cc: <[email protected]>, <[email protected]>,
Dylan Yudaken <[email protected]>
Subject: [PATCH liburing 1/2] fixup poll-mshot-update
Date: Thu, 21 Jul 2022 09:04:05 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
this test did not notice when poll was cancelled.
update it to notice, and rearm poll
Signed-off-by: Dylan Yudaken <[email protected]>
---
test/poll-mshot-update.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/test/poll-mshot-update.c b/test/poll-mshot-update.c
index caedb6fddc4b..e01befcfa7eb 100644
--- a/test/poll-mshot-update.c
+++ b/test/poll-mshot-update.c
@@ -75,6 +75,20 @@ static int arm_poll(struct io_uring *ring, int off)
return 0;
}
+static int submit_arm_poll(struct io_uring *ring, int off)
+{
+ int ret;
+
+ ret = arm_poll(ring, off);
+ if (ret)
+ return ret;
+
+ ret = io_uring_submit(ring);
+ if (ret < 0)
+ return ret;
+ return ret == 1 ? 0 : -1;
+}
+
static int reap_polls(struct io_uring *ring)
{
struct io_uring_cqe *cqe;
@@ -106,6 +120,18 @@ static int reap_polls(struct io_uring *ring)
off = cqe->user_data;
if (off == 0x12345678)
goto seen;
+ if (!(cqe->flags & IORING_CQE_F_MORE)) {
+ /* need to re-arm poll */
+ ret = submit_arm_poll(ring, off);
+ if (ret)
+ break;
+ if (cqe->res <= 0) {
+ /* retry this one */
+ i--;
+ goto seen;
+ }
+ }
+
ret = read(p[off].fd[0], &c, 1);
if (ret != 1) {
if (ret == -1 && errno == EAGAIN)
--
2.30.2
next prev parent reply other threads:[~2022-07-21 16:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-21 16:04 [PATCH liburing 0/2] test: fix poll-mshot-update tests Dylan Yudaken
2022-07-21 16:04 ` Dylan Yudaken [this message]
2022-07-21 16:04 ` [PATCH liburing 2/2] test: have poll-mshot-update run with both big and small cqe Dylan Yudaken
2022-07-21 16:50 ` [PATCH liburing 0/2] test: fix poll-mshot-update tests Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox