* [PATCH liburing 0/4] rsrc tests and fixes
@ 2021-05-07 16:22 Pavel Begunkov
2021-05-07 16:22 ` [PATCH liburing 1/4] sync io_uring.h API file with Linux 5.13 Pavel Begunkov
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Pavel Begunkov @ 2021-05-07 16:22 UTC (permalink / raw)
To: Jens Axboe, io-uring
1-2: rsrc tagging, buffer update, rsrc register, etc. tests
3-4: small tests fixes
Pavel Begunkov (4):
sync io_uring.h API file with Linux 5.13
tests: add rsrc tags tests
tests: fix timeout-new for old kernels
tests: fix minor connect flaws
src/include/liburing/io_uring.h | 41 ++-
test/Makefile | 2 +
test/connect.c | 8 +-
test/rsrc_tags.c | 431 ++++++++++++++++++++++++++++++++
test/timeout-new.c | 2 +-
5 files changed, 471 insertions(+), 13 deletions(-)
create mode 100644 test/rsrc_tags.c
--
2.31.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH liburing 1/4] sync io_uring.h API file with Linux 5.13
2021-05-07 16:22 [PATCH liburing 0/4] rsrc tests and fixes Pavel Begunkov
@ 2021-05-07 16:22 ` Pavel Begunkov
2021-05-07 16:22 ` [PATCH liburing 2/4] tests: add rsrc tags tests Pavel Begunkov
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Pavel Begunkov @ 2021-05-07 16:22 UTC (permalink / raw)
To: Jens Axboe, io-uring
Add resource tagging and registation and multi-polling definitions, and
align space/tabs with the kernel.
Signed-off-by: Pavel Begunkov <[email protected]>
---
src/include/liburing/io_uring.h | 41 ++++++++++++++++++++++++++-------
1 file changed, 33 insertions(+), 8 deletions(-)
diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
index eed991d..5a3cb90 100644
--- a/src/include/liburing/io_uring.h
+++ b/src/include/liburing/io_uring.h
@@ -168,16 +168,16 @@ enum {
* POLL_ADD flags. Note that since sqe->poll_events is the flag space, the
* command flags for POLL_ADD are stored in sqe->len.
*
- * IORING_POLL_ADD_MULTI Multishot poll. Sets IORING_CQE_F_MORE if
- * the poll handler will continue to report
- * CQEs on behalf of the same SQE.
+ * IORING_POLL_ADD_MULTI Multishot poll. Sets IORING_CQE_F_MORE if
+ * the poll handler will continue to report
+ * CQEs on behalf of the same SQE.
*
- * IORING_POLL_UPDATE Update existing poll request, matching
- * sqe->addr as the old user_data field.
+ * IORING_POLL_UPDATE Update existing poll request, matching
+ * sqe->addr as the old user_data field.
*/
-#define IORING_POLL_ADD_MULTI (1U << 0)
-#define IORING_POLL_UPDATE_EVENTS (1U << 1)
-#define IORING_POLL_UPDATE_USER_DATA (1U << 2)
+#define IORING_POLL_ADD_MULTI (1U << 0)
+#define IORING_POLL_UPDATE_EVENTS (1U << 1)
+#define IORING_POLL_UPDATE_USER_DATA (1U << 2)
/*
* IO completion data structure (Completion Queue Entry)
@@ -192,8 +192,10 @@ struct io_uring_cqe {
* cqe->flags
*
* IORING_CQE_F_BUFFER If set, the upper 16 bits are the buffer ID
+ * IORING_CQE_F_MORE If set, parent SQE will generate more CQE entries
*/
#define IORING_CQE_F_BUFFER (1U << 0)
+#define IORING_CQE_F_MORE (1U << 1)
enum {
IORING_CQE_BUFFER_SHIFT = 16,
@@ -301,6 +303,8 @@ enum {
IORING_UNREGISTER_PERSONALITY = 10,
IORING_REGISTER_RESTRICTIONS = 11,
IORING_REGISTER_ENABLE_RINGS = 12,
+ IORING_REGISTER_RSRC = 13,
+ IORING_REGISTER_RSRC_UPDATE = 14,
/* this goes last */
IORING_REGISTER_LAST
@@ -313,12 +317,33 @@ struct io_uring_files_update {
__aligned_u64 /* __s32 * */ fds;
};
+enum {
+ IORING_RSRC_FILE = 0,
+ IORING_RSRC_BUFFER = 1,
+};
+
+struct io_uring_rsrc_register {
+ __u32 type;
+ __u32 nr;
+ __aligned_u64 data;
+ __aligned_u64 tags;
+};
+
struct io_uring_rsrc_update {
__u32 offset;
__u32 resv;
__aligned_u64 data;
};
+struct io_uring_rsrc_update2 {
+ __u32 offset;
+ __u32 resv;
+ __aligned_u64 data;
+ __aligned_u64 tags;
+ __u32 type;
+ __u32 nr;
+};
+
/* Skip updating fd indexes set to this value in the fd table */
#define IORING_REGISTER_FILES_SKIP (-2)
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH liburing 2/4] tests: add rsrc tags tests
2021-05-07 16:22 [PATCH liburing 0/4] rsrc tests and fixes Pavel Begunkov
2021-05-07 16:22 ` [PATCH liburing 1/4] sync io_uring.h API file with Linux 5.13 Pavel Begunkov
@ 2021-05-07 16:22 ` Pavel Begunkov
2021-05-07 16:22 ` [PATCH liburing 3/4] tests: fix timeout-new for old kernels Pavel Begunkov
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Pavel Begunkov @ 2021-05-07 16:22 UTC (permalink / raw)
To: Jens Axboe, io-uring
Test rsrc tagging, updates, new registration opcodes for buffers and
files.
Signed-off-by: Pavel Begunkov <[email protected]>
---
test/Makefile | 2 +
test/rsrc_tags.c | 431 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 433 insertions(+)
create mode 100644 test/rsrc_tags.c
diff --git a/test/Makefile b/test/Makefile
index 2a1985b..a312409 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -115,6 +115,7 @@ test_targets += \
unlink \
wakeup-hang \
sendmsg_fs_cve \
+ rsrc_tags \
# EOL
all_targets += $(test_targets)
@@ -253,6 +254,7 @@ test_srcs := \
unlink.c \
wakeup-hang.c \
sendmsg_fs_cve.c \
+ rsrc_tags.c \
# EOL
test_objs := $(patsubst %.c,%.ol,$(patsubst %.cc,%.ol,$(test_srcs)))
diff --git a/test/rsrc_tags.c b/test/rsrc_tags.c
new file mode 100644
index 0000000..7192873
--- /dev/null
+++ b/test/rsrc_tags.c
@@ -0,0 +1,431 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Description: run various file registration tests
+ *
+ */
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <assert.h>
+
+#include "../src/syscall.h"
+#include "helpers.h"
+#include "liburing.h"
+
+static int pipes[2];
+
+static bool check_cq_empty(struct io_uring *ring)
+{
+ struct io_uring_cqe *cqe = NULL;
+ int ret;
+
+ sleep(1); /* doesn't happen immediately, so wait */
+ ret = io_uring_peek_cqe(ring, &cqe); /* nothing should be there */
+ return ret == -EAGAIN;
+}
+
+static int register_rsrc(struct io_uring *ring, int type, int nr,
+ const void *arg, const __u64 *tags)
+{
+ struct io_uring_rsrc_register reg;
+ int ret;
+
+ memset(®, 0, sizeof(reg));
+ reg.type = type;
+ reg.nr = nr;
+ reg.data = (__u64)arg;
+ reg.tags = (__u64)tags;
+
+ ret = __sys_io_uring_register(ring->ring_fd, IORING_REGISTER_RSRC,
+ ®, sizeof(reg));
+ return ret ? -errno : 0;
+}
+
+static int update_rsrc(struct io_uring *ring, int type, int nr, int off,
+ const void *arg, const __u64 *tags)
+{
+ struct io_uring_rsrc_update2 up;
+ int ret;
+
+ memset(&up, 0, sizeof(up));
+ up.offset = off;
+ up.data = (__u64)arg;
+ up.tags = (__u64)tags;
+ up.type = type;
+ up.nr = nr;
+
+ ret = __sys_io_uring_register(ring->ring_fd, IORING_REGISTER_RSRC_UPDATE,
+ &up, sizeof(up));
+ return ret < 0 ? -errno : ret;
+}
+
+static bool has_rsrc_update(void)
+{
+ struct io_uring ring;
+ char buf[1024];
+ struct iovec vec = {.iov_base = buf, .iov_len = sizeof(buf), };
+ int ret;
+
+ ret = io_uring_queue_init(1, &ring, 0);
+ if (ret)
+ return false;
+
+ ret = register_rsrc(&ring, IORING_RSRC_BUFFER, 1, &vec, NULL);
+ io_uring_queue_exit(&ring);
+ return ret != -EINVAL;
+}
+
+static int test_tags_generic(int nr, int type, void *rsrc, int ring_flags)
+{
+ struct io_uring_cqe *cqe = NULL;
+ struct io_uring ring;
+ int i, ret;
+ __u64 *tags;
+
+ tags = malloc(nr * sizeof(*tags));
+ if (!tags)
+ return 1;
+ for (i = 0; i < nr; i++)
+ tags[i] = i + 1;
+ ret = io_uring_queue_init(1, &ring, 0);
+ if (ret) {
+ printf("ring setup failed\n");
+ return 1;
+ }
+
+ ret = register_rsrc(&ring, type, nr, rsrc, tags);
+ if (ret) {
+ fprintf(stderr, "rsrc register failed %i\n", ret);
+ return 1;
+ }
+
+ /* test that tags are set */
+ tags[0] = 666;
+ ret = update_rsrc(&ring, type, 1, 0, rsrc, &tags[0]);
+ assert(ret == 1);
+ ret = io_uring_wait_cqe(&ring, &cqe);
+ assert(!ret && cqe->user_data == 1);
+ io_uring_cqe_seen(&ring, cqe);
+
+ /* test that tags are updated */
+ tags[0] = 0;
+ ret = update_rsrc(&ring, type, 1, 0, rsrc, &tags[0]);
+ assert(ret == 1);
+ ret = io_uring_wait_cqe(&ring, &cqe);
+ assert(!ret && cqe->user_data == 666);
+ io_uring_cqe_seen(&ring, cqe);
+
+ /* test tag=0 doesn't emit CQE */
+ tags[0] = 1;
+ ret = update_rsrc(&ring, type, 1, 0, rsrc, &tags[0]);
+ assert(ret == 1);
+ assert(check_cq_empty(&ring));
+
+ free(tags);
+ io_uring_queue_exit(&ring);
+ return 0;
+}
+
+static int test_buffers_update(void)
+{
+ struct io_uring_sqe *sqe;
+ struct io_uring_cqe *cqe = NULL;
+ struct io_uring ring;
+ const int nr = 5;
+ int buf_idx = 1, i, ret;
+ int pipes[2];
+ char tmp_buf[1024];
+ char tmp_buf2[1024];
+ struct iovec vecs[nr];
+ __u64 tags[nr];
+
+ for (i = 0; i < nr; i++) {
+ vecs[i].iov_base = tmp_buf;
+ vecs[i].iov_len = 1024;
+ tags[i] = i + 1;
+ }
+
+ ret = test_tags_generic(nr, IORING_RSRC_BUFFER, vecs, 0);
+ if (ret)
+ return 1;
+
+ ret = io_uring_queue_init(1, &ring, 0);
+ if (ret) {
+ printf("ring setup failed\n");
+ return 1;
+ }
+ if (pipe(pipes) < 0) {
+ perror("pipe");
+ return 1;
+ }
+ ret = register_rsrc(&ring, IORING_RSRC_BUFFER, nr, vecs, tags);
+ if (ret) {
+ fprintf(stderr, "rsrc register failed %i\n", ret);
+ return 1;
+ }
+
+ /* test that CQE is not emmited before we're done with a buffer */
+ sqe = io_uring_get_sqe(&ring);
+ io_uring_prep_read_fixed(sqe, pipes[0], tmp_buf, 10, 0, 0);
+ sqe->user_data = 100;
+ ret = io_uring_submit(&ring);
+ if (ret != 1) {
+ fprintf(stderr, "%s: got %d, wanted 1\n", __FUNCTION__, ret);
+ return 1;
+ }
+ ret = io_uring_peek_cqe(&ring, &cqe);
+ assert(ret == -EAGAIN);
+
+ vecs[buf_idx].iov_base = tmp_buf2;
+ ret = update_rsrc(&ring, IORING_RSRC_BUFFER, 1, buf_idx,
+ &vecs[buf_idx], &tags[buf_idx]);
+ if (ret != 1) {
+ fprintf(stderr, "rsrc update failed %i %i\n", ret, errno);
+ return 1;
+ }
+
+ ret = io_uring_peek_cqe(&ring, &cqe); /* nothing should be there */
+ assert(ret == -EAGAIN);
+ close(pipes[0]);
+ close(pipes[1]);
+
+ ret = io_uring_wait_cqe(&ring, &cqe);
+ assert(!ret && cqe->user_data == 100);
+ io_uring_cqe_seen(&ring, cqe);
+ ret = io_uring_wait_cqe(&ring, &cqe);
+ assert(!ret && cqe->user_data == buf_idx + 1);
+ io_uring_cqe_seen(&ring, cqe);
+
+ io_uring_queue_exit(&ring);
+ return 0;
+}
+
+static int test_buffers_empty_buffers(void)
+{
+ struct io_uring_sqe *sqe;
+ struct io_uring_cqe *cqe = NULL;
+ struct io_uring ring;
+ const int nr = 5;
+ int ret, i;
+ char tmp_buf[1024];
+ struct iovec vecs[nr];
+
+ for (i = 0; i < nr; i++) {
+ vecs[i].iov_base = 0;
+ vecs[i].iov_len = 0;
+ }
+ vecs[0].iov_base = tmp_buf;
+ vecs[0].iov_len = 10;
+
+ ret = io_uring_queue_init(1, &ring, 0);
+ if (ret) {
+ printf("ring setup failed\n");
+ return 1;
+ }
+
+ ret = register_rsrc(&ring, IORING_RSRC_BUFFER, nr, vecs, NULL);
+ if (ret) {
+ fprintf(stderr, "rsrc register failed %i\n", ret);
+ return 1;
+ }
+
+ /* empty to buffer */
+ vecs[1].iov_base = tmp_buf;
+ vecs[1].iov_len = 10;
+ ret = update_rsrc(&ring, IORING_RSRC_BUFFER, 1, 1, &vecs[1], NULL);
+ if (ret != 1) {
+ fprintf(stderr, "rsrc update failed %i %i\n", ret, errno);
+ return 1;
+ }
+
+ /* buffer to empty */
+ vecs[0].iov_base = 0;
+ vecs[0].iov_len = 0;
+ ret = update_rsrc(&ring, IORING_RSRC_BUFFER, 1, 0, &vecs[0], NULL);
+ if (ret != 1) {
+ fprintf(stderr, "rsrc update failed %i %i\n", ret, errno);
+ return 1;
+ }
+
+ /* zero to zero is ok */
+ ret = update_rsrc(&ring, IORING_RSRC_BUFFER, 1, 2, &vecs[2], NULL);
+ if (ret != 1) {
+ fprintf(stderr, "rsrc update failed %i %i\n", ret, errno);
+ return 1;
+ }
+
+ /* empty buf with non-zero len fails */
+ vecs[3].iov_base = 0;
+ vecs[3].iov_len = 1;
+ ret = update_rsrc(&ring, IORING_RSRC_BUFFER, 1, 3, &vecs[3], NULL);
+ if (ret >= 0) {
+ fprintf(stderr, "rsrc update failed %i %i\n", ret, errno);
+ return 1;
+ }
+
+ /* test rw on empty ubuf is failed */
+ sqe = io_uring_get_sqe(&ring);
+ io_uring_prep_read_fixed(sqe, pipes[0], tmp_buf, 10, 0, 2);
+ sqe->user_data = 100;
+ ret = io_uring_submit(&ring);
+ if (ret != 1) {
+ fprintf(stderr, "%s: got %d, wanted 1\n", __FUNCTION__, ret);
+ return 1;
+ }
+ ret = io_uring_wait_cqe(&ring, &cqe);
+ assert(!ret && cqe->user_data == 100);
+ assert(cqe->res);
+ io_uring_cqe_seen(&ring, cqe);
+
+ sqe = io_uring_get_sqe(&ring);
+ io_uring_prep_read_fixed(sqe, pipes[0], tmp_buf, 0, 0, 2);
+ sqe->user_data = 100;
+ ret = io_uring_submit(&ring);
+ if (ret != 1) {
+ fprintf(stderr, "%s: got %d, wanted 1\n", __FUNCTION__, ret);
+ return 1;
+ }
+ ret = io_uring_wait_cqe(&ring, &cqe);
+ assert(!ret && cqe->user_data == 100);
+ assert(cqe->res);
+ io_uring_cqe_seen(&ring, cqe);
+
+ io_uring_queue_exit(&ring);
+ return 0;
+}
+
+
+static int test_files(int ring_flags)
+{
+ struct io_uring_cqe *cqe = NULL;
+ struct io_uring ring;
+ const int nr = 50;
+ int off = 5, i, ret, fd;
+ int files[nr];
+ __u64 tags[nr], tag;
+
+ for (i = 0; i < nr; ++i) {
+ files[i] = pipes[0];
+ tags[i] = i + 1;
+ }
+
+ ret = test_tags_generic(nr, IORING_RSRC_FILE, files, ring_flags);
+ if (ret)
+ return 1;
+
+ ret = io_uring_queue_init(1, &ring, ring_flags);
+ if (ret) {
+ printf("ring setup failed\n");
+ return 1;
+ }
+ ret = register_rsrc(&ring, IORING_RSRC_FILE, nr, files, tags);
+ if (ret) {
+ fprintf(stderr, "rsrc register failed %i\n", ret);
+ return 1;
+ }
+
+ /* check update did update tag */
+ fd = -1;
+ ret = io_uring_register_files_update(&ring, off, &fd, 1);
+ assert(ret == 1);
+ ret = io_uring_wait_cqe(&ring, &cqe);
+ assert(!ret && cqe->user_data == tags[off]);
+ io_uring_cqe_seen(&ring, cqe);
+
+ /* remove removed file, shouldn't emit old tag */
+ ret = io_uring_register_files_update(&ring, off, &fd, 1);
+ assert(ret <= 1);
+ assert(check_cq_empty(&ring));
+
+ /* non-zero tag with remove update is disallowed */
+ tag = 1;
+ fd = -1;
+ ret = update_rsrc(&ring, IORING_RSRC_FILE, 1, off + 1, &fd, &tag);
+ assert(ret);
+
+ io_uring_queue_exit(&ring);
+ return 0;
+}
+
+static int test_notag(void)
+{
+ struct io_uring_cqe *cqe = NULL;
+ struct io_uring ring;
+ int i, ret, fd;
+ const int nr = 50;
+ int files[nr];
+
+ ret = io_uring_queue_init(1, &ring, 0);
+ if (ret) {
+ printf("ring setup failed\n");
+ return 1;
+ }
+ for (i = 0; i < nr; ++i)
+ files[i] = pipes[0];
+
+ ret = io_uring_register_files(&ring, files, nr);
+ assert(!ret);
+
+ /* default register, update shouldn't emit CQE */
+ fd = -1;
+ ret = io_uring_register_files_update(&ring, 0, &fd, 1);
+ assert(ret == 1);
+ assert(check_cq_empty(&ring));
+
+ ret = io_uring_unregister_files(&ring);
+ assert(!ret);
+ ret = io_uring_peek_cqe(&ring, &cqe); /* nothing should be there */
+ assert(ret);
+
+ io_uring_queue_exit(&ring);
+ return 0;
+}
+
+int main(int argc, char *argv[])
+{
+ int ring_flags[] = {0, IORING_SETUP_IOPOLL, IORING_SETUP_SQPOLL};
+ int i, ret;
+
+ if (argc > 1)
+ return 0;
+ if (!has_rsrc_update()) {
+ fprintf(stderr, "doesn't support rsrc tags, skip\n");
+ return 0;
+ }
+
+ if (pipe(pipes) < 0) {
+ perror("pipe");
+ return 1;
+ }
+
+ ret = test_notag();
+ if (ret) {
+ printf("test_notag failed\n");
+ return ret;
+ }
+
+ for (i = 0; i < sizeof(ring_flags) / sizeof(ring_flags[0]); i++) {
+ ret = test_files(ring_flags[i]);
+ if (ret) {
+ printf("test_tag failed, type %i\n", i);
+ return ret;
+ }
+ }
+
+ ret = test_buffers_update();
+ if (ret) {
+ printf("test_buffers_update failed\n");
+ return ret;
+ }
+
+ ret = test_buffers_empty_buffers();
+ if (ret) {
+ printf("test_buffers_empty_buffers failed\n");
+ return ret;
+ }
+
+ return 0;
+}
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH liburing 3/4] tests: fix timeout-new for old kernels
2021-05-07 16:22 [PATCH liburing 0/4] rsrc tests and fixes Pavel Begunkov
2021-05-07 16:22 ` [PATCH liburing 1/4] sync io_uring.h API file with Linux 5.13 Pavel Begunkov
2021-05-07 16:22 ` [PATCH liburing 2/4] tests: add rsrc tags tests Pavel Begunkov
@ 2021-05-07 16:22 ` Pavel Begunkov
2021-05-07 16:22 ` [PATCH liburing 4/4] tests: fix minor connect flaws Pavel Begunkov
2021-05-07 16:28 ` [PATCH liburing 0/4] rsrc tests and fixes Jens Axboe
4 siblings, 0 replies; 6+ messages in thread
From: Pavel Begunkov @ 2021-05-07 16:22 UTC (permalink / raw)
To: Jens Axboe, io-uring
Users report timeout-new fails. Don't return an error for older kernels
not supporting IORING_FEAT_EXT_ARG, just skip it.
Signed-off-by: Pavel Begunkov <[email protected]>
---
test/timeout-new.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/timeout-new.c b/test/timeout-new.c
index 45b9a14..b0bb5ee 100644
--- a/test/timeout-new.c
+++ b/test/timeout-new.c
@@ -203,7 +203,7 @@ int main(int argc, char *argv[])
}
if (!(ring_normal.features & IORING_FEAT_EXT_ARG)) {
fprintf(stderr, "feature IORING_FEAT_EXT_ARG not supported.\n");
- return 1;
+ return 0;
}
ret = test_return_before_timeout(&ring_normal);
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH liburing 4/4] tests: fix minor connect flaws
2021-05-07 16:22 [PATCH liburing 0/4] rsrc tests and fixes Pavel Begunkov
` (2 preceding siblings ...)
2021-05-07 16:22 ` [PATCH liburing 3/4] tests: fix timeout-new for old kernels Pavel Begunkov
@ 2021-05-07 16:22 ` Pavel Begunkov
2021-05-07 16:28 ` [PATCH liburing 0/4] rsrc tests and fixes Jens Axboe
4 siblings, 0 replies; 6+ messages in thread
From: Pavel Begunkov @ 2021-05-07 16:22 UTC (permalink / raw)
To: Jens Axboe, io-uring
Use inet_aton() to set address, otherwise can lead to problems depending
on endianness.
Also, set user_data only after io_uring_prep_link_timeout(), otherwise
will be rewritten.
Signed-off-by: Pavel Begunkov <[email protected]>
---
test/connect.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/connect.c b/test/connect.c
index ab81bb8..91b5578 100644
--- a/test/connect.c
+++ b/test/connect.c
@@ -14,6 +14,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
+#include <arpa/inet.h>
#include "liburing.h"
@@ -125,9 +126,8 @@ static int configure_connect(int fd, struct sockaddr_in* addr)
memset(addr, 0, sizeof(*addr));
addr->sin_family = AF_INET;
addr->sin_port = use_port;
- addr->sin_addr.s_addr = 0x0100007fU;
-
- return 0;
+ ret = inet_aton("127.0.0.1", &addr->sin_addr);
+ return ret;
}
static int connect_socket(struct io_uring *ring, int fd, int *code)
@@ -292,9 +292,9 @@ static int test_connect_timeout(struct io_uring *ring)
fprintf(stderr, "unable to get sqe\n");
goto err;
}
+ io_uring_prep_link_timeout(sqe, &ts, 0);
sqe->user_data = 2;
- io_uring_prep_link_timeout(sqe, &ts, 0);
ret = io_uring_submit(ring);
if (ret != 2) {
fprintf(stderr, "submitted %d\n", ret);
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH liburing 0/4] rsrc tests and fixes
2021-05-07 16:22 [PATCH liburing 0/4] rsrc tests and fixes Pavel Begunkov
` (3 preceding siblings ...)
2021-05-07 16:22 ` [PATCH liburing 4/4] tests: fix minor connect flaws Pavel Begunkov
@ 2021-05-07 16:28 ` Jens Axboe
4 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2021-05-07 16:28 UTC (permalink / raw)
To: Pavel Begunkov, io-uring
On 5/7/21 10:22 AM, Pavel Begunkov wrote:
> 1-2: rsrc tagging, buffer update, rsrc register, etc. tests
> 3-4: small tests fixes
>
> Pavel Begunkov (4):
> sync io_uring.h API file with Linux 5.13
> tests: add rsrc tags tests
> tests: fix timeout-new for old kernels
> tests: fix minor connect flaws
>
> src/include/liburing/io_uring.h | 41 ++-
> test/Makefile | 2 +
> test/connect.c | 8 +-
> test/rsrc_tags.c | 431 ++++++++++++++++++++++++++++++++
> test/timeout-new.c | 2 +-
> 5 files changed, 471 insertions(+), 13 deletions(-)
> create mode 100644 test/rsrc_tags.c
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-05-07 16:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-07 16:22 [PATCH liburing 0/4] rsrc tests and fixes Pavel Begunkov
2021-05-07 16:22 ` [PATCH liburing 1/4] sync io_uring.h API file with Linux 5.13 Pavel Begunkov
2021-05-07 16:22 ` [PATCH liburing 2/4] tests: add rsrc tags tests Pavel Begunkov
2021-05-07 16:22 ` [PATCH liburing 3/4] tests: fix timeout-new for old kernels Pavel Begunkov
2021-05-07 16:22 ` [PATCH liburing 4/4] tests: fix minor connect flaws Pavel Begunkov
2021-05-07 16:28 ` [PATCH liburing 0/4] rsrc tests and fixes Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox