syscalls/io_submit: Flush IO completion queue
PATCH 1/1 syscalls/io_submit: Flush IO completion queue
Running io_submit01 or io_submit02 with high number of iterations (e.g. io_submit01 -i 200) would result in bogus errors because the kernel queue will get clogged with completed requests. Fix this by calling io_getevents() to flush the completion queue.
Signed-off-by Martin Doucha <[email protected]>
--- testcases/kernel/syscalls/io_submit/io_submit01.c | 8 +++++++- testcases/kernel/syscalls/io_submit/io_submit02.c | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/io_submit/io_submit01.c +7 -1
@@ -114,13 +114,19 @@ static const char *errno_name(int err)static void verify_io_submit (unsigned int n) {struct tcase *t = &tcases[n]; -int ret; +struct io_event evbuf; +struct timespec timeout = { .tv_sec =1 }; +int i, ret; ret =io_submit (*t->ctx, t->nr, t->iocbs);if (ret == t->exp_errno) {tst_res (TPASS ,"io_submit() with %s failed with %s" , t->desc,errno_name (t->exp_errno)); + +for (i =0 ; i < ret; i++) +io_getevents (*t->ctx,1 ,1 , &evbuf, &timeout); +return ; }
testcases/kernel/syscalls/io_submit/io_submit02.c +9 -0
@@ -70,12 +70,21 @@ static void cleanup(void)static void run (unsigned int i) { +struct io_event evbuf; +struct timespec timeout = { .tv_sec =1 }; +long j; +TEST (tst_syscall (__NR_io_submit, *tc[i].ctx, tc[i].nr, tc[i].iocbs));if (TST_RET == tc[i].nr)tst_res (TPASS ,"io_submit() %s" , tc[i].desc);else tst_res (TFAIL ,"io_submit() returns %ld, expected %ld" ,TST_RET , tc[i].nr); + +for (j =0 ; j <TST_RET ; j++) { +tst_syscall (__NR_io_getevents, *tc[i].ctx,1 ,1 , &evbuf, + &timeout); + } }static struct tst_test test = {
Signature · 5 lines
2.35.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Martin,
Quoted 4 lines
Running
io_submit01orio_submit02with high number of iterations (e.g.io_submit01-i 200) would result in bogus errors because the kernel queue will get clogged with completed requests. Fix this by callingio_getevents()to flush the completion queue.
Thanks, merged!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp