* [PATCH liburing] test/lfs-open: less limited test_drained_files
@ 2020-10-19 15:46 Pavel Begunkov
2020-10-20 14:12 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Begunkov @ 2020-10-19 15:46 UTC (permalink / raw)
To: Jens Axboe, io-uring
close(dup(io_uring)) should not neccessary cancel all requests with
files, because files are not yet going away. Test that it doesn't hang
after close() and exits, that's enough.
Signed-off-by: Pavel Begunkov <[email protected]>
---
test/lfs-openat.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/test/lfs-openat.c b/test/lfs-openat.c
index 921e2a1..3fa0b99 100644
--- a/test/lfs-openat.c
+++ b/test/lfs-openat.c
@@ -202,18 +202,11 @@ static int test_drained_files(int dfd, const char *fn, bool linked, bool prepend
return 1;
}
- /* io_uring->flush() */
+ /*
+ * close(), which triggers ->flush(), and io_uring_queue_exit()
+ * should successfully return and not hang.
+ */
close(fd);
-
- for (i = 0; i < to_cancel; i++) {
- ret = io_uring_wait_cqe(&ring, &cqe);
- if (cqe->res != -ECANCELED) {
- fprintf(stderr, "fail cqe->res=%d\n", cqe->res);
- return 1;
- }
- io_uring_cqe_seen(&ring, cqe);
- }
-
io_uring_queue_exit(&ring);
return 0;
}
--
2.24.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH liburing] test/lfs-open: less limited test_drained_files
2020-10-19 15:46 [PATCH liburing] test/lfs-open: less limited test_drained_files Pavel Begunkov
@ 2020-10-20 14:12 ` Jens Axboe
2020-10-20 16:15 ` Pavel Begunkov
0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2020-10-20 14:12 UTC (permalink / raw)
To: Pavel Begunkov, io-uring
On 10/19/20 9:46 AM, Pavel Begunkov wrote:
> close(dup(io_uring)) should not neccessary cancel all requests with
> files, because files are not yet going away. Test that it doesn't hang
> after close() and exits, that's enough.
Applied with the below incremental.
diff --git a/test/lfs-openat.c b/test/lfs-openat.c
index 3fa0b99db1b3..b14238a9a41d 100644
--- a/test/lfs-openat.c
+++ b/test/lfs-openat.c
@@ -133,10 +133,9 @@ static int test_drained_files(int dfd, const char *fn, bool linked, bool prepend
{
struct io_uring ring;
struct io_uring_sqe *sqe;
- struct io_uring_cqe *cqe;
char buffer[128];
struct iovec iov = {.iov_base = buffer, .iov_len = sizeof(buffer), };
- int i, ret, fd, fds[2], to_cancel = 0;
+ int ret, fd, fds[2], to_cancel = 0;
ret = io_uring_queue_init(10, &ring, 0);
if (ret < 0)
--
Jens Axboe
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH liburing] test/lfs-open: less limited test_drained_files
2020-10-20 14:12 ` Jens Axboe
@ 2020-10-20 16:15 ` Pavel Begunkov
0 siblings, 0 replies; 3+ messages in thread
From: Pavel Begunkov @ 2020-10-20 16:15 UTC (permalink / raw)
To: Jens Axboe, io-uring
On 20/10/2020 15:12, Jens Axboe wrote:
> On 10/19/20 9:46 AM, Pavel Begunkov wrote:
>> close(dup(io_uring)) should not neccessary cancel all requests with
>> files, because files are not yet going away. Test that it doesn't hang
>> after close() and exits, that's enough.
>
> Applied with the below incremental.
Thanks! My gcc 9 didn't warn me for some reason.
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-20 16:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-19 15:46 [PATCH liburing] test/lfs-open: less limited test_drained_files Pavel Begunkov
2020-10-20 14:12 ` Jens Axboe
2020-10-20 16:15 ` Pavel Begunkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox