* [PATCH liburing 1/1] tests/rsrc_tags: partial registration failure tags
@ 2025-04-04 15:54 Pavel Begunkov
2025-04-04 16:10 ` Jens Axboe
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Pavel Begunkov @ 2025-04-04 15:54 UTC (permalink / raw)
To: io-uring; +Cc: asml.silence
Make sure we don't post tags for a failed table registration.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
test/rsrc_tags.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/test/rsrc_tags.c b/test/rsrc_tags.c
index e78cfe40..0f7d9b69 100644
--- a/test/rsrc_tags.c
+++ b/test/rsrc_tags.c
@@ -408,6 +408,53 @@ static int test_notag(void)
return 0;
}
+static char buffer[16];
+
+static int test_tagged_register_partial_fail(void)
+{
+ __u64 tags[2] = { 1, 2 };
+ int fds[2] = { pipes[0], -1 };
+ struct iovec iovec[2];
+ struct io_uring ring;
+ int ret;
+
+ iovec[0].iov_base = buffer;
+ iovec[0].iov_len = 1;
+ iovec[1].iov_base = (void *)1UL;
+ iovec[1].iov_len = 1;
+
+ ret = io_uring_queue_init(1, &ring, 0);
+ if (ret) {
+ printf("ring setup failed\n");
+ return 1;
+ }
+
+ ret = io_uring_register_buffers_tags(&ring, iovec, tags, 2);
+ if (ret >= 0) {
+ fprintf(stderr, "io_uring_register_buffers_tags returned %i\n", ret);
+ return -EFAULT;
+ }
+
+ if (!check_cq_empty(&ring)) {
+ fprintf(stderr, "stray buffer CQEs found\n");
+ return -EFAULT;
+ }
+
+ ret = io_uring_register_files_tags(&ring, fds, tags, 2);
+ if (ret >= 0) {
+ fprintf(stderr, "io_uring_register_files_tags returned %i\n", ret);
+ return -EFAULT;
+ }
+
+ if (!check_cq_empty(&ring)) {
+ fprintf(stderr, "stray file CQEs found\n");
+ return -EFAULT;
+ }
+
+ io_uring_queue_exit(&ring);
+ return 0;
+}
+
int main(int argc, char *argv[])
{
int ring_flags[] = {0, IORING_SETUP_IOPOLL, IORING_SETUP_SQPOLL,
@@ -426,6 +473,12 @@ int main(int argc, char *argv[])
return 1;
}
+ ret = test_tagged_register_partial_fail();
+ if (ret) {
+ printf("test_tagged_register_partial_fail() failed\n");
+ return ret;
+ }
+
ret = test_notag();
if (ret) {
printf("test_notag failed\n");
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH liburing 1/1] tests/rsrc_tags: partial registration failure tags
2025-04-04 15:54 [PATCH liburing 1/1] tests/rsrc_tags: partial registration failure tags Pavel Begunkov
@ 2025-04-04 16:10 ` Jens Axboe
2025-04-04 16:18 ` Pavel Begunkov
2025-04-04 16:21 ` Pavel Begunkov
2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2025-04-04 16:10 UTC (permalink / raw)
To: io-uring, Pavel Begunkov
On Fri, 04 Apr 2025 16:54:03 +0100, Pavel Begunkov wrote:
> Make sure we don't post tags for a failed table registration.
>
>
Applied, thanks!
[1/1] tests/rsrc_tags: partial registration failure tags
commit: 5272830fcd6a66c3b8a8044dc9692650b7643212
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH liburing 1/1] tests/rsrc_tags: partial registration failure tags
2025-04-04 15:54 [PATCH liburing 1/1] tests/rsrc_tags: partial registration failure tags Pavel Begunkov
2025-04-04 16:10 ` Jens Axboe
@ 2025-04-04 16:18 ` Pavel Begunkov
2025-04-04 16:21 ` Pavel Begunkov
2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2025-04-04 16:18 UTC (permalink / raw)
To: io-uring; +Cc: asml.silence
Make sure we don't post tags for a failed table registration.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
test/rsrc_tags.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/test/rsrc_tags.c b/test/rsrc_tags.c
index e78cfe40..0f7d9b69 100644
--- a/test/rsrc_tags.c
+++ b/test/rsrc_tags.c
@@ -408,6 +408,53 @@ static int test_notag(void)
return 0;
}
+static char buffer[16];
+
+static int test_tagged_register_partial_fail(void)
+{
+ __u64 tags[2] = { 1, 2 };
+ int fds[2] = { pipes[0], -1 };
+ struct iovec iovec[2];
+ struct io_uring ring;
+ int ret;
+
+ iovec[0].iov_base = buffer;
+ iovec[0].iov_len = 1;
+ iovec[1].iov_base = (void *)1UL;
+ iovec[1].iov_len = 1;
+
+ ret = io_uring_queue_init(1, &ring, 0);
+ if (ret) {
+ printf("ring setup failed\n");
+ return 1;
+ }
+
+ ret = io_uring_register_buffers_tags(&ring, iovec, tags, 2);
+ if (ret >= 0) {
+ fprintf(stderr, "io_uring_register_buffers_tags returned %i\n", ret);
+ return -EFAULT;
+ }
+
+ if (!check_cq_empty(&ring)) {
+ fprintf(stderr, "stray buffer CQEs found\n");
+ return -EFAULT;
+ }
+
+ ret = io_uring_register_files_tags(&ring, fds, tags, 2);
+ if (ret >= 0) {
+ fprintf(stderr, "io_uring_register_files_tags returned %i\n", ret);
+ return -EFAULT;
+ }
+
+ if (!check_cq_empty(&ring)) {
+ fprintf(stderr, "stray file CQEs found\n");
+ return -EFAULT;
+ }
+
+ io_uring_queue_exit(&ring);
+ return 0;
+}
+
int main(int argc, char *argv[])
{
int ring_flags[] = {0, IORING_SETUP_IOPOLL, IORING_SETUP_SQPOLL,
@@ -426,6 +473,12 @@ int main(int argc, char *argv[])
return 1;
}
+ ret = test_tagged_register_partial_fail();
+ if (ret) {
+ printf("test_tagged_register_partial_fail() failed\n");
+ return ret;
+ }
+
ret = test_notag();
if (ret) {
printf("test_notag failed\n");
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH liburing 1/1] tests/rsrc_tags: partial registration failure tags
2025-04-04 15:54 [PATCH liburing 1/1] tests/rsrc_tags: partial registration failure tags Pavel Begunkov
2025-04-04 16:10 ` Jens Axboe
2025-04-04 16:18 ` Pavel Begunkov
@ 2025-04-04 16:21 ` Pavel Begunkov
2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2025-04-04 16:21 UTC (permalink / raw)
To: Pavel Begunkov; +Cc: io-uring
On 4/4/25 17:18, Pavel Begunkov wrote:
> Make sure we don't post tags for a failed table registration.
Resent by mistake, please ignore
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-04 16:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-04 15:54 [PATCH liburing 1/1] tests/rsrc_tags: partial registration failure tags Pavel Begunkov
2025-04-04 16:10 ` Jens Axboe
2025-04-04 16:18 ` Pavel Begunkov
2025-04-04 16:21 ` Pavel Begunkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox