From: Hao Xu <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, Pavel Begunkov <[email protected]>
Subject: [PATCH 1/3] Fix incorrect close in test for multishot accept
Date: Fri, 17 Jun 2022 22:36:01 +0800 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
From: Donald Hunter <[email protected]>
This fixes a bug in accept_conn handling in the accept tests that caused it
to incorrectly skip the multishot tests and also lose the warning message
to a closed stdout. This can be seen in the strace output below.
close(1) = 0
io_uring_setup(32, { ...
...
write(1, "Fixed Multishot Accept not suppo"..., 47) = -1 EINVAL
Unfortunately this exposes a a bug with gcc -O2 where multishot_mask logic
gets optimized incorrectly and "Fixed Multishot Accept misses events" is
wrongly reported. I am investigating this separately.
Fixes: 66cf84527c34 ("test/accept.c: add test for multishot mode accept")
Signed-off-by: Donald Hunter <[email protected]>
---
test/accept.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/test/accept.c b/test/accept.c
index 4e2f58767b3c..c6654baa3925 100644
--- a/test/accept.c
+++ b/test/accept.c
@@ -103,7 +103,7 @@ static void queue_accept_conn(struct io_uring *ring, int fd,
}
}
-static int accept_conn(struct io_uring *ring, int fixed_idx)
+static int accept_conn(struct io_uring *ring, int fixed_idx, bool multishot)
{
struct io_uring_cqe *cqe;
int ret;
@@ -115,8 +115,10 @@ static int accept_conn(struct io_uring *ring, int fixed_idx)
if (fixed_idx >= 0) {
if (ret > 0) {
- close(ret);
- return -EINVAL;
+ if (!multishot) {
+ close(ret);
+ return -EINVAL;
+ }
} else if (!ret) {
ret = fixed_idx;
}
@@ -208,7 +210,7 @@ static int test_loop(struct io_uring *ring,
queue_accept_conn(ring, recv_s0, args);
for (i = 0; i < MAX_FDS; i++) {
- s_fd[i] = accept_conn(ring, args.fixed ? 0 : -1);
+ s_fd[i] = accept_conn(ring, args.fixed ? 0 : -1, multishot);
if (s_fd[i] == -EINVAL) {
if (args.accept_should_error)
goto out;
--
2.25.1
next prev parent reply other threads:[~2022-06-17 14:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 14:36 [PATCH liburing 0/3] multishot accept test fix and clean Hao Xu
2022-06-17 14:36 ` Hao Xu [this message]
2022-06-17 14:36 ` [PATCH 2/3] test/accept: fix minus one error when calculating multishot_mask Hao Xu
2022-06-17 14:36 ` [PATCH 3/3] test/accept: clean code of accept test Hao Xu
2022-06-17 14:41 ` [PATCH liburing 0/3] multishot accept test fix and clean Hao Xu
2022-06-17 14:42 ` 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] \
/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